CENTOS6 Manual Compilation Upgrade GCC

Source: Internet
Author: User

Recently tried a variety of fedora, Ubuntu, mint, Debian, openSUSE and many other Linux distributions, compared to CentOS after the feeling is familiar with the previous CentOS, compare habits. CentOS now the latest version of CentOS7, due to the laboratory computer is older, on this 64-bit system a bit card, so can only back and beg the second, with this CentOS6.6 ...

The version of the GCC tool that comes with CentOS is 4.4.7, which, like the Linux kernel for CentOS6, belongs to the antique-level version. This version of the C++11 support is not friendly, the idea of upgrading GCC, but with Yum update gcc but not the new version of GCC detected. Want to use a high version of GCC, and no conditions to upgrade the system, helpless, can only choose to manually install the latest version of the old version of GCC.

1. First, download the GCC you want to install from the following Web site:

http://ftp.gnu.org/gnu/gcc/

Now that the latest version of GCC is gcc-5.3, in view of the habit, or do not like the latest version of the software, downloaded the gcc-4.9.3.

2. Unzip the file: Tar xjvf gcc-4.9.3.tar.bz2

3. Go to the extracted directory and execute the following command:

./contrib/download_prerequisites

Because the new version of GCC needs to be updated with a variety of dependent libraries and configurations, if manual download is really troublesome, and there are many problems, so the GCC developers provide us with a configuration script, as long as the implementation, you can automatically download the required files. You can vim the contents of the file, mainly to download a variety of dependency packages.

4. In order to store intermediate files generated during compilation, we set up a folder to hold these files and execute the commands:

mkdir gcc-build-4.9.3

5. Enter the folder and execute the following command to generate the makefile file:

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

Note that the first is: /rather than./!

6. After the command is complete, the new version of GCC can be compiled, execute make command, wait, the process according to the different machine configuration, wait for the same time, on my computer for nearly 2 hours of running ....

If your computer is a multi-core computer and you want to increase the speed of compilation, you can perform MAKE-JX. where x is the number of cores of your CPU. However, this can cause errors, and if errors occur, make it directly ...

7. The compilation is complete, it can be installed, execute the Make install command, wait for the installation to complete

8. After the installation is complete, reboot, gcc-v to view the version, and discover that the new GCC is in effect. Write a small program to verify that if the c++11 feature is called in the program, the compile-time option needs to be added:

g++ -std=c++11 test.cpp-o test


This article is from the "_ Conan conan_" blog, please be sure to keep this source http://goodhx.blog.51cto.com/9727085/1733814

CENTOS6 Manual Compilation Upgrade GCC

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.