search
LoginSignup
29

More than 5 years have passed since last update.

posted at

updated at

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 --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.
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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
29