GCC 4.8.2 Compile Installation small note

Source: Internet
Author: User
Tags gmp centos

Never upgraded GCC before, with the system's default version of GCC, recently in the study for a long time no use of C, there will be upgraded GCC want to send, roughly as follows.

Environment: CENTOS-6.5-I386, the gcc-4.4.7 system must already have a compiler installed, because GCC is also required to compile the

First, GCC compilation requires three additional libraries to download and install them in the following order:
1. GMP FTP://FTP.GNU.ORG/GNU/GMP
2. MPFR FTP://FTP.GNU.ORG/GNU/MPFR
3. MPC HTTP://WWW.MULTIPRECISION.ORG/MPC

1. Compile and install GMP
# TAR-ZXVF Gmp-5.1.3.tar.gz
# CD gmp-5.1.3
#./configure
# Make && make install

2. Compile and install MPFR
# TAR-ZXVF Mpfr-3.1.2.tar.gz
# CD mpfr-3.1.2
#./configure
# Make && make install

3. Compile and install the MPC
# TAR-ZXVF Mpc-1.0.tar.gz
# CD mpc-1.0
#./configure
# Make && make install

4. Copy or make a soft link to the following dynamic link library file under/lib, because there may not be a shared library file for the above three dependent libraries when you compile and install GCC
/usr/local/lib/libmpc.so
/usr/local/lib/libmpc.so.3
/usr/local/lib/libmpfr.so
/usr/local/lib/libmpfr.so.4
/usr/local/lib/libgmp.so
/usr/local/lib/libgmp.so.10

4. Compile and install GCC
GCC Compilation Parameters Description:
--prefix//default GCC installation directory, CentOS-6.5 under the best installation to/usr below, otherwise there may be a problem
--enable-languages//Specifies which languages the GCC can compile, each language separated by commas, such as C,c++,java
--disable-multilib//default GCC compiles code into a 64-bit program on a 32-bit system, or a 32-bit program on a 64-bit system, and if you add this compilation option, turns off this GCC's cross-compilation feature.

# TAR-ZXVF Gcc-4.8.2.tar.gz
# CD gcc-4.8.2
# mkdir Build
# CD Build
# .. /configure--PREFIX=/USR
# Make && make install

Note:  when the GMP, MPFR, MPC is compiled to customize the specified installation path, you need to add the following options when compiling GCC:
--WITH-MPC=MPC installation directory
--WITH-MPFR=MPFR install directory
--with-gmp=gmp installation directory

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.