Search:  
Gentoo Wiki

TIP_GCC_4.0_Testing_Tips

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other
GCC
GNU C Compiler
Developer: the GNU foundation
Package: sys-devel/GCC
Category: sys-devel
License: GPL-2
Website: http://gcc.gnu.org/

Contents

Statement of Intent

Statement of Intent: Even though GCC 4.0 is still being tested, there has not been a diminished interest for some to fool around with it. Perhaps these individuals will write their own bug reports or patches to help speed up the migration process once it comes. In any case, the problem is that there is not very much good or consolidated information available online; and if it does exist, it is very disjointed not well maintained. These things have prompted the creation of this article.

Forewarning

Having the aforementioned state of GCC 4.0 testing in mind, one must know there are several risks to using GCC 4.0. Someone else who is more qualified or who has had direct experience with some incident would be the most qualified to write this section.

Setup

As of february 08, 2006, Portage no longer provides gcc 4.0.1 and 4.0.0. To begin testing with GCC 4.0.2, you will need the following:

Unmask required packages:

File: /etc/portage/package.keywords
 ~sys-libs/timezone-data-2006a ~amd64
 ~sys-libs/glibc-2.3.6-r2 ~amd64
 ~dev-libs/gmp-4.1.4-r3 ~amd64
 ~dev-libs/mpfr-2.2.0_p8 ~amd64
 ~sys-devel/gcc-4.0.2 -*
 

You should be able to do it in a few simple steps:

Archs on which this procedure worked:

Additional Packages

Note: This subsection was written at the time of GCC 4.0.0. Some info may be outdated.
If you are adventurous enough to try a stage1 Gentoo install you can bump into several packages which need newer versions, otherwise your emerge system installation step will fail. You will need at least the following package versions (or newer ones):
[libstdc++-v3 was introduced as a way to ease the transition from GCC 3.3 to 3.4 which had incompatible c++ libs. it shouldn't be needed at all for GCC 4.0, which include again a different C++ library. there must be a reason it's listed here though, so i'll leave it as is.]
[The comment about libstdc++-v3 is incorrect: there was an ABI transition between gcc 3.3 c++ library and gcc 3.4, so we had to rely on libstdc++-v3; the ABI will remain compatible for transition from 3.4 series to 4.0 series, so no real issue here; alas, the compatibility needs remain]

Building the toolchain

 sys-libs/glibc nomalloccheck nptl nptlonly pic userlocales
I'm assuming you have /etc/locales.build set up. You can omit nptlonly if you like, which will cause glibc to be compiled with support for linuxthreads. This takes twice as long to build, but gives you a fallback in case you run into an odd package that doesn't work with NPTL (i don't know of any).
 sys-devel/binutils multislot
This causes any upgrade of binutils to be installed in a SLOT, rather than replacing a previously installed version. This comes in handy because you can then use binutils-config to switch between any number of binutils versions when trying to nail down a bug.
 sys-devel/gcc multislot
Same deal as above. You don't really need it since 4.0 will get installed into it's own slot anyways, but it doesn't hurt. You can also add the fortran flag for F95 support, gcj to build the java compiler, or objc for objective c.

Have fun. ;)

Known Problems

http://article.gmane.org/gmane.comp.gcc.devel/66099
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20743
http://gcc.gnu.org/ml/gcc/2005-06/msg00159.html

Also see GCC Wiki - Regressions

External Resources

Retrieved from "http://www.gentoo-wiki.info/TIP_GCC_4.0_Testing_Tips"

Last modified: Fri, 05 Sep 2008 10:21:00 +0000 Hits: 24,732