Upgrading GCC/es

Este documento guía al usuario a través del proceso de actualizar GCC.

Introducción
Este documento trata de actualizar GCC. Cambiar a una versión más antigua de GCC podría provocar efectos laterales no deseados. Por favor, eche un vistazo a la sección de resolución de problemas para informarse de algunos problemas de los que se informa frecuentemente.

La siguiente sección ofrece una introducción rápida a las actualizaciones de GCC (y lo fáciles que son). Si desea leer el razonamiento completo detrás de las actualizaciones del GCC, por favor, continue con explicación de actualizaciones de GCC.

Versión corta
Si está actualizando GCC entonces no necesita hacer nada salvo cambiar la versión del compilador y reconstruir libtool:

Si actualiza GCC desde una versión anterior a la 3.4.0 (para las series 3.x) o la 4.1, necesitará tambiér lanzar :

Compruebe la versión actual y desinstale la versión antigua

Ya lo tiene. ¡Disfrute del nuevo compilador!

Introducción
Las actualizaciones de GCC siempre han sido rodeadas de un aura de misterio, con sugerencias que van desde "No hace falta hacer nada" hasta "Tendrá que reconstruir el sistema completo, dos veces". La mayoría de estas medias informaciones (FUD) vienen de la confusión que rodea las incompatibilidades del ABI. Antes, unas palabras sobre.

libtool y fix_libtool_files.sh
Earlier installments of GCC on Gentoo required you to run a specific command called. Some time ago, the execution of this command has been integrated in the package deployments itself (through the toolchain eclass) so there is no need for users to call this themselves anymore.

The reason we need to rebuild libtool after the upgrade of gcc versions is because of its main purpose: libtool is a toolset that aggregates platform-specific code in a generic interface, allowing applications to build against shared libraries without needing to deal with the platform specific aspects of shared libraries. To fulfill its function properly, the  script uses various library locations that have hardcoded GCC version information in them.

Cambios en ABI
An ABI, or Application Binary Interface, is a set of conventions used by all tools that deal with binary representation of programs, including compilers, assemblers, linkers and language runtime support (source: GCC Binary Compatibility). When the ABI used for binary applications and libraries is changed, you will risk getting linker errors or malfunctioning programs unless you rebuild all libraries that use C++ code. Yes, C++, since most incompatibilities occur within the C++ ABI. This is also why we use the  command against the  library.

So why is this only needed up to GCC 3.4.0/4.1? That's because from that version onwards, GCC uses a forward compatible ABI, which removes the need for rebuilding applications and libraries. Of course, guarantees can never be given indefinitely, but when an incompatibility occurs again, we'll definitely document it here. In that case, the version of the library will probably be increased.

Reconstruir todo
Some people swear that they need to rebuild every single package on their system when a new GCC version is made available. Of course, that doesn't make sense, since there are many applications that are not using GCC for their build and install process anyhow, so they would never be affected by such changes.

That however doesn't mean they are completely incorrect: newer GCC versions often include better support for the processors' instruction set, which might influence the performance of some applications in a positive way. Although it is expected that this improvement is generally only marginally, in some cases (especially CPU intensive applications) this might yield notable improvements.

There are also known cases where packages need to be built with the same compiler. Although these packages are usually bumped by Gentoo simultaneously (so that they are always built with the same GCC version) cherry-picking reinstalls on these packages might prove to be troublesome. The various packages are a nice example on this matter.

libstdc++.so.6: version `GLIBCXX_3.4.15' not found
Durante las actualizaciones puede que obtenga un error como el siguiente:

No se encuentra GLIBCXX_x.y.z

This means that you are trying to build a package with an older GCC version than with which some depending libraries were built. Remember when we told that the C++ ABI if forward-compatible? That is true, but it ensures only that higher (or same) GCC versions can be used when building applications and linking libraries (compared to the GCC version used to build those libraries).

¿Qué paquetes se sabe que deben reconstruirse?
The following table gives the packages that, if installed, need to be rebuild and why.

Guías Gentoo y Recursos

 * Actualización de GCC hasta la versión 4.1, la versión anterior de este documento