步步惊心 centOS 6.5 yum升级 gcc4.8 然后又退回来4.4

CentOS 6.5 用了很多年了,一直舍不得省7 。

由于要用到 c++ 11 ,所以决定升级一下。

为了省事我选择用 yum 方式升级,结果最后还是不能用,差点搞坏,这是真机,重装麻烦了。

get http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo

yum install devtoolset-2-gcc-4.8.2 devtoolset-2-gcc-c++-4.8.2

查看 gcc 版本
/opt/rh/devtoolset-2/root/usr/bin/gcc --version
yum install devtoolset-2-gcc-gfortran
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
gcc --version

gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

看样子,挺好哈,一切正常。

结果使用的时候

/opt/rh/devtoolset-2/root/usr/libexec/gcc/i686-redhat-linux/4.8.2/ld: lxdialog/checklist.o: undefined reference to symbol 'acs_map'
/opt/rh/devtoolset-2/root/usr/libexec/gcc/i686-redhat-linux/4.8.2/ld: note: 'acs_map' is defined in DSO /lib/libtinfo.so.5 so try adding it to the linker command line
/lib/libtinfo.so.5: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

ln -s /usr/lib/libtinfo.so.5 make

看来还要手工编译安装比较靠谱

就要先把这个给删除掉。

yum remove devtoolset*

然后,手动删除 /usr/local/bin/ 下面的软链

然后我想,把 gcc remove  在 install 应该就回来了,结果老是提示 gcc 找不到。

最后我看上面有一句 hash -r

就重新执行了一下, gcc 4.4 终于回来了。

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)

Copyright © 2010 Free Software Foundation, Inc.

 

源码编译比较简单吧,就是慢点。 

猜你喜欢

转载自www.cnblogs.com/ningci/p/9347623.html
今日推荐