Compile and install GCC, compile and install gcc

Source: Internet
Author: User

[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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.