内容

gcc 4.4.7のインストール... 1

Devtoolset-2のリポジトリのインストール... 1

gcc 4.8.2のインストール... 1

Devtoolset-3リポジトリのインストール... 1

gcc4.9.2のインストール... 1

 

 

 

gcc 4.4.7のインストール

MATLAB R2016bCentos6にインストールします。

まずsuperuserになります。

[ns@localhost Desktop]$ su

Password:

gccversionをみてみます。

[root@localhost Desktop]# gcc -v

bash: gcc: command not found

gccをインストールします。

[root@localhost Desktop]# yum install gcc

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Determining fastest mirrors

 * base: ftp.tsukuba.wide.ad.jp

 * extras: ftp.tsukuba.wide.ad.jp

 * updates: ftp.tsukuba.wide.ad.jp

base                                                     | 3.7 kB     00:00    

extras                                                   | 3.4 kB     00:00    

updates                                                  | 3.4 kB     00:00     

updates/primary_db                                       | 4.3 MB     00:00    

Resolving Dependencies

--> Running transaction check

---> Package gcc.x86_64 0:4.4.7-17.el6 will be installed

--> Processing Dependency: cpp = 4.4.7-17.el6 for package: gcc-4.4.7-17.el6.x86_64

--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-17.el6.x86_64

--> Running transaction check

---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed

--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64

--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64

---> Package cpp.x86_64 0:4.4.7-17.el6 will be installed

--> Processing Dependency: libmpfr.so.1()(64bit) for package: cpp-4.4.7-17.el6.x86_64

--> Running transaction check

---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed

---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package            Arch            Version                 Repository     Size

================================================================================

Installing:

 gcc                x86_64          4.4.7-17.el6            base           10 M

Installing for dependencies:

 cloog-ppl          x86_64          0.15.7-1.2.el6          base           93 k

 cpp                x86_64          4.4.7-17.el6            base          3.7 M

 mpfr               x86_64          2.4.1-6.el6             base          157 k

 ppl                x86_64          0.10.2-11.el6           base          1.3 M

 

Transaction Summary

================================================================================

Install       5 Package(s)

 

Total download size: 15 M

Installed size: 33 M

Is this ok [y/N]: y

Downloading Packages:

(1/5): cloog-ppl-0.15.7-1.2.el6.x86_64.rpm               |  93 kB     00:00    

(2/5): cpp-4.4.7-17.el6.x86_64.rpm                       | 3.7 MB     00:00    

(3/5): gcc-4.4.7-17.el6.x86_64.rpm                       |  10 MB     00:01    

(4/5): mpfr-2.4.1-6.el6.x86_64.rpm                       | 157 kB     00:00    

(5/5): ppl-0.10.2-11.el6.x86_64.rpm                      | 1.3 MB     00:00    

--------------------------------------------------------------------------------

Total                                           5.9 MB/s |  15 MB     00:02    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : mpfr-2.4.1-6.el6.x86_64                                      1/5

  Installing : cpp-4.4.7-17.el6.x86_64                                      2/5

  Installing : ppl-0.10.2-11.el6.x86_64                                     3/5

  Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                              4/5

  Installing : gcc-4.4.7-17.el6.x86_64                                      5/5

  Verifying  : ppl-0.10.2-11.el6.x86_64                                     1/5

  Verifying  : gcc-4.4.7-17.el6.x86_64                                      2/5

  Verifying  : cpp-4.4.7-17.el6.x86_64                                      3/5

  Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                              4/5

  Verifying  : mpfr-2.4.1-6.el6.x86_64                                      5/5

 

Installed:

  gcc.x86_64 0:4.4.7-17.el6                                                    

 

Dependency Installed:

  cloog-ppl.x86_64 0:0.15.7-1.2.el6          cpp.x86_64 0:4.4.7-17.el6         

  mpfr.x86_64 0:2.4.1-6.el6                  ppl.x86_64 0:0.10.2-11.el6        

 

Complete!

 

gcc-c++(g++)をインストールします。

[root@localhost Desktop]# yum install gcc-c++

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: ftp.tsukuba.wide.ad.jp

 * extras: ftp.tsukuba.wide.ad.jp

 * updates: ftp.tsukuba.wide.ad.jp

Resolving Dependencies

--> Running transaction check

---> Package gcc-c++.x86_64 0:4.4.7-17.el6 will be installed

--> Processing Dependency: libstdc++-devel = 4.4.7-17.el6 for package: gcc-c++-4.4.7-17.el6.x86_64

--> Running transaction check

---> Package libstdc++-devel.x86_64 0:4.4.7-17.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package                 Arch           Version              Repository    Size

================================================================================

Installing:

 gcc-c++                 x86_64         4.4.7-17.el6         base         4.7 M

Installing for dependencies:

 libstdc++-devel         x86_64         4.4.7-17.el6         base         1.6 M

 

Transaction Summary

================================================================================

Install       2 Package(s)

 

Total download size: 6.3 M

Installed size: 20 M

Is this ok [y/N]: y

Downloading Packages:

(1/2): gcc-c++-4.4.7-17.el6.x86_64.rpm                   | 4.7 MB     00:00    

(2/2): libstdc++-devel-4.4.7-17.el6.x86_64.rpm           | 1.6 MB     00:00    

--------------------------------------------------------------------------------

Total                                           5.2 MB/s | 6.3 MB     00:01    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : libstdc++-devel-4.4.7-17.el6.x86_64                          1/2

  Installing : gcc-c++-4.4.7-17.el6.x86_64                                  2/2

  Verifying  : gcc-c++-4.4.7-17.el6.x86_64                                  1/2

  Verifying  : libstdc++-devel-4.4.7-17.el6.x86_64                          2/2

 

Installed:

  gcc-c++.x86_64 0:4.4.7-17.el6                                                

 

Dependency Installed:

  libstdc++-devel.x86_64 0:4.4.7-17.el6                                        

 

Complete!

 

gccversionを見てみます。

[root@localhost Desktop]# gcc -v

Using built-in specs.

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

Thread model: posix

gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)

 

gcc-c++(g++)versionを見てみます。

[root@localhost Desktop]# g++ -v

Using built-in specs.

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

Thread model: posix

gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)

 

Matlab R2016bの対応コンパイラはgcc4.9.xです。

yum install gcc

だと4.4.7までしか対応しません。

そこで以下のホームページ

http://www.task-notes.com/entry/20151114/1447492231

を参考にgcc 4..29をインストールしてみました。

Devtoolset-2Devtoolset-3をインストールします。Devtoolset-3Fedora用のを読み込んでいるためかエラーが出ますが、--no-check-certificateとすることでインストールできます。

Devtoolset-2のリポジトリのインストール

ホームページに従ってscl-utilsをインストールします。

[root@localhost Desktop]# yum install scl-utils

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: ftp.tsukuba.wide.ad.jp

 * extras: ftp.tsukuba.wide.ad.jp

 * updates: ftp.tsukuba.wide.ad.jp

Package scl-utils-20120927-27.el6_6.x86_64 already installed and latest version

Nothing to do

 

すでに導入されてました。

フォルダを/etc/yum.repos.d/に変更し、Devtoolset-2を取りに行きます。

[root@localhost Desktop]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# wget http://people.centos.org/tru/devtools-2/devtools-2.repo

--2017-01-30 12:24:21--  http://people.centos.org/tru/devtools-2/devtools-2.repo

Resolving people.centos.org... 50.28.24.115

Connecting to people.centos.org|50.28.24.115|:80... connected.

HTTP request sent, awaiting response... 302 Found

Location: https://people.centos.org/tru/devtools-2/devtools-2.repo [following]

--2017-01-30 12:24:21--  https://people.centos.org/tru/devtools-2/devtools-2.repo

Connecting to people.centos.org|50.28.24.115|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 175

Saving to: “devtools-2.repo”

 

100%[======================================>] 175         --.-K/s   in 0s     

 

2017-01-30 12:24:22 (4.27 MB/s) - “devtools-2.repo” saved [175/175]

devtoolset-2-gccをインストールします。

[root@localhost yum.repos.d]# yum install devtoolset-2-gcc devtoolset-2-binutils

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: ftp.tsukuba.wide.ad.jp

 * extras: ftp.tsukuba.wide.ad.jp

 * updates: ftp.tsukuba.wide.ad.jp

testing-devtools-2-centos-6                              |  951 B     00:00    

testing-devtools-2-centos-6/primary                      |  33 kB     00:00    

testing-devtools-2-centos-6                                             119/119

Resolving Dependencies

--> Running transaction check

---> Package devtoolset-2-binutils.x86_64 0:2.23.52.0.1-10.el6 will be installed

--> Processing Dependency: devtoolset-2-runtime for package: devtoolset-2-binutils-2.23.52.0.1-10.el6.x86_64

---> Package devtoolset-2-gcc.x86_64 0:4.8.2-15.el6 will be installed

--> Running transaction check

---> Package devtoolset-2-runtime.noarch 0:2.1-4.el6 will be installed

--> Processing Dependency: policycoreutils-python for package: devtoolset-2-runtime-2.1-4.el6.noarch

--> Running transaction check

---> Package policycoreutils-python.x86_64 0:2.0.83-30.1.el6_8 will be installed

--> Processing Dependency: policycoreutils = 2.0.83-30.1.el6_8 for package: policycoreutils-python-2.0.83-30.1.el6_8.x86_64

--> Processing Dependency: libsemanage-python >= 2.0.43-4 for package: policycoreutils-python-2.0.83-30.1.el6_8.x86_64

--> Processing Dependency: audit-libs-python >= 1.4.2-1 for package: policycoreutils-python-2.0.83-30.1.el6_8.x86_64

--> Processing Dependency: setools-libs-python for package: policycoreutils-python-2.0.83-30.1.el6_8.x86_64

--> Processing Dependency: libcgroup for package: policycoreutils-python-2.0.83-30.1.el6_8.x86_64

--> Running transaction check

---> Package audit-libs-python.x86_64 0:2.4.5-3.el6 will be installed

---> Package libcgroup.x86_64 0:0.40.rc1-18.el6_8 will be installed

---> Package libsemanage-python.x86_64 0:2.0.43-5.1.el6 will be installed

---> Package policycoreutils.x86_64 0:2.0.83-29.el6 will be updated

---> Package policycoreutils.x86_64 0:2.0.83-30.1.el6_8 will be an update

---> Package setools-libs-python.x86_64 0:3.3.7-4.el6 will be installed

--> Processing Dependency: setools-libs = 3.3.7-4.el6 for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libsefs.so.4(VERS_4.0)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libseaudit.so.4(VERS_4.2)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libseaudit.so.4(VERS_4.1)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libqpol.so.1(VERS_1.3)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libpoldiff.so.1(VERS_1.3)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libpoldiff.so.1(VERS_1.2)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libapol.so.4(VERS_4.1)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libsefs.so.4()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libseaudit.so.4()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libqpol.so.1()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libpoldiff.so.1()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Processing Dependency: libapol.so.4()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64

--> Running transaction check

---> Package setools-libs.x86_64 0:3.3.7-4.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package             Arch   Version           Repository                   Size

================================================================================

Installing:

 devtoolset-2-binutils

                     x86_64 2.23.52.0.1-10.el6

                                              testing-devtools-2-centos-6 5.0 M

 devtoolset-2-gcc    x86_64 4.8.2-15.el6      testing-devtools-2-centos-6  22 M

Installing for dependencies:

 audit-libs-python   x86_64 2.4.5-3.el6       base                         63 k

 devtoolset-2-runtime

                     noarch 2.1-4.el6         testing-devtools-2-centos-6 1.0 M

 libcgroup           x86_64 0.40.rc1-18.el6_8 updates                     130 k

 libsemanage-python  x86_64 2.0.43-5.1.el6    base                         81 k

 policycoreutils-python

                     x86_64 2.0.83-30.1.el6_8 updates                     437 k

 setools-libs        x86_64 3.3.7-4.el6       base                        400 k

 setools-libs-python x86_64 3.3.7-4.el6       base                        222 k

Updating for dependencies:

 policycoreutils     x86_64 2.0.83-30.1.el6_8 updates                     663 k

 

Transaction Summary

================================================================================

Install       9 Package(s)

Upgrade       1 Package(s)

 

Total download size: 30 M

Is this ok [y/N]: y

Downloading Packages:

(1/10): audit-libs-python-2.4.5-3.el6.x86_64.rpm         |  63 kB     00:00    

(2/10): devtoolset-2-binutils-2.23.52.0.1-10.el6.x86_64. | 5.0 MB     00:07    

(3/10): devtoolset-2-gcc-4.8.2-15.el6.x86_64.rpm         |  22 MB     00:28    

(4/10): devtoolset-2-runtime-2.1-4.el6.noarch.rpm        | 1.0 MB     00:02    

(5/10): libcgroup-0.40.rc1-18.el6_8.x86_64.rpm           | 130 kB     00:00    

(6/10): libsemanage-python-2.0.43-5.1.el6.x86_64.rpm     |  81 kB     00:00    

(7/10): policycoreutils-2.0.83-30.1.el6_8.x86_64.rpm     | 663 kB     00:00    

(8/10): policycoreutils-python-2.0.83-30.1.el6_8.x86_64. | 437 kB     00:00    

(9/10): setools-libs-3.3.7-4.el6.x86_64.rpm              | 400 kB     00:00    

(10/10): setools-libs-python-3.3.7-4.el6.x86_64.rpm      | 222 kB     00:00    

--------------------------------------------------------------------------------

Total                                           713 kB/s |  30 MB     00:42    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : setools-libs-3.3.7-4.el6.x86_64                             1/11

  Installing : setools-libs-python-3.3.7-4.el6.x86_64                      2/11

  Installing : audit-libs-python-2.4.5-3.el6.x86_64                        3/11

  Installing : libcgroup-0.40.rc1-18.el6_8.x86_64                          4/11

  Installing : libsemanage-python-2.0.43-5.1.el6.x86_64                    5/11

  Updating   : policycoreutils-2.0.83-30.1.el6_8.x86_64                    6/11

  Installing : policycoreutils-python-2.0.83-30.1.el6_8.x86_64             7/11

  Installing : devtoolset-2-runtime-2.1-4.el6.noarch                       8/11

  Installing : devtoolset-2-binutils-2.23.52.0.1-10.el6.x86_64             9/11

  Installing : devtoolset-2-gcc-4.8.2-15.el6.x86_64                       10/11

  Cleanup    : policycoreutils-2.0.83-29.el6.x86_64                       11/11

  Verifying  : devtoolset-2-binutils-2.23.52.0.1-10.el6.x86_64             1/11

  Verifying  : policycoreutils-2.0.83-30.1.el6_8.x86_64                    2/11

  Verifying  : policycoreutils-python-2.0.83-30.1.el6_8.x86_64             3/11

  Verifying  : libsemanage-python-2.0.43-5.1.el6.x86_64                    4/11

  Verifying  : setools-libs-python-3.3.7-4.el6.x86_64                      5/11

  Verifying  : libcgroup-0.40.rc1-18.el6_8.x86_64                          6/11

  Verifying  : devtoolset-2-gcc-4.8.2-15.el6.x86_64                        7/11

  Verifying  : devtoolset-2-runtime-2.1-4.el6.noarch                       8/11

  Verifying  : audit-libs-python-2.4.5-3.el6.x86_64                        9/11

  Verifying  : setools-libs-3.3.7-4.el6.x86_64                            10/11

  Verifying  : policycoreutils-2.0.83-29.el6.x86_64                       11/11

 

Installed:

  devtoolset-2-binutils.x86_64 0:2.23.52.0.1-10.el6                            

  devtoolset-2-gcc.x86_64 0:4.8.2-15.el6                                       

 

Dependency Installed:

  audit-libs-python.x86_64 0:2.4.5-3.el6                                       

  devtoolset-2-runtime.noarch 0:2.1-4.el6                                      

  libcgroup.x86_64 0:0.40.rc1-18.el6_8                                         

  libsemanage-python.x86_64 0:2.0.43-5.1.el6                                    

  policycoreutils-python.x86_64 0:2.0.83-30.1.el6_8                            

  setools-libs.x86_64 0:3.3.7-4.el6                                            

  setools-libs-python.x86_64 0:3.3.7-4.el6                                      

 

Dependency Updated:

  policycoreutils.x86_64 0:2.0.83-30.1.el6_8                                   

 

Complete!

gcc 4.8.2のインストール

[root@localhost yum.repos.d]# yum install devtoolset-2-gcc-c++

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: ftp.riken.jp

 * extras: ftp.riken.jp

 * updates: ftp.riken.jp

Resolving Dependencies

--> Running transaction check

---> Package devtoolset-2-gcc-c++.x86_64 0:4.8.2-15.el6 will be installed

--> Processing Dependency: devtoolset-2-libstdc++-devel = 4.8.2-15.el6 for package: devtoolset-2-gcc-c++-4.8.2-15.el6.x86_64

--> Running transaction check

---> Package devtoolset-2-libstdc++-devel.x86_64 0:4.8.2-15.el6 will be installed

testing-devtools-2-centos-6/filelists                    | 222 kB     00:00    

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package                  Arch   Version      Repository                   Size

================================================================================

Installing:

 devtoolset-2-gcc-c++     x86_64 4.8.2-15.el6 testing-devtools-2-centos-6 7.2 M

Installing for dependencies:

 devtoolset-2-libstdc++-devel

                          x86_64 4.8.2-15.el6 testing-devtools-2-centos-6 1.9 M

 

Transaction Summary

================================================================================

Install       2 Package(s)

 

Total download size: 9.1 M

Installed size: 28 M

Is this ok [y/N]: y

Downloading Packages:

(1/2): devtoolset-2-gcc-c++-4.8.2-15.el6.x86_64.rpm      | 7.2 MB     00:17    

(2/2): devtoolset-2-libstdc++-devel-4.8.2-15.el6.x86_64. | 1.9 MB     00:07    

--------------------------------------------------------------------------------

Total                                           346 kB/s | 9.1 MB     00:26    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : devtoolset-2-libstdc++-devel-4.8.2-15.el6.x86_64             1/2

  Installing : devtoolset-2-gcc-c++-4.8.2-15.el6.x86_64                     2/2

  Verifying  : devtoolset-2-libstdc++-devel-4.8.2-15.el6.x86_64             1/2

  Verifying  : devtoolset-2-gcc-c++-4.8.2-15.el6.x86_64                     2/2

 

Installed:

  devtoolset-2-gcc-c++.x86_64 0:4.8.2-15.el6                                   

 

Dependency Installed:

  devtoolset-2-libstdc++-devel.x86_64 0:4.8.2-15.el6                            

 

Complete!

 

gccversionを確かめます。

[root@localhost yum.repos.d]# ll /opt/rh/devtoolset-2/root/usr/bin/gcc

-rwxr-xr-x. 2 root root 750576 Mar 12  2014 /opt/rh/devtoolset-2/root/usr/bin/gcc

[root@localhost yum.repos.d]# ll /opt/rh/devtoolset-2/root/usr/bin/g++

-rwxr-xr-x. 4 root root 754064 Mar 12  2014 /opt/rh/devtoolset-2/root/usr/bin/g++

[root@localhost yum.repos.d]# scl enable devtoolset-2 bash

[root@localhost yum.repos.d]# gcc -v

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

Thread model: posix

gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)

 

[root@localhost yum.repos.d]# g++ -v

Using built-in specs.

COLLECT_GCC=g++

COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

Thread model: posix

gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)

起動するたびに毎回手動でscl enable~を実行するのを、自動化する方法だそうです。

 [root@localhost yum.repos.d]# echo 'source /opt/rh/devtoolset-2/enable' >>/etc/profile.d/devtools

Devtoolset-3リポジトリのインストール

R2016bgcc 4.9です。4.8ではダメです。Devtoolset-3リポジトリをインストールすれば4.9になるそうです。

 [root@localhost yum.repos.d]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# wget https://copr-fe.cloud.fedoraproject.org/coprs/rhscl/devtoolset-3/repo/epel-6/rhscl-devtoolset-3-epel-6.repo

--2017-01-28 02:05:35--  https://copr-fe.cloud.fedoraproject.org/coprs/rhscl/devtoolset-3/repo/epel-6/rhscl-devtoolset-3-epel-6.repo

Resolving copr-fe.cloud.fedoraproject.org... 209.132.184.54

Connecting to copr-fe.cloud.fedoraproject.org|209.132.184.54|:443... connected.

ERROR: no certificate subject alternative name matches

              requested host name “copr-fe.cloud.fedoraproject.org”.

To connect to copr-fe.cloud.fedoraproject.org insecurely, use ‘--no-check-certificate’.

エラーが出ました。指示通り--no-check-certificateをつけます。

 [root@localhost yum.repos.d]# wget https://copr-fe.cloud.fedoraproject.org/coprs/rhscl/devtoolset-3/repo/epel-6/rhscl-devtoolset-3-epel-6.repo --no-check-certificate

--2017-01-28 02:06:00--  https://copr-fe.cloud.fedoraproject.org/coprs/rhscl/devtoolset-3/repo/epel-6/rhscl-devtoolset-3-epel-6.repo

Resolving copr-fe.cloud.fedoraproject.org... 209.132.184.54

Connecting to copr-fe.cloud.fedoraproject.org|209.132.184.54|:443... connected.

WARNING: no certificate subject alternative name matches

              requested host name “copr-fe.cloud.fedoraproject.org”.

HTTP request sent, awaiting response... 200 OK

Length: 338 [text/plain]

Saving to: “rhscl-devtoolset-3-epel-6.repo”

 

100%[======================================>] 338         --.-K/s   in 0s     

 

2017-01-28 02:06:01 (14.6 MB/s) - “rhscl-devtoolset-3-epel-6.repo” saved [338/338]

[root@localhost yum.repos.d]# yum install devtoolset-3-gcc devtoolset-3-binutils

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: ftp.riken.jp

 * extras: ftp.riken.jp

 * updates: ftp.riken.jp

rhscl-devtoolset-3                                       | 3.0 kB     00:00    

rhscl-devtoolset-3/primary_db                            | 201 kB     00:01    

Resolving Dependencies

--> Running transaction check

---> Package devtoolset-3-binutils.x86_64 0:2.24-18.el6 will be installed

--> Processing Dependency: devtoolset-3-runtime for package: devtoolset-3-binutils-2.24-18.el6.x86_64

---> Package devtoolset-3-gcc.x86_64 0:4.9.2-6.el6 will be installed

--> Running transaction check

---> Package devtoolset-3-runtime.x86_64 0:3.1-12.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package                  Arch      Version         Repository             Size

================================================================================

Installing:

 devtoolset-3-binutils    x86_64    2.24-18.el6     rhscl-devtoolset-3    5.1 M

 devtoolset-3-gcc         x86_64    4.9.2-6.el6     rhscl-devtoolset-3     24 M

Installing for dependencies:

 devtoolset-3-runtime     x86_64    3.1-12.el6      rhscl-devtoolset-3    1.1 M

 

Transaction Summary

================================================================================

Install       3 Package(s)

 

Total download size: 30 M

Installed size: 69 M

Is this ok [y/N]: y

Downloading Packages:

(1/3): devtoolset-3-binutils-2.24-18.el6.x86_64.rpm      | 5.1 MB     00:14    

(2/3): devtoolset-3-gcc-4.9.2-6.el6.x86_64.rpm           |  24 MB     01:08    

(3/3): devtoolset-3-runtime-3.1-12.el6.x86_64.rpm        | 1.1 MB     00:04    

--------------------------------------------------------------------------------

Total                                           354 kB/s |  30 MB     01:28    

warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID 094d442c: NOKEY

Retrieving key from https://copr-be.cloud.fedoraproject.org/results/rhscl/devtoolset-3/pubkey.gpg

Importing GPG key 0x094D442C:

 Userid: "rhscl_devtoolset-3 (None) <rhscl#devtoolset-3@copr.fedorahosted.org>"

 From  : https://copr-be.cloud.fedoraproject.org/results/rhscl/devtoolset-3/pubkey.gpg

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : devtoolset-3-runtime-3.1-12.el6.x86_64                       1/3

  Installing : devtoolset-3-binutils-2.24-18.el6.x86_64                     2/3

  Installing : devtoolset-3-gcc-4.9.2-6.el6.x86_64                          3/3

  Verifying  : devtoolset-3-binutils-2.24-18.el6.x86_64                     1/3

  Verifying  : devtoolset-3-runtime-3.1-12.el6.x86_64                       2/3

  Verifying  : devtoolset-3-gcc-4.9.2-6.el6.x86_64                          3/3

 

Installed:

  devtoolset-3-binutils.x86_64 0:2.24-18.el6                                   

  devtoolset-3-gcc.x86_64 0:4.9.2-6.el6                                        

 

Dependency Installed:

  devtoolset-3-runtime.x86_64 0:3.1-12.el6                                      

 

Complete!

gcc4.9.2のインストール

[root@localhost yum.repos.d]# yum install devtoolset-3-gcc-c++

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: ftp.riken.jp

 * extras: ftp.riken.jp

 * updates: ftp.riken.jp

Resolving Dependencies

--> Running transaction check

---> Package devtoolset-3-gcc-c++.x86_64 0:4.9.2-6.el6 will be installed

--> Processing Dependency: devtoolset-3-libstdc++-devel = 4.9.2-6.el6 for package: devtoolset-3-gcc-c++-4.9.2-6.el6.x86_64

--> Running transaction check

---> Package devtoolset-3-libstdc++-devel.x86_64 0:4.9.2-6.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package                       Arch    Version        Repository           Size

================================================================================

Installing:

 devtoolset-3-gcc-c++          x86_64  4.9.2-6.el6    rhscl-devtoolset-3  8.4 M

Installing for dependencies:

 devtoolset-3-libstdc++-devel  x86_64  4.9.2-6.el6    rhscl-devtoolset-3  2.0 M

 

Transaction Summary

================================================================================

Install       2 Package(s)

 

Total download size: 10 M

Installed size: 32 M

Is this ok [y/N]: y

Downloading Packages:

(1/2): devtoolset-3-gcc-c++-4.9.2-6.el6.x86_64.rpm       | 8.4 MB     00:22    

(2/2): devtoolset-3-libstdc++-devel-4.9.2-6.el6.x86_64.r | 2.0 MB     00:04    

--------------------------------------------------------------------------------

Total                                           374 kB/s |  10 MB     00:28    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : devtoolset-3-libstdc++-devel-4.9.2-6.el6.x86_64              1/2

  Installing : devtoolset-3-gcc-c++-4.9.2-6.el6.x86_64                      2/2

  Verifying  : devtoolset-3-gcc-c++-4.9.2-6.el6.x86_64                      1/2

  Verifying  : devtoolset-3-libstdc++-devel-4.9.2-6.el6.x86_64              2/2

 

Installed:

  devtoolset-3-gcc-c++.x86_64 0:4.9.2-6.el6                                    

 

Dependency Installed:

  devtoolset-3-libstdc++-devel.x86_64 0:4.9.2-6.el6                            

 

Complete!

[root@localhost yum.repos.d]# ll /opt/rh/devtoolset-3/root/usr/bin/gcc

-rwxr-xr-x. 2 root root 842720 Jun 18  2015 /opt/rh/devtoolset-3/root/usr/bin/gcc

[root@localhost yum.repos.d]# ll /opt/rh/devtoolset-3/root/usr/bin/g++

-rwxr-xr-x. 4 root root 846112 Jun 18  2015 /opt/rh/devtoolset-3/root/usr/bin/g++

[root@localhost yum.repos.d]# scl enable devtoolset-3 bash

[root@localhost yum.repos.d]# gcc -v

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

Thread model: posix

gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)

[root@localhost yum.repos.d]# g++ -v

Using built-in specs.

COLLECT_GCC=g++

COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

Thread model: posix

gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)

 [root@localhost yum.repos.d]#