From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.54) id 1EkRKq-0002Zo-Tf for garchives@archives.gentoo.org; Thu, 08 Dec 2005 19:21:45 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id jB8JLadF009258; Thu, 8 Dec 2005 19:21:36 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id jB8JLYID010482 for ; Thu, 8 Dec 2005 19:21:35 GMT Message-Id: <200512081921.jB8JLYID010482@robin.gentoo.org> Received: from lark.gentoo.osuosl.org ([140.211.166.177] helo=lark.gentoo.org) by smtp.gentoo.org with smtp (Exim 4.54) id 1EkRKb-000240-Bu for gentoo-doc-cvs@lists.gentoo.org; Thu, 08 Dec 2005 19:21:29 +0000 Received: by lark.gentoo.org (sSMTP sendmail emulation); Thu, 8 Dec 2005 19:21:13 +0000 From: "Jan Kundrat" Date: Thu, 8 Dec 2005 19:21:13 +0000 To: gentoo-doc-cvs@lists.gentoo.org Subject: [gentoo-doc-cvs] cvs commit: gcc-upgrading.xml Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-doc-cvs@gentoo.org Reply-to: docs-team@lists.gentoo.org X-Archives-Salt: 3f19c677-452a-4fa8-a17e-66d6e6ee967d X-Archives-Hash: 8286b564e2d81e9f25709b2a38a734a9 jkt 05/12/08 19:21:13 Added: xml/htdocs/doc/en gcc-upgrading.xml Log: New generic GCC upgrading guide, replacement of gentoo/xml/htdocs/proj/en/base/x86/gcc-upgrading-guide.xml Revision Changes Path 1.1 xml/htdocs/doc/en/gcc-upgrading.xml file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/gcc-upgrading.xml?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=gentoo plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/gcc-upgrading.xml?rev=1.1&content-type=text/plain&cvsroot=gentoo Index: gcc-upgrading.xml =================================================================== Gentoo Linux GCC Upgrade Guide Wernfried Haas Jan Kundrát Mark Loeser Chris Gianelloni This document will guide the user through the process of upgrading GCC on their Gentoo Linux machines. 1 2005-12-08 Introduction
GCC Upgrading

Why should you upgrade? Well, GCC is quite similar to any other package on your system, just a bit more critical. You should upgrade GCC whenever a new version fixes some bug that annoys you, new functionality you need is introduced, or if you want to keep your system up-to-date. If none of the previous cases apply to you, you can safely postpone upgrade as long as your GCC version is supported by Gentoo developers.

If you install a newer version of GCC, the system will not switch over to use it automatically. You'll have to explicitly request the change because the migration process might require some additional steps. If you decide not to switch, Portage will continue to use older version of your compiler until you change your mind, or remove the old compiler from the system.

This guide will document the necessary steps required to perform a seamless upgrade of the compiler used by your Gentoo box. A specific section is dedicated to the upgrade from GCC 3.3 to the 3.4 version and issues with libstdc++.

General Upgrade Instructions
Introduction If you're looking for instructions specific to upgrades from GCC-3.3 to GCC-3.4, please consult the dedicated section.

Generally speaking, upgrades to bug fix releases, like from 3.3.5 to 3.3.6, should be quite safe -- just emerge new version, switch your system to use it and rebuild the only affected package, libtool. However, some GCC upgrades break binary compatibility; in such cases a rebuild of the affected packages (or even whole toolchain and system) might be required.

When we spoke about the need to switch your compiler to the newer version by hand, we said it won't happen automatically. However, there is one exception -- upgrades to bug fix releases, like from 3.3.5 to 3.3.6 in case you don't use the "multislot" feature allowing them to coexist on one system. Multislot is disabled by default as the majority of users won't benefit from it.

# emerge -uav gcc

(Please substitute "i686-pc-linux-gnu-3.4.4" with the GCC
version and CHOST settings you've upgraded to:)
# gcc-config i686-pc-linux-gnu-3.4.4
# source /etc/profile

(Rebuilding libtool)
# emerge --oneshot -av libtool

Now let's rebuild toolchain and then world so we will make use of the new compiler.

# emerge -eav system
# emerge -eav world

It is safe to remove older GCC version at this time. If you feel the need, please issue the following command (as usual, substitute =sys-devel/gcc-3.3* with the version you want to uninstall):

# emerge -aC =sys-devel/gcc-3.3*
Upgrading from GCC-3.3 to 3.4
Introduction

The upgrade from GCC/3.3 to 3.4 is not so seamless as the C++ ABI changed between these two versions so there is an issue with libstdc++ library which must be taken care of as well.

The Choices

You have two possibilities on how to upgrade your system. First method is faster and requires use of revdep-rebuild tool from package gentoolkit while the second one rebuilds the entire system from scratch so it will make use of new GCC features. It's up to you to decide which of these two ways you will choose.

Using revdep-rebuild

This method requires that you first install gentoolkit if you have not already done so. Then we will upgrade GCC and switch to the new compiler. We will also rebuild the libtool package to ensurethat toolchain is in healthy state.

# emerge -an gentoolkit
# emerge -uav gcc
# gcc-config i686-pc-linux-gnu-3.4.4
# source /etc/profile

(Rebuilding libtool)
# emerge --oneshot -av libtool
This assumes that you have CHOST="i686-pc-linux-gnu" set. If you are using another CHOST, please use the appropriate gcc-config line.

Now, we want to see which packages that revdep-rebuild will want to rebuild. Then we will tell revdep-rebuild to actually rebuild the packages. This may take some time, so have some patience.

# revdep-rebuild --library libstdc++.so.5 -- -p -v
# revdep-rebuild --library libstdc++.so.5
It is possible that you might have problems with non-existing package versions due to them being outdated or masked. If this is the case, you will want to use the --package-names option to revdep-rebuild. This causes packages to be recompiled based on the package name, rather than the exact name and version.

To provide compatibility with older binary C++ applications and any packages that revdep-rebuild might have missed, sys-libs/libstdc++-v3 needs to be merged before you unmerge GCC 3.3 from your system.

# emerge --oneshot sys-libs/libstdc++-v3
# emerge -aC =sys-devel/gcc-3.3*
Using emerge -e

This method, while much slower, will rebuild your whole system to ensure that everything has been rebuilt with your new compiler, and therefore safer. At first, you will upgrade GCC and libtool and switch to your new compiler.

# emerge -uav gcc
# gcc-config i686-pc-linux-gnu-3.4.4
# source /etc/profile

(Rebuilding libtool)
# emerge --oneshot -av libtool
This assumes that you have CHOST="i686-pc-linux-gnu" set. If you are using another CHOST, please use the appropriate gcc-config line.

To provide compatibility with older binary C++ applications, sys-libs/libstdc++-v3 needs to be merged onto your system.

# emerge --oneshot sys-libs/libstdc++-v3

Now we will go about first rebuilding the system target, then the world target. This will take a very long time, depending on the number of packages that you have installed, as it will rebuild your entire toolchain and supporting system files, followed by every package on your system, including the toolchain. This is necessary to ensure that all packages have been compiled with the new toolchain, including the toolchain itself.

# emerge -e system
# emerge -e world

It is also safe to remove older GCC versions at this time:

# emerge -aC =sys-devel/gcc-3.3*
Common Pittfalls

It's important to disable distcc during upgrade. Mixing compiler versions on your nodes will cause build issues. This is not required for ccache, as the cache objects will be invalidated anyway.

Always use same GCC version for your kernel and additional kernel modules. Once you rebuild your world with new GCC, external modules (like app-emulation/qemu-softmmu) will fail to load. Please rebuild your kernel with new GCC to fix that.

Frequent Error Messages

If your system complains about something like libtool: link: `/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.la' is not a valid libtool archive, please run /sbin/fix_libtool_files.sh 3.3.6 (substitute "3.3.6" with the version numbers from the error message).

If you see the error: /usr/bin/gcc-config: line 632: /etc/env.d/gcc/i686-pc-linux-gnu-3.3.5: No such file or directory, then try deleting /etc/env.d/gcc/config-i686-pc-linux-gnu and running gcc-config again, followed by source /etc/profile. Only do this if you do not have any cross-compilers set up, though.

If a package fails during emerge -e system/world, you can resume operation with emerge --resume. If a package fails repeatedly, skip it with emerge --resume --skipfirst. Don't run any other instances of emerge in between or you will lose the resume information.

If you get an error message spec failure: unrecognized spec option while upgrading your compiler, try to switch back to your default compiler, unset the GCC_SPECS variable and upgrade GCC again:

# gcc-config 1
# source /etc/profile
# unset GCC_SPECS
# emerge -uav gcc
-- gentoo-doc-cvs@gentoo.org mailing list