LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 808|回复: 5

GCC 3.4 marked stable on x86

[复制链接]
发表于 2005-12-3 13:43:23 | 显示全部楼层 |阅读模式
GCC 3.4 marked stable on x86
Posted on December 2, 2005 by Mark Loeser
gentoo

GCC 3.4 has finally been marked stable on x86. No one will have their compiler automatically switched to gcc-3.4 after it is installed, so you can handle the migration to using it as your system compiler when you have time. To assist you in the migration we have made a GCC migration guide.

For support issues, #gentoo is the place to receive help. Bugs found in the course of this upgrade should be filed under the "Gentoo Linux" product, and "GCC Porting" component on Gentoo's Bugzilla.
Gentoo Linux GCC Upgrade Guide
Content:

1. Introduction

This guide will document the upgrade from GCC 3.3 to GCC 3.4, but the concepts here apply to any GCC upgrade.

Installing gcc 3.4.4 does not have any influence on the system itself. You have to switch over to it manually. This step may take some time, so be sure that you have time available and are prepared for the job. There are two methods of performing this upgrade. The first method is quick, but could potentially miss a package or two that needs updating, where the second method is much more involved and requires substantially more compiling.

Note: Before proceding with either method, please disable distcc if you have it enabled. If all distcc nodes do not have gcc-3.4 installed, you will run into build issues.

2. Using revdep-rebuild (Faster method)

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.

Code Listing 2.1: Installing gentoolkit and upgrading GCC

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

Note: This assumes that you have CHOST="i686-pc-linux-gnu" set. If you are using another CHOST, please use the appropriate gcc-config line.

Warning: Do not set any GCC 3.4-specific CFLAGS such as -march=pentium-m at this time. Doing so could cause failures in your compiles. You can set these flags after you remove gcc-3.3, which will not recognize them.

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.

Code Listing 2.2: Using revdep-rebuild

# revdep-rebuild --library libstdc++.so.5 -- -pv
# 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 -X option to revdep-rebuild. This causes packages to be recompiled based on the package name, rather than the exact name and version.

Code Listing 2.3: Using revdep-rebuild with -X

# revdep-rebuild -X --library libstdc++.so.5 -- -pv
# revdep-rebuild -X --library libstdc++.so.5
                       

To provide compatibility with 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.

Code Listing 2.4: Installing libstdc++-v3 and cleaning up

# emerge -1 sys-libs/libstdc++-v3
# emerge -aC =sys-devel/gcc-3.3*
                       

3. Using emerge -e (Safer method)

This method, while much slower, performs recompiles of your entire system to ensure that everything has been rebuilt with your new compiler. First, you upgrade GCC and switch to your new compiler.

Code Listing 3.1: Upgrading GCC

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

Note: This assumes that you have CHOST="i686-pc-linux-gnu" set. If you are using another CHOST, please use the appropriate gcc-config line.

Warning: Do not set any GCC 3.4-specific CFLAGS such as -march=pentium-m at this time. Doing so could cause failures in your compiles. You can set these flags after you remove gcc-3.3, which will not recognize them.

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.

Code Listing 3.2: Rebuilding system and world

# emerge -e system
# emerge -e world
                       

To provide compatibility with binary C++ applications, sys-libs/libstdc++-v3 needs to be merged onto your system. It will also be safe to remove older GCC versions at this time.

Code Listing 3.3: Installing libstdc++-v3 and cleaning up

# emerge -1 sys-libs/libstdc++-v3
# emerge -aC =sys-devel/gcc-3.3*
                       

4. Hints and problems

    * Once kernel modules (e.g. app-emulation/qemu-softmmu) are rebuilt with GCC 3.4, they will not work with your old kernel anymore. Recompiling the kernel with 3.4 solves the problem.
    * If revdep-rebuild seems to want to rebuild packages even after they have already been rebuilt, just continue. The packages should still work afterwards.
    * 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 see the error: libtool: link: ` /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.la' is not a valid libtool archive, then run /sbin/fix_libtool_files.sh 3.3.6
    * If /sbin/fix_libtool_files.sh was removed when unmerging GCC 3.3, you need to remerge GCC. This is likely to happen if you emerge -e system and GCC 3.3 gets compiled after GCC 3.4. If you do not want to merge GCC again, try restoring /lib/rcscripts/awk/fixlafiles.awk and /sbin/fix_libtool_files.sh from /usr/portage/sys-devel/gcc/files and /usr/portage/sys-devel/gcc/files/awk. This will mean that these files will not be known to portage and your next merge could fail when using FEATURES=collision-protect.
    * 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.

Discussion for this is at the forums.
发表于 2005-12-3 14:43:14 | 显示全部楼层
应该的。
连freebsd6都已经用gcc3.4,可见足够stable了
回复 支持 反对

使用道具 举报

发表于 2005-12-3 15:53:25 | 显示全部楼层
不喜欢升级gcc。。非常不喜欢

准备把3.4mask了,等4.1之后腾出点时间一次搞定算了
回复 支持 反对

使用道具 举报

发表于 2005-12-3 16:30:53 | 显示全部楼层
什么时候gcc4能stable.
回复 支持 反对

使用道具 举报

发表于 2005-12-3 16:45:04 | 显示全部楼层
我也不喜欢升级gcc和glibc,稳定就可以。
回复 支持 反对

使用道具 举报

发表于 2005-12-3 23:51:51 | 显示全部楼层
我喜欢了,终于等到了,因为我是在本本上装的gentoo,如果不能用pentium-m,感觉极度不爽!以前一直用jackass方法安装,现在可以直接emerge了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表