您的位置:首页 > 运维架构 > Linux

在centos上安装gcc 4.8

2015-03-13 10:37 477 查看
cetos太不友好了,居然不能直接yum安装gcc4.8,用make安装又出现了诸多问题,也不知道是因为我装了clang的原因还是怎么样,还好找到了这个方法,大赞!!

solution reference: http://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos
# cd /etc/yum.repos.d

# wget http://people.centos.org/tru/devtools-2/devtools-2.repo
# yum --enablerepo=testing-devtools-2-centos-6 install devtoolset-2-gcc devtoolset-2-gcc-c++

This will install it most likely into /opt/rh/devtoolset-2/root/usr/bin/

Then :
# cd /usr/bin
# ln -s /opt/rh/devtoolset-2/root/usr/bin/gcc gcc
# ln -s /opt/rh/devtoolset-2/root/usr/bin/g++ g++
# ln -s /opt/rh/devtoolset-2/root/usr/bin/cc cc
# ln -s /opt/rh/devtoolset-2/root/usr/bin/cpp cpp

Now get the gcc version
# gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.

Tips:
don't forget to yum clean all before doing the steps again after failure else you will still get  404
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息