Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, I am trying to install gcc from source, but wish to install to an alternative location, ie /opt/gcc/4.4.4. I have done so but ran into the problem that the ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    5

    Installing GCC from source - RHEL 4u7

    Hello,

    I am trying to install gcc from source, but wish to install to an alternative location, ie /opt/gcc/4.4.4.

    I have done so but ran into the problem that the system libs in /usr/lib64 were being located before my libs in /opt/gcc/4.4.4/lib64.

    So, I set --libdir=/usr/lib and reinstalled. The libs link in correctly, but now g++ cant find includes, for instance <complex>. I think I could set CPATH to point to the locations of these includes but that doesn't seem like it should be necessary.


    So my question is, what is the correct way to install gcc alongside the system versions while allowing linkage to the right libs and location of the includes? I don't want to use prefixes or suffixes because the intel compiler looks at gcc -v to get clues as to how to compile stuff.

    It should be noted that I have no internet connectivity on this machine, so building from source is my only option.

    TIA!

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    RHEL 4u7 is quite dated. RHEL 5.x has been out for 3 years or so. As you know, you can install multiple GCC versions, however there are times when you have to install to an alternative location from the defaults. I had to do that in order to install 4.5.1 (latest and "greatest") on my RHEL/CentOS 5.5 system recently. However, you should be able to install from an RPM file and not from source - that would be preferable. You can use YUM or RPM to install that way, though on your system to install 4.4 you may need some depencencies that are incompatible with your basic OS without doing the alternative installation location thing. In my case, with 4.5.1 I installed into /usr/local instead. That worked ok. So, now I have 2.95, 3.4.6, 4.1.2, 4.4.0, and 4.5.1 installed on my system at the same time. All but 4.5.1 are installed in /usr/bin, and that and its dependencies that conflict with standard system libraries are installed in /usr/local/...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    5
    The version of redhat that I am using is of no significance... I'm referring to gcc 4.4.4/ld and wondering if it is possible to prepend to RPATH in my output shared libs.

    I would install to /usr/local but I don't want others to use this version of gcc by defualt, and I cant modify the executable name with a pre- or suffix since the intel compilers look to "gcc" for tips on how to compile.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Well, you can install it anywhere (using the --prefix=path configure option before building/installing) so you can test it out before deploying it. I don't know about using RPATH as you mention, but it may be worth a try as an alternative.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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