[Switch] compile and install GCC, compile and install gcc
Compiling C/C ++ programs in Linux naturally lacks an excellent compiler, and GCC is a common tool in Linux.
In 2015, GCC also came out of version 5.2.0, providing better support for C ++ 11/14.
So today we will talk about the GCC compilation and installation. The installed version is the latest version 5.2.0.
Next let's go to the topic (we suggest using the root user throughout the process ):
1. Download the GCC source code:
Https://gcc.gnu.org/mirrors.html
2. decompress:
Tar-zxvf gcc-* .tar.gz
3. download the required dependencies for compilation:
Cd gcc-* // enter the gcc folder after unpacking
./Contrib/download_prerequisites // download Dependencies
Cd .. // return to the upper directory
4. Create a compilation output directory:
Mkdir gcc-build -*
5. Enter the output directory, execute the following command, and generate the makefile file:
Cd gcc-build -*
../Gcc-*/configure -- enable-checking = release -- enable-extensions ages = 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. Note that the remaining space in the current directory must be at least 4 GB during compilation; otherwise, compilation will fail.
7. installation:
Make install
8. Check the version:
Gcc -- version or gcc-v