Build gcc under CentOS

Source: Internet
Author: User
Tags gmp centos

Since the GCC version required by PHP7 in the compilation process is relatively high, and the GCC version in Wdlinux does not meet the PHP7 compilation requirements, the GCC compilation process is here.

Actually in the process of compiling GCC encountered a lot of pits, this article is used to record the entire process to install gcc download

First come here to find a new version of the GCC source code, you can go to the GCC official website to find the address, here Use this address download, mainly considering the download speed problem
http://gcc.skazkaforyou.com/releases/
I downloaded the 5.3.0 version, this is the latest version under the current date
http://gcc.skazkaforyou.com/releases/gcc-5.3.0/gcc-5.3.0.tar.gz Configuration

You can do it first.

./configure

Execution results

As you can see from the image above, there are a few with options here, and the command will be written as follows

./configure--with-gmp=/usr/local/gmp--WITH-MPFR=/USR/LOCAL/MPFR--WITH-MPC=/USR/LOCAL/MPC

After this, you can skip to install GMP, MPFR, MPC view, if the installation is complete, you can perform the configuration process, just execute the above command, you will get such an error message

Need to close multilib, the new command is as follows

./configure--with-gmp=/usr/local/gmp--WITH-MPFR=/USR/LOCAL/MPFR--WITH-MPC=/USR/LOCAL/MPC--disable-multilib

To perform the configuration process again

Returns creating Makefile indicates that the configuration process was successfully compiled and installed

Make && make install

found that the compilation has not been, a sweat, will prompt the error message to open Config.log view the log, the following tips

"When loading shared Libraries:libmpc.so.3:cannot open Shared object file:no such file or directory".

Therefore, the environment variable Ld_library_path needs to be modified, and the command is

Export Ld_library_path= $LD _library_path:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib

Then execute the compilation process and execute the command after the program compiles.

Source/etc/profile

Re-execute

Gcc-v

View version number

installation of GMP, MPFR, MPC

So where do these paths come from after the equals sign? Here you will need to install these files first download

Gmp
MPFR
MPC Configuration

Because there are dependencies between the various modules, it is necessary to install the GMP, then install the MPFR, and then install the MPC,
The procedures for each configuration are as follows

Gmp

./configure--prefix=/usr/local/gmp

MPFR

./configure--PREFIX=/USR/LOCAL/MPFR--with-gmp=/usr/local/gmp

Mpc

./configure--PREFIX=/USR/LOCAL/MPC--with-gmp=/usr/local/gmp--WITH-MPFR=/USR/LOCAL/MPFR
Compiling and installing

All the compile commands are the same, and the following commands are executed

Make && make install

Note: Before executing the command, make sure that your directory is written in the final source directory for the respective module:

The above compilation process is the continuation of the old version of the installation style, the online access to a number of data and verification found in the gcc4.4 version and the current compiled version of the gcc5.3.0 are contrib/download_prerequisites, so you can omit to download the installation of GMP, MPC,MPFR process, direct execution of commands

/usr/src/gcc-5.3.0/contrib/download_prerequisites

You can complete the installation

Related Article

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.