CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Trouble installing gcc 4.5

    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?

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Trouble installing gcc 4.5

    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?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Trouble installing gcc 4.5

    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.)
    Last edited by Lindley; May 25th, 2010 at 05:48 PM.

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Trouble installing gcc 4.5

    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?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured