Monday, January 16, 2017

Boost Kütüphanesinin Visual Studio 2015'de Kullanımı

Boost projesi, C++ standardının gelişimine önemli katkısı bulunan, standart C++ kütüphanelerindeki işlevsel ya da başarım ile ilgili eksikleri gideren yüzlerce kütüphaneden oluşur. Bu kütüphanelerin listesine ve bilgisine bu bağlantıdan ulaşabilirsiniz. Bu kütüphaneler aynı zamanda C++11 ile gelen yeni kütüphaneler için en iyi uygulamaları barındıran referans çözüm olma özelliğini de taşıyor. Zamanla, bu kütüphaneler, C++'ın yeni versiyonlarında (C++11, C++14 ve C++17) standarda taşınıyorlar. Ancak hala önemli bazı Boost kütüphaneleri (Boost.Asio gibi) standardın dışında kullanım için bekliyor. 
Boost kütüphanelerini Solaris, Linux, AIX ve Windows gibi farklı platformlarda kullanabilirsiniz. Bunun için bu platformlarda ya hazır paket olarak kurulum yapmanız gerekir ya da kaynak koddan derlemeniz gerekir. Bu yazıda Boost kütüphanesinin Windows işletim sisteminde Visual Studio 2015 ile birlikte kullanabilmek üzere kaynak koddan derlenmesi için gerekli adımlar tanıtılacaktır. İlk adım olarak Boost kütüphanesinin bu yazı yazıldığında en güncel sürümü olan 1.63 sürümünü bu bağlantıdan indirmekle başlıyoruz. Ardından sıkıştırılmış dosyayı bir dizine açıyoruz. Makinamda bu dizini e:\opt\boost_1_63_0 olarak belirledim. e:\opt dizinine aşağıdaki BAT dosyasını oluşturuyoruz:


call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
 
cd boost_1_63_0
call bootstrap.bat
 
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64
b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/win32
 

vcvarsall.bat dosyası Visual Studio 2015 kurulumu ile gelen ve çevre değişkenlerini Visual Studio araçlarını kullanabilmeniz için ayarlayan bir betik. Makinamdaki Visual Studio 2015 kurulumunda, vcvarsall.bat dosyası, c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC dizininde oluşturulmuş. Siz de kendi maninanızdaki yerini bulup, yukarıdaki betikte uygun değişikliği yapmanız gerekir. vcvarsall.bat betiğine hangi mimaride derleme yapmak istiyorsak ilgili parametreyi vermemiz gerekir: 32-bitlik bir derleme için x86 ve 64-bitlik bir derleme için x64. Yukarıdaki betikten 64-bitlik derleme yapacağımızı görebilirsiniz. Şimdi betiği çalıştıralım:

e:\opt>call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 
Building Boost.Build engine

Bootstrapping is done. To build, run:

    .\b2
    
To adjust configuration, edit 'project-config.jam'.
Further information:

    - Command line help:
    .\b2 --help
     
    - Getting started guide: 
    http://boost.org/more/getting_started/windows.html
     
    - Boost.Build documentation:
    http://www.boost.org/build/doc/html/index.html
Performing configuration checks

    - 32-bit                   : yes
    - arm                      : no
    - mips1                    : no
    - power                    : no
    - sparc                    : no
    - x86                      : yes
    - symlinks supported       : no
    - junctions supported      : yes
    - hardlinks supported      : yes
    - C++11 mutex              : yes
    - Boost.Config Feature Check: cxx11_auto_declarations : yes
    - Boost.Config Feature Check: cxx11_constexpr : yes
    - Boost.Config Feature Check: cxx11_defaulted_functions : no
    - Boost.Config Feature Check: cxx11_final : yes
    - Boost.Config Feature Check: cxx11_hdr_mutex : yes
    - Boost.Config Feature Check: cxx11_hdr_tuple : yes
    - Boost.Config Feature Check: cxx11_lambdas : yes
    - Boost.Config Feature Check: cxx11_noexcept : yes
    - Boost.Config Feature Check: cxx11_nullptr : yes
    - Boost.Config Feature Check: cxx11_rvalue_references : yes
    - Boost.Config Feature Check: cxx11_template_aliases : yes
    - Boost.Config Feature Check: cxx11_thread_local : yes
    - Boost.Config Feature Check: cxx11_variadic_templates : yes

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

compile-c-c++ bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\instantiate_predef_macros.obj
instantiate_predef_macros.cpp
compile-c-c++ bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\instantiate_cpp_exprgrammar.obj
instantiate_cpp_exprgrammar.cpp
compile-c-c++ bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\wave_config_constant.obj
wave_config_constant.cpp
compile-c-c++ bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\instantiate_cpp_literalgrs.obj
instantiate_cpp_literalgrs.cpp
compile-c-c++ bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\instantiate_re2c_lexer_str.obj
instantiate_re2c_lexer_str.cpp
compile-c-c++ bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\cpplexer\re2clex\aq.obj
aq.cpp
compile-c-c++ bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\cpplexer\re2clex\cpp_re.obj
cpp_re.cpp
msvc.archive bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\libboost_wave-vc140-mt-gd-1_63.lib
common.copy stage\win32\lib\libboost_wave-vc140-mt-gd-1_63.lib
bin.v2\libs\wave\build\msvc-14.0\debug\link-static\threading-multi\libboost_wave-vc140-mt-gd-1_63.lib
        1 file(s) copied.
...updated 1015 targets...

Makinanızın disk, işlemci ve bellek başarımına göre derleme işlemi 3 dakika ile 15 dakika arası bir süre alabilir. Derleme tamamlandıktan sonra aşağıdaki adımları izleyerek VS 2015'de bir C++ çözümü ve projesi yaratıyoruz:


Evet, makinamda Visual Studio Community 2015 kurulu.

Visual Studio 2015'in açılış sonrası görünümü.

Şimdi, bir proje yaratabiliriz.

Projenin türü olarak Win32 Console Application seçiyoruz. 

Projenin bazı özelliklerini seçmek üzere bizi bir diyalog karşılıyor.



Precompiled header seçimini kaldıralım, diğer varsayılan değerlere dokunmuyoruz!

main giriş fonksiyonu olan boş bir proje yaratıldı.
Projede 64-bitlik çalışmak için x64 mimarisini seçiyoruz. 
Projenin Boost kütüphanesini görebilmesi için bir kaç tanımlama yapmak üzere, Projenin özellikleri diyalog penceresini açıyoruz.

C/C++ altındaki General başlığını seçiyoruz. Sağ taraftaki Additional Include Directories değeri olarak "e:\opt\boost_1_63_0" dizinini giriyoruz.

C/C++ altındaki "Precompiled Headers" başlığını seçiyoruz. Sağ taraftaki Precompiled Header değeri olarak Not Using Precompiled Headers değerini seçiyoruz.

Linker altındaki General başlığını seçiyoruz. Sağ taraftaki ayarlarda "Additional Library Directories" değeri olarak "e:\opt\boost_1_63_0\stage\x64\lib" dizinini giriyoruz.

Artık projeyi derleyebiliriz.

Derleme işlemimiz başarılı oldu.
Örnek projeyi bu bağlantıdan indirebilirsiniz. 

Tuesday, January 10, 2017

MySQL'de Değişkenler

MySQL ilişkisel veritabanı sunucusunda iki tür değişken bulunmaktadır:
  • Veritabanının davranışını okumamızı sağlayan değişkenler (status)
  • Veritabanının davranışını değiştirmemizi sağlayan değişkenler (variable)
Yine bu değişkenler kendi içinde global ve session olmak üzere iki farklı gruba ayrılırlar. Bu değişkenler INFORMATION_SCHEMA veritabanında tablolarda yer alır:

MariaDB [(safirdepo)]> show tables from information_schema like '%STATUS%';
+-----------------------------------------+
| Tables_in_information_schema (%STATUS%) |
+-----------------------------------------+
| GLOBAL_STATUS                           |
| SESSION_STATUS                          |
+-----------------------------------------+
2 rows in set (0.00 sec)

MariaDB [(safirdepo)]> show tables from information_schema like '%VARIAB%';
+-----------------------------------------+
| Tables_in_information_schema (%VARIAB%) |
+-----------------------------------------+
| GLOBAL_VARIABLES                        |
| SESSION_VARIABLES                       |
| SYSTEM_VARIABLES                        |
+-----------------------------------------+
3 rows in set (0.00 sec)

Bu değişkenlerin değerini okumak için yukarıda listelenen tabloları SELECT ile sorgulamak yerine kısayolu olan show komutundan yararlanırız:

MariaDB [(safirdepo)]> show global status like 'ROWS_SENT';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Rows_sent     | 1725  |
+---------------+-------+
1 row in set (0.00 sec)

MariaDB [(safirdepo)]> show session status like 'ROWS_SENT';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Rows_sent     | 1     |
+---------------+-------+
1 row in set (0.00 sec)

MariaDB [(safirdepo)]> select count(*) from INFORMATION_SCHEMA.GLOBAL_STATUS;
+----------+
| count(*) |
+----------+
|      516 |
+----------+
1 row in set (0.01 sec)

MariaDB [(safirdepo)]> select count(*) from INFORMATION_SCHEMA.SESSION_STATUS;
+----------+
| count(*) |
+----------+
|      516 |
+----------+
1 row in set (0.00 sec)

MariaDB [(safirdepo)]> select count(*) from INFORMATION_SCHEMA.SESSION_VARIABLES;
+----------+
| count(*) |
+----------+
|      605 |
+----------+
1 row in set (0.01 sec)

MariaDB [(safirdepo)]> select count(*) from INFORMATION_SCHEMA.GLOBAL_VARIABLES;
+----------+
| count(*) |
+----------+
|      586 |
+----------+
1 row in set (0.00 sec)

Değişkenlerin değerini değiştirmek için set komutundan yararlanıyoruz:

MariaDB [(safirdepo)]> set session SQL_MODE = 'TRADITIONAL';Query OK, 0 rows affected (0.00 sec)

MariaDB [(safirdepo)]> select * from INFORMATION_SCHEMA.SESSION_VARIABLES where variable_name like '%MODE%';
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| VARIABLE_NAME            | VARIABLE_VALUE                                                                                                                                       |
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| WSREP_GTID_MODE          | OFF                                                                                                                                                  |
| SQL_MODE                 | STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
| INNODB_STRICT_MODE       | OFF                                                                                                                                                  |
| INNODB_AUTOINC_LOCK_MODE | 1                                                                                                                                                    |
| PSEUDO_SLAVE_MODE        | OFF                                                                                                                                                  |
| SLAVE_DDL_EXEC_MODE      | IDEMPOTENT                                                                                                                                           |
| SLAVE_EXEC_MODE          | STRICT                                                                                                                                               |
| GTID_STRICT_MODE         | OFF                                                                                                                                                  |
| OLD_MODE                 |                                                                                                                                                      |
| SLAVE_PARALLEL_MODE      | conservative                                                                                                                                         |
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
10 rows in set (0.00 sec)

MariaDB [(safirdepo)]> set session SQL_MODE = 'TRADITIONAL';Query OK, 0 rows affected (0.00 sec)

MariaDB [(safirdepo)]> select @@SQL_MODE;
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| @@SQL_MODE                                                                                                                                           |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [(safirdepo)]> select @@session.SQL_MODE;
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| @@session.SQL_MODE                                                                                                                                   |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

MariaDB [(nsafirdepoone)]> select @@global.SQL_MODE;
+--------------------------------------------+
| @@global.SQL_MODE                          |
+--------------------------------------------+
| NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+--------------------------------------------+
1 row in set (0.01 sec)

Değişkenlerin bir kısmını canlı sistemde değiştirmek mümkün değildir:
mysql> set global innodb_log_file_size=5000;

ERROR 1238 (HY000): Variable 'innodb_log_file_size' is a read only variable

Üretim ortamında tavsiye etmemekle beraber değişkenlerin bazıları doğrudan bellek gözüne erişerek değiştirmek mümkündür. Aşağıdaki örnekte tüm bağlantıların dolu olduğu bir MySQL sunucusunda GNU hata ayıklayıcısı (=debugger) kullanılarak max_connections değişkeni değiştiriliyor:

[centos@server1 ~]$ mysql -uroot -proot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.11-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show global variables like 'max_c%';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| max_connect_errors | 100   |
| max_connections    | 151   |
+--------------------+-------+
2 rows in set (0.00 sec)

MariaDB [(none)]> exit
Bye
[centos@server1 ~]$ sudo gdb -p 1269 -ex "set max_connections=4096" -batch
[sudo] password for centos: 
[New LWP 1444]
[New LWP 1443]
[New LWP 1442]
[New LWP 1441]
[New LWP 1440]
[New LWP 1439]
[New LWP 1438]
[New LWP 1436]
[New LWP 1435]
[New LWP 1434]
[New LWP 1433]
[New LWP 1432]
[New LWP 1405]
[New LWP 1404]
[New LWP 1403]
[New LWP 1402]
[New LWP 1401]
[New LWP 1400]
[New LWP 1399]
[New LWP 1398]
[New LWP 1397]
[New LWP 1396]
[New LWP 1367]
[New LWP 1314]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007f71a9ea464d in poll () from /lib64/libc.so.6
[centos@server1 ~]$ mysql -uroot -proot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.11-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show global variables like 'max_c%';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| max_connect_errors | 100   |
| max_connections    | 4096  |
+--------------------+-------+
2 rows in set (0.00 sec)

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