GCC Upgrade
From M L Vision Network Services Wiki
These are the steps needed to upgrade GCC.
1. Re-merge GCC (Estimated time 1 hour)
It is worthwhile to re-merge the GCC compiler to make sure it is the latest version as well as use the most current USE settings.
emerge -1 gcc
2. Backup system (Estimated time 1 hour)
It is important to backup the system before doing this process due to the fact that every single package will be recompiled.
3. Emerge GCC compatibility library
To keep existing applications working while the upgrade is in progress it is necessary to install a backward compability library. This will also allow custom applications not managed by portage but have been compiled with an older copy of GCC to continue working.
emerge libstdc++-v3
4. Change system configuration
At this point any changes that you wish to make to the new environment should be changed. This might include entries in /etc/make.conf such as CFLAGS or CXXFLAGS.
CFLAGS=”-mtune=athlon-xp -O3 -pipe”
CXXFLAGS=”${CFLAGS}”
You will also want to switch the GCC compiler.
gcc-config i686-pc-linux-gnu-4.1.1 env-update && source /etc/profile
5. Find references to original GCC compiler
fix_libtool_files.sh 3.3.6
6. Re-merge libtool
With the new configuration libtool needs to be the first package recompiled.
emerge -1 libtool
7. Cleanup Portage configuration
Any changes to the portage configuration files should be done now. If you have masked entries in /etc/portage.mask that were dependent on newer copies of GCC, now is the time to remove them from the mask file.
nano -w /etc/portage/package.mask
8. Recompile World
Before world can be recompiled it is necessary to recompile system. Once system is compiled, world can be then done (which actually recompiles system a 2nd time but this time using the newer environment).
emerge -e system (Estimated time 5 hours) emerge -e world (Estimated time 10 hours)
9. Fix configuration files
It would seem that just recompiling the same environment would keep all configuration files the same, there will be minor differences that will need to be updated.
etc-update
10. Rebuild kernel
Once all packages are recompiled it is also necessary to provide a matching kernel.
genkernel all (See guide on how to compile the kernel for more details)
This is a good time to reboot the system and confirm everything is working correctly.
11. Recompile custom applications
Any application not managed by portage also needs to be recompiled. These can often be found in /usr/local/src.
12. Remove old GCC compiler
Once all applications have been migrated to the new compiler there is no need to keep the old copy of GCC as well as the compatibility library. They can be removed.
emerge unmerge gcc-3.3.6 emerge unmerge libstdc++-v3