Tuesday, December 6, 2016

Centos/RHEL/OEL 7'de GCC 6.2 Kurulumu

GNU derleyicilerinin en güncel sürümü GCC 6.2 ile aşağıdaki dillerde yazılan uygulamalar derlenebilir:
  • C
  • C++
  • Objective-C
  • Objective-C++
  • Java
  • Fortran
  • Ada
  • Go
Centos/RHEL/OEL 7 işletim sistemi için GCC 6.2'nin kurulumu için aşağıdaki adımları izlemeniz gerekir:

[guru@localhost ext]$ sudo yum -y install gmp-devel mpfr-devel libmpc-devel glibc-devel.i686 libgcc.i686 gcc-c++
Loaded plugins: fastestmirror, langpacks
base                                                                      | 3.6 kB  00:00:00     
extras                                                                    | 3.4 kB  00:00:00     
updates                                                                   | 3.4 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirror.radoreservers.com
 * extras: mirror.radoreservers.com
 * updates: mirror.radoreservers.com
Package gcc-c++-4.8.5-4.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package glibc-devel.i686 0:2.17-106.el7_2.8 will be installed
--> Processing Dependency: glibc-headers = 2.17-106.el7_2.8 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: glibc = 2.17-106.el7_2.8 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libutil.so.1 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libthread_db.so.1 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: librt.so.1 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libresolv.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libnss_nisplus.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libnss_nis.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libnss_hesiod.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libnss_files.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libnss_dns.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libnss_db.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libnss_compat.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libnsl.so.1 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libm.so.6 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libdl.so.2 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libcrypt.so.1 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libcidn.so.1 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libanl.so.1 for package: glibc-devel-2.17-106.el7_2.8.i686
--> Processing Dependency: libBrokenLocale.so.1 for package: glibc-devel-2.17-106.el7_2.8.i686
---> Package gmp-devel.x86_64 1:6.0.0-12.el7_1 will be installed
--> Processing Dependency: gmp = 1:6.0.0-12.el7_1 for package: 1:gmp-devel-6.0.0-12.el7_1.x86_64
---> Package libgcc.i686 0:4.8.5-4.el7 will be installed
---> Package libmpc-devel.x86_64 0:1.0.1-3.el7 will be installed
---> Package mpfr-devel.x86_64 0:3.1.1-4.el7 will be installed
--> Running transaction check
---> Package glibc.x86_64 0:2.17-105.el7 will be updated
--> Processing Dependency: glibc = 2.17-105.el7 for package: glibc-devel-2.17-105.el7.x86_64
--> Processing Dependency: glibc = 2.17-105.el7 for package: glibc-common-2.17-105.el7.x86_64
---> Package glibc.i686 0:2.17-106.el7_2.8 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.17-106.el7_2.8.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.17-106.el7_2.8.i686
---> Package glibc.x86_64 0:2.17-106.el7_2.8 will be an update
---> Package glibc-headers.x86_64 0:2.17-105.el7 will be updated
---> Package glibc-headers.x86_64 0:2.17-106.el7_2.8 will be an update
---> Package gmp.x86_64 1:6.0.0-11.el7 will be updated
---> Package gmp.x86_64 1:6.0.0-12.el7_1 will be an update
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-105.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-106.el7_2.8 will be an update
---> Package glibc-devel.x86_64 0:2.17-105.el7 will be updated
---> Package glibc-devel.x86_64 0:2.17-106.el7_2.8 will be an update
---> Package nss-softokn-freebl.x86_64 0:3.16.2.3-13.el7_1 will be updated
---> Package nss-softokn-freebl.i686 0:3.16.2.3-14.2.el7_2 will be installed
---> Package nss-softokn-freebl.x86_64 0:3.16.2.3-14.2.el7_2 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================
 Package                     Arch            Version                      Repository        Size
=================================================================================================
Installing:
 glibc-devel                 i686            2.17-106.el7_2.8             updates          1.0 M
 gmp-devel                   x86_64          1:6.0.0-12.el7_1             updates          181 k
 libgcc                      i686            4.8.5-4.el7                  base             103 k
 libmpc-devel                x86_64          1.0.1-3.el7                  base              32 k
 mpfr-devel                  x86_64          3.1.1-4.el7                  base              68 k
Installing for dependencies:
 glibc                       i686            2.17-106.el7_2.8             updates          4.2 M
 nss-softokn-freebl          i686            3.16.2.3-14.2.el7_2          updates          187 k
Updating for dependencies:
 glibc                       x86_64          2.17-106.el7_2.8             updates          3.6 M
 glibc-common                x86_64          2.17-106.el7_2.8             updates           11 M
 glibc-devel                 x86_64          2.17-106.el7_2.8             updates          1.0 M
 glibc-headers               x86_64          2.17-106.el7_2.8             updates          663 k
 gmp                         x86_64          1:6.0.0-12.el7_1             updates          280 k
 nss-softokn-freebl          x86_64          3.16.2.3-14.2.el7_2          updates          204 k

Transaction Summary
=================================================================================================
Install  5 Packages (+2 Dependent packages)
Upgrade             ( 6 Dependent packages)

Total size: 23 M
Total download size: 5.8 M
Downloading packages:
(1/7): libmpc-devel-1.0.1-3.el7.x86_64.rpm                                |  32 kB  00:00:00     
(2/7): libgcc-4.8.5-4.el7.i686.rpm                                        | 103 kB  00:00:00     
(3/7): mpfr-devel-3.1.1-4.el7.x86_64.rpm                                  |  68 kB  00:00:00     
(4/7): glibc-devel-2.17-106.el7_2.8.i686.rpm                              | 1.0 MB  00:00:00     
(5/7): gmp-devel-6.0.0-12.el7_1.x86_64.rpm                                | 181 kB  00:00:00     
(6/7): nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686.rpm                    | 187 kB  00:00:00     
(7/7): glibc-2.17-106.el7_2.8.i686.rpm                                    | 4.2 MB  00:00:01     
-------------------------------------------------------------------------------------------------
Total                                                            4.8 MB/s | 5.8 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libgcc-4.8.5-4.el7.i686                                                                                                                   1/19 
  Updating   : nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64                                                                                             2/19 
  Updating   : glibc-common-2.17-106.el7_2.8.x86_64                                                                                                      3/19 
  Updating   : glibc-2.17-106.el7_2.8.x86_64                                                                                                             4/19 
  Updating   : glibc-headers-2.17-106.el7_2.8.x86_64                                                                                                     5/19 
  Installing : nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686                                                                                               6/19 
  Installing : glibc-2.17-106.el7_2.8.i686                                                                                                               7/19 
  Updating   : 1:gmp-6.0.0-12.el7_1.x86_64                                                                                                               8/19 
  Installing : 1:gmp-devel-6.0.0-12.el7_1.x86_64                                                                                                         9/19 
  Installing : mpfr-devel-3.1.1-4.el7.x86_64                                                                                                            10/19 
  Installing : libmpc-devel-1.0.1-3.el7.x86_64                                                                                                          11/19 
  Installing : glibc-devel-2.17-106.el7_2.8.i686                                                                                                        12/19 
  Updating   : glibc-devel-2.17-106.el7_2.8.x86_64                                                                                                      13/19 
  Cleanup    : glibc-devel-2.17-105.el7.x86_64                                                                                                          14/19 
  Cleanup    : glibc-headers-2.17-105.el7.x86_64                                                                                                        15/19 
  Cleanup    : 1:gmp-6.0.0-11.el7.x86_64                                                                                                                16/19 
  Cleanup    : glibc-common-2.17-105.el7.x86_64                                                                                                         17/19 
  Cleanup    : nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64                                                                                              18/19 
  Cleanup    : glibc-2.17-105.el7.x86_64                                                                                                                19/19 
  Verifying  : 1:gmp-6.0.0-12.el7_1.x86_64                                                                                                               1/19 
  Verifying  : libgcc-4.8.5-4.el7.i686                                                                                                                   2/19 
  Verifying  : glibc-2.17-106.el7_2.8.i686                                                                                                               3/19 
  Verifying  : nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686                                                                                               4/19 
  Verifying  : glibc-devel-2.17-106.el7_2.8.i686                                                                                                         5/19 
  Verifying  : 1:gmp-devel-6.0.0-12.el7_1.x86_64                                                                                                         6/19 
  Verifying  : libmpc-devel-1.0.1-3.el7.x86_64                                                                                                           7/19 
  Verifying  : nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64                                                                                             8/19 
  Verifying  : glibc-devel-2.17-106.el7_2.8.x86_64                                                                                                       9/19 
  Verifying  : glibc-headers-2.17-106.el7_2.8.x86_64                                                                                                    10/19 
  Verifying  : glibc-common-2.17-106.el7_2.8.x86_64                                                                                                     11/19 
  Verifying  : glibc-2.17-106.el7_2.8.x86_64                                                                                                            12/19 
  Verifying  : mpfr-devel-3.1.1-4.el7.x86_64                                                                                                            13/19 
  Verifying  : glibc-devel-2.17-105.el7.x86_64                                                                                                          14/19 
  Verifying  : glibc-headers-2.17-105.el7.x86_64                                                                                                        15/19 
  Verifying  : nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64                                                                                              16/19 
  Verifying  : glibc-common-2.17-105.el7.x86_64                                                                                                         17/19 
  Verifying  : glibc-2.17-105.el7.x86_64                                                                                                                18/19 
  Verifying  : 1:gmp-6.0.0-11.el7.x86_64                                                                                                                19/19 

Installed:
  glibc-devel.i686 0:2.17-106.el7_2.8       gmp-devel.x86_64 1:6.0.0-12.el7_1       libgcc.i686 0:4.8.5-4.el7       libmpc-devel.x86_64 0:1.0.1-3.el7      
  mpfr-devel.x86_64 0:3.1.1-4.el7          

Dependency Installed:
  glibc.i686 0:2.17-106.el7_2.8                                         nss-softokn-freebl.i686 0:3.16.2.3-14.2.el7_2                                        

Dependency Updated:
  glibc.x86_64 0:2.17-106.el7_2.8                   glibc-common.x86_64 0:2.17-106.el7_2.8           glibc-devel.x86_64 0:2.17-106.el7_2.8                    
  glibc-headers.x86_64 0:2.17-106.el7_2.8           gmp.x86_64 1:6.0.0-12.el7_1                      nss-softokn-freebl.x86_64 0:3.16.2.3-14.2.el7_2          

Complete!

Şimdi GCC 6.2'nin kaynak kodunu makinamıza indiriyoruz:

[guru@localhost ext]$ sudo wget https://ftp.gnu.org/gnu/gcc/gcc-6.2.0/gcc-6.2.0.tar.gz
--2016-12-02 08:48:23--  https://ftp.gnu.org/gnu/gcc/gcc-6.2.0/gcc-6.2.0.tar.gz
Resolving ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b
Connecting to ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 128569126 (123M) [application/x-gzip]
Saving to: ‘gcc-6.2.0.tar.gz’

100%[====================================================================================================================>] 128,569,126 1.15MB/s   in 1m 42s 

2016-12-02 08:50:05 (1.20 MB/s) - ‘gcc-6.2.0.tar.gz’ saved [128569126/128569126]

[guru@localhost ext]$ 

build için bir dizin oluşturup Makefile oluşturmak üzere configure komutunu çalıştırıyoruz:

[guru@localhost ext]$ sudo tar -xzf gcc-6.2.0.tar.gz 
[guru@localhost ext]$ sudo mkdir build
[guru@localhost ext]$ ls
build  gcc-6.2.0  gcc-6.2.0.tar.gz  lost+found
[guru@localhost ext]$ cd build/
[guru@localhost build]$ sudo ../gcc-6.2.0/configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for libmpx support... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... yes
checking for isl 0.16, 0.15, or deprecated 0.14... no
recommended isl version is 0.16 or 0.15, the minimum required isl version 0.14 is deprecated
checking for isl 0.16 or 0.15... no
The following languages will be built: c,c++,fortran,java,lto,objc
*** This configuration is not supported in the following subdirectories:
     gnattools gotools target-libada target-libgo target-liboffloadmic
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... bootstrap-debug
checking for --enable-vtable-verify... no
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... no
/ext/gcc-6.2.0/missing: line 81: makeinfo: command not found
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for cc... cc
checking for c++... c++
checking for gcc... gcc
checking for gcj... no
checking for gfortran... gfortran
checking for gccgo... no
checking for ar... no
checking for ar... ar
checking for as... no
checking for as... as
checking for dlltool... no
checking for dlltool... no
checking for ld... no
checking for ld... ld
checking for lipo... no
checking for lipo... no
checking for nm... no
checking for nm... nm
checking for objcopy... no
checking for objcopy... objcopy
checking for objdump... no
checking for objdump... objdump
checking for ranlib... no
checking for ranlib... ranlib
checking for readelf... no
checking for readelf... readelf
checking for strip... no
checking for strip... strip
checking for windres... no
checking for windres... no
checking for windmc... no
checking for windmc... no
checking where to find the target ar... host tool
checking where to find the target as... host tool
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... host tool
checking where to find the target gcc... just compiled
checking where to find the target gcj... just compiled
checking where to find the target gfortran... just compiled
checking where to find the target gccgo... host tool
checking where to find the target ld... host tool
checking where to find the target lipo... host tool
checking where to find the target nm... host tool
checking where to find the target objcopy... host tool
checking where to find the target objdump... host tool
checking where to find the target ranlib... host tool
checking where to find the target readelf... host tool
checking where to find the target strip... host tool
checking where to find the target windres... host tool
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile

Artık make komutu ile build işlemini başlatabiliriz:

[root@localhost build]# sudo make

Build işlemi bittikten sonra nihayet kurulumu gerçekleştirebiliriz:

[root@localhost build]# sudo make install
make[1]: Entering directory `/ext/build'
/bin/sh ../gcc-6.2.0/mkinstalldirs /usr/local /usr/local
make[2]: Entering directory `/ext/build/fixincludes'
rm -rf /usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.2.0/install-tools
/bin/sh ../../gcc-6.2.0/fixincludes/../mkinstalldirs /usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.2.0/install-tools
mkdir -p -- /usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.2.0/install-tools
/bin/sh ../../gcc-6.2.0/fixincludes/../mkinstalldirs /usr/local/lib/gcc/x86_64-pc-linux-gnu/6.2.0/install-tools/include
mkdir -p -- /usr/local/lib/gcc/x86_64-pc-linux-gnu/6.2.0/install-tools/include
/bin/install -c -m 644 ../../gcc-6.2.0/fixincludes/README-fixinc \

Kurulum sonrasında g++ derleyecisinin sürümünü kontrol edebiliriz:

[guru@localhost Desktop]$ g++ --version
g++ (GCC) 6.2.0
Copyright (C) 2016 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.

Son olarak GNU kütüphanelerinin sembolik linklerini yeni kütüphaneye bağlamamız gerekir:

sudo cp /ext/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so /lib64/
sudo rm /lib64/libstdc++.so.6
sudo ln -s /lib64/libstdc++.so /lib64/libstdc++.so.6

No comments:

Post a Comment