Miscellaneous: GCC upgrades under Linux

Source: Internet
Author: User

The company requires that some tests be carried out under the CentOS6.5 system. Since some of the new features of c++11 are used in the written test program, and the GCC version installed in CentOS6.5 is 4.4.7, does not support c++11, so you need to upgrade GCC, note the upgrade process, this upgrade process requires the use of root permissions, Therefore, the installation needs to switch to the root user.

1. Preparatory work

Because the upgrade process requires the use of g++, and the CentOS system does not have a default installation g++, so need to install manually, terminal execution "Yum install gcc-c++", and then need to install Flex, or the subsequent GCC installation process will be error.

2. Get the GCC installation package

The installation package for GCC is acquired and can be downloaded from GitHub with the required installation package: Https://github.com/gcc-mirror/gcc/releases. Here take gcc6.4 as an example.

3. Decompression

There are two types of compression packages available in the previous URL: Zip package and tar.gz.

Zip Package decompression: Unzip Gcc*.zip

tar.gz Package Decompression: TAR-ZXVF gcc*.tar.gz

4. Installation

(1) After decompression into the directory, run "./contrib/download_prerequisites". This gcc-provided script can help us to download and configure the dependent libraries, which can save us a lot of time and effort.

(2) mkdir build && CD Build

(3).. /configure--enable-checking=release--enable-languages=c,c++--disable-multilib

(4) Compile: Make this step depends on the actual environment, the time is different, this step I spent nearly 1.5 hours

(5) Installation: Make install this step and the previous step are very time consuming, for a total of nearly three hours.

5. Verification:

gcc-v, if the GCC version shown is still a previous version, you will need to restart the system, or use "which gcc" before executing the " /usr/local/bin/gcc-v ", if shown below, proves the installation was successful. (The GCC version should show "GCC version 6.4.0 (gcc)", which I cut from my own machine)

Note: Although installed under CentOS6.5, the installation process also applies to other distributions of Linux.

Miscellaneous: GCC upgrades under Linux

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.