开发者

How can I install a new version of gcc on ubuntu

开发者 https://www.devze.com 2022-12-28 12:37 出处:网络
I am using ubuntu 9.10 and it comes with gcc 4.4. How can I install gcc 4.5 without screwing up my gcc 4.4. environment. I just need gcc 4.5 to compile 1 application.

I am using ubuntu 9.10 and it comes with gcc 4.4. How can I install gcc 4.5 without screwing up my gcc 4.4. environment. I just need gcc 4.5 to compile 1 application.

Thank you.开发者_如何学Python


My preferred method is to have a deb-src entry in /etc/apt/sources.list as e.g.

# Debian sources
deb-src http://ftp.us.debian.org/debian/ unstable main contrib non-free

I can then do apt-get source foo and fetch the appropriate package with its sources which will be unpackages. I typically add a local changelog entry (set apart by a revision number as 1.2-3local0) and rebuild. This sometimes entails building dependencies. It all depends...

I guess gcc-4.5 is currently in experimental as per this page so you would have to add experimental to the sources.list file as well. I have not used this but it should work too:

deb-src http://ftp.debian.org/debian experimental main


The easiest way is to install into a private prefix:

configure --prefix=/some/private/prefix   ...

In a private prefix, there is 0 chance you'll overwrite an existing file. You'll then need to add the prefix to your path.

A second option is to give the new binaries a suffix and to use version specific runtime libraries:

configure --program-suffix=-4.5.0 --enable-version-specific-runtime-libs

although I can't promise some other file won't be modified.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号