Linux compiler installation GCC-5.1.0, linux compiler gcc-5.1.0
Linux compiler installation GCC-5.1.0
Compiling C/C ++ programs in Linux naturally lacks an excellent compiler, and GCC is a common tool in Linux. In late April 2015, GCC also came out of version 5.1.0, providing better support for C ++ 11/14. Since I recently studied OpenMP, Gcc-5.1.0 supports the latest OpenMP4.0 version. So today we will talk about GCC compilation and installation. The installed version is the latest version 5.1.0. Next let's go to the topic (we suggest using the root user throughout the process ):
1. Download the GCC source code:
wget ftp://mirrors.kernel.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.gz
2. decompress:
tar -zxvf gcc-5.1.0.tar.gz
3. download the required dependencies for compilation:
Cd gcc-5.1.0 // enter the gcc folder after unpacking./contrib/download_prerequisites // download dependency cd .. // return to the upper directory
4. Create a compilation output directory:
mkdir gcc-build-5.1.0
5. Enter the output directory, execute the following command, and generate the makefile file:
cd gcc-build-5.1.0 ../gcc-5.1.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
6. Compile:
make -j4
The next step is to wait for about 40 minutes. PS: it is best not to do anything in the compilation process. The CPU is fully loaded throughout the process. If it is inexplicably terminated, there will be a lot of troubles in the future.
7. installation:
After compilation, we can execute the installation:
make install
8. Check the version:
Gcc -- version or gcc-v
Root @ ubuntu :~ /Download/gcc-build-5.1.0 $ gcc -- version
Gcc (GCC) 5.1.0
Copyright 2015 Free Software Foundation, Inc.
This program is free software. Please refer to the source code copyright statement. This software has no guarantee;
Includes non-marketable and applicable warranties for a specific purpose.