Install g++/gcc 4.8.2 in CentOS 6.6

$ wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
$ yum install devtoolset-2-gcc devtoolset-2-binutils
$ yum install devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran

 

/opt/rh/devtoolset-2/root/usr/bin/ に入る

$ /opt/rh/devtoolset-2/root/usr/bin/gcc –versiongcc (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 NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
scl enable devtoolset-2 bash

を実行すると環境変数がセットされ、g++やると4.8.2となる。
shellを再起動するともとにもどるので、下記を~/.bashrcもしくは~/.bash_profilesに記載する

source /opt/rh/devtoolset-2/enable

ref:
http://unix.stackexchange.com/questions/175851/how-to-permanently-enable-scl-centos-6-4
http://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos

Comments

No comments yet. Why don’t you start the discussion?

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注