LinuxSir.cn,穿越时空的Linuxsir!

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

如何升级gcc [HOWTO升级gcc--英文版]

[复制链接]
发表于 2006-2-20 15:23:34 | 显示全部楼层 |阅读模式
想升级gcc,但搜索功能关闭,发贴问问.
emerge -s gcc显示是3.4版本,想升级到4版本,ACCEPT_KEYWORKDS=~x86都是3.4版本,是否gentoo不让安装gcc4?设置ACCEPT_KEYWORKDS="-*",可以列出有4.0.2和4.1版本,是mask,老大们说说如何升级?
发表于 2006-2-20 16:05:09 | 显示全部楼层
$ emerge -pv =gcc-4.1.0_beta20060203
看输出,然后在/etc/portage/package.keywords里逐个加入要求的包。
回复 支持 反对

使用道具 举报

发表于 2006-2-21 10:33:31 | 显示全部楼层
升级工具链的问题,GNU整个的工具链包括gcc, binutils和glibc
所以你需要升级gcc和glibc,目前binutils不用升级到-*级别的。
具体的方法见gentoo wiki

http://gentoo-wiki.com/HOWTO_Upgrade_to_gcc4

snapshot版的gcc最新版本是 =gcc-4.1.0_pre20060219 昨天发布的
回复 支持 反对

使用道具 举报

发表于 2006-2-21 10:39:43 | 显示全部楼层
HOWTO gcc4

Reasoning
GCC is a key development tool, and on a distribution such as gentoo, which compiles everything natively, a key part of user's systems. For this reason, gcc-4, while reaching the esteemed status of "default compiler" on many other distributions, is still left behind on gentoo. This is about to change.

Thanks to the work of multiple gentoo developers, along with the recent release of glibc 2.3.6, gcc4 is just about ready to be unmasked. This howto details the process of upgrading to it.

GCC4 is hoped to hit ~x86, ~amd64, and ~ppc within the next few weeks, so upgrading is going to become easier, for now we need to use a few hoops.

Preparation
Warning: You must be using an up to date ~ARCH system, gcc4 related fixes have not made it to stable  

First, if necessary, create the /etc/portage directory, where profile overrides can be placed.

  1. #mkdir /etc/portage
复制代码

Now, some nasty style hacks to get ebuilds no one wants you to use:

gcc-4.0.2:


  1. #echo "~sys-devel/gcc-4.0.2 -*" >> /etc/portage/package.keywords
复制代码

glibc-2.3.6:

  1. #echo "~sys-libs/glibc-2.3.6 -*" >> /etc/portage/package.keywords
复制代码

Warning: If you were using a snapshot of glibc, see gentoo bug 112082  


Alrighty, now we are ready for the real fun..

#emerge binutils glibc gcc -av
Make sure the correct versions are showing.. Now take a nap. When you awake, set your gcc-config profile

  1. #gcc-config -l
复制代码

find the right one

#gcc-config blah
eg:

  1. #gcc-config i686-pc-linux-gnu-4.1.0_pre20060219
复制代码

Huzzah! now lets rebuild the rest of the system!

  1. #emerge -e system && emerge -e world
复制代码

Good luck, and happy compiling!

Note that emerging the entire system can take days. Remember emerge --resume will pick up where it left off if you need to fix something.

[Update: 01 Jan 2006 gerdesj@blueloop.net] Packages still not ~x86 so above still necessary. Will report back status when system rebuilt (there are over 800 packages on this laptop).

[Update: 11 Jan 2006 gerdesj@blueloop.net] Took me around 3 days (and several emerge --resume --skipfirst) to rebuild system. Still fixing some broken packages. If you are not familiar with revdep-rebuild and fixing things then don't do this. Overall my system is running fine (KDE 3.5 and OO 2 are OK apart from anything else). As per next comment, broken things are mainly media stuff, so if that is really important to you then I suggest you wait.

[Comment (sschober@web.de): 08 Jan 2006] I just finished updating my system according to this howto. It took me nearly 3 days to compile my >850 packages with GCC-4.02. Now the system is running stable again.

After the firts shot, a couple of packages were broken. Most of them were media based packages. After some research in the forums, I could fix most of the errors and merge those packages to my system. At last only 3 packages remained, which could only be merged by falling back to GCC-3.4.5. These packages are:

media-video/qdvdauthor-0.0.10
media-tv/nuppelvideo-0.52a
net-mail/cyrus-imap-admin-2.2.12
All of the rest compiled with GCC-4. I consider this as success.

Retrieved from "http://gentoo-wiki.com/HOWTO_gcc4"
回复 支持 反对

使用道具 举报

发表于 2006-2-21 12:00:49 | 显示全部楼层
Nankai的HOWTO不错哦, 值得加精~
回复 支持 反对

使用道具 举报

发表于 2006-2-21 13:53:05 | 显示全部楼层
Post by 小劲鸭
Nankai的HOWTO不错哦, 值得加精~

Wiki里拷过来的东西也加精!?:!!
人家zhllg辛苦写出来的ebuild却不加精!:beat
回复 支持 反对

使用道具 举报

发表于 2006-2-21 13:59:22 | 显示全部楼层
Post by torres
Wiki里拷过来的东西也加精!?:!!
人家zhllg辛苦写出来的ebuild却不加精!:beat

就是:beat
回复 支持 反对

使用道具 举报

发表于 2006-2-21 14:00:40 | 显示全部楼层
Post by torres
Wiki里拷过来的东西也加精!?:!!
人家zhllg辛苦写出来的ebuild却不加精!:beat

TORRES说得正确, 我疏忽了...马上改正
回复 支持 反对

使用道具 举报

发表于 2006-2-21 14:09:38 | 显示全部楼层
TORRES, 能给我这贴得链接吗? 还没拜读过呢...谢谢
回复 支持 反对

使用道具 举报

发表于 2006-2-21 14:22:17 | 显示全部楼层
Post by 小劲鸭
TORRES, 能给我这贴得链接吗? 还没拜读过呢...谢谢

http://www.linuxsir.cn/bbs/showthread.php?t=243175
回复 支持 反对

使用道具 举报

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

本版积分规则

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