Click to See Complete Forum and Search --> : Trouble installing gcc 4.5


Lindley
May 24th, 2010, 03:09 PM
I'm trying to install gcc 4.5 on a Linux box (Redhat 5.5) so that I can begin playing around with the C++0x features it offers. However, I don't have admin on the server, so I'm trying to install it locally. (I've contacted the admin about this, but who knows how long it'll take to get anything done that way.)

I convinced it to build from source just fine, but when I try to build with it, the standard library appears to be inaccessible.

My attempted solution was to use the "alias" command like so:

alias g++0x="/u1/public/gcc-4.5.0/host-x86_64-unknown-linux-gnu/gcc/g++ -I/u1/public/gcc-4.5.0/libstdc++-v3/include/ -I/u1/public/gcc-4.5.0/libstdc++-v3/include/std/ -I/u1/public/gcc-4.5.0/libstdc++-v3/include/c/ -I/u1/public/gcc-4.5.0/libstdc++-v3/include/c_compatibility/ -I/u1/public/gcc-4.5.0/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu/ -I/u1/public/gcc-4.5.0/libstdc++-v3/libsupc++/ -std=c++0x"

As you can see, I've been adding directories for a while trying to convince things to start working, but it seems like there's always another one required......I'd like to skip to the end and somehow get a complete list of what I need, and/or convince g++ to simply know where the headers are by default.

Any suggestions?

S_M_A
May 24th, 2010, 05:16 PM
I'm not a seasoned Linux user but I guess the standard paths are built in? At least on my system I get a hit when running grep /usr/include on g++-4.4. I.e. since you build it yourself it should be possible to replace those default paths to your private ones for both the compiler and the linker.

Another solution would be to install it in a virtual machine but I guess the admins have closed that door as well?

Lindley
May 25th, 2010, 05:43 PM
Yeah, the configure script has a --prefix option which I figured out how to use to at least get the includes working. However, I'm still having linker trouble.

I used /u1/public/gcc as the prefix (different folder from the source distribution, note). Then I did
alias g++0x="/u1/public/gcc/bin/g++ -std=c++0x". But that caused:

/usr/bin/ld: cannot find -lgcc_s

So then I changed the alias to include "-L/u1/public/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/ -L/u1/public/gcc/lib/gcc/x86_64-unknown-linux-gnu/lib/", which are the only places files named libgcc_s live (.a in the first case, .so in the second).

However, now I'm getting
/usr/bin/ld: skipping incompatible /u1/public/gcc/lib/gcc/x86_64-unknown-linux-gnu/lib//libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s

Incompatible with what is my question.....I'm not linking against any other libraries explicitly. (I will, but one thing at a time.)

S_M_A
May 26th, 2010, 11:57 AM
I get a hit when grep:ing for all standard paths (/usr/bin /usr/include /usr/lib) in the g++-4.4 binary. Since you still get the output /usr/bin/ld there has to be more paths to override in the configuration script. By the way, Have you searched the resulting configuration file and/or the code?