43

We have a new application that requires glibc 2.4 (from gcc 4.1). The machine we have runs on has gcc 3.4.6. We can not upgrade, and the application must be run on this machine.

We installed gcc 4.1, however, when it comes to compile time it is using all the includes, etc, from 3.4.6.

How do we get around this?

Any suggestions on using 4.1 for just this application?

5 Answers 5

30

Refer "How to install multiple versions of GCC" here in the GNU GCC FAQ.

There's also a white paper here.

Sign up to request clarification or add additional context in comments.

Comments

4

for Ubuntu it's pretty easy

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update

and then install for example gcc version 6

sudo apt-get install gcc-6

Comments

3

Have you tried gcc-select? Otherwise, try setting the INCLUDE_PATH and LIBRARY_PATH in your shell.

3 Comments

can't find it anymore, any idea if this package still exist or has changed name?
That sounds like something distribution specific. Reminds me of Gentoo or Debian but I am not sure.
@dave I've never used Gentoo, this definitely exists on other systems as well. Might have been Debian, I can't remember.
3

update-alternatives is a very good way to have multiple gcc versions:

http://ubuntuguide.net/how-to-install-and-setup-gcc-4-1g4-1-in-ubuntu-10-0410-10

Comments

2

You possibly still execute the old gcc. Try making a symlink from gcc to your version of it, like

ln -s gcc-4.1 gcc

Beware of not removing an old "gcc" binary placed there, in case they placed not just a symlink. If you can recompile your own gcc version, the safest is just use another prefix at configure time of gcc, something like --prefix=/home/jojo/usr/gcc (i did it that way with gcc-4.4 from svn-trunk, and it worked great).

Note that that just runs the right gcc version. If you update your gcc, your glibc won't be updated automatically too. It's a separate package which is deeply coupled with the rest of the system. Be careful when installing another glibc version.

1 Comment

You can view the output of ls -l to see if the gcc in a directory is a file or a symlink.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.