CentOS 6.6 source code compilation and upgrading GCC to 4.8.2

Source: Internet
Author: User

CentOS 6.6 source code compilation and upgrading GCC to 4.8.2
Prerequisites

At least one available gcc compiler is required for source code compilation.

You can use yum for automatic installation or manually download the rpm package for installation.

You can see through yum that at least the following installation packages are required, so you can search and download the corresponding rpm packages in many rpm package sites, but the version is correct, this yum search version is for 4.4.7. For this reason, you need to find the corresponding dependent packages for any version of gcc. The current rpm site will describe the software packages that the software package depends on and which software packages are dependent on, which is very convenient, but it is still time-consuming to find them.

CentOS 6.6 compilation and installation GCC4.8.2

Download the gcc4.8.2 source code package

1 curl -O ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.gz;

First, you need to download the gcc installation dependent on the MCM, mpfr, and gmp packages. gcc comes with a script to help us download and build a link for gcc compilation, you can also download the dependent package by yourself.

1 tar zxf gcc-4.8.2.tar.gz2 cd gcc-4.8.2 3 ./contrib/download_prerequisites

Open download_prerequisites and you can see that it downloads three packages first. When the script is found to be stuck in the download area, it may be inaccessible. This is why you need to find a new one, the method is simple. You can find a lot of google file names.

Start gcc Compilation

mkdir gcc-build-4.8.2cd gcc-build-4.8.2../configure -enable-checking=release -enable-languages=c,c++ -disable-multilibmakemake install

If the gcc-v version remains unchanged after installation, run the following STARTUP script.

1 source /etc/profile2 source ~/.bash_profile
Problems after installation

After the installation, although the gcc g ++ c ++ and other versions are updated to 4.8.2, there are at least two versions of gcc in the computer.

Whereis or where can see multiple gcc files. The which command can see that the command gcc corresponds to usr/local/bin/gcc, while the original gcc execution file is in/usr/bin/gcc, run/usr/bin/gcc-v and you can see that the gcc version is still 4.4. Although this is not a problem, however, some shell scripts or makefiles directly write the absolute path of gcc, so it is very likely that the old gcc version will be used for compilation, resulting in failure. So we still need to overwrite the original gcc. The initial solution was to soft link usr/bin/gcc to usr/local/bin/gcc, and perform similar processing for g ++ and c ++.

This method seems to have solved the problem, but it is always unreliable. It was not found correct until apache thrift was compiled recently. Therefore, whether the installation path can be specified during gcc installation is considered.

Run

1 ./configure --help 

We can see that this option does exist.

Therefore, you only need to add -- prefix =/usr to configure to compile and install gcc under usr.

Linux GCC 4.8.1 clear and concise tutorial (Ubuntu 12.04 64-bit edition as an example)

Compile and install GCC 4.8.1 + GDB 7.6.1 + Eclipse in CentOS 6.4 and compile and install GCC 4.8.1 + GDB 7.6.1 + Eclipse in CentOS 6.4

Install and use Vim + GCC + GDB in Ubuntu

Switch two GCC versions in Ubuntu

CentOS6.5 upgrade to manually install GCC4.8.2

GCC details: click here
GCC: click here

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.