CentOS 6.3 Upgrade GCC and GDB

Source: Internet
Author: User
Tags bz2 gmp posix

First, installation environment

System version: centos6.3 X64

Original GCC version: gcc-4.4.7

New GCC version: gcc-4.8.3

Original GDB version: Gdb-7.2-75.el6

New GDB version: gdb-7.6.1


Second, the official installation

1. Download and install the source code:

You need to download the following packages: gdb-7.6.1 gcc-4.6.1.tar.bz2 gmp-4.3.2.tar.bz2 mpc-0.8.1.tar.gz mpfr-2.4.2.tar.bz2

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2

wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.3/gcc-4.8.3.tar.bz2

wget http://ftp.gnu.org/gnu/gdb/gdb-7.6.1.tar.bz2


2, decompression and installation of GCC: Installation sequencing: GMP, MPFR, MPC, GCC

Installation of GMP:

Tar jxf gmp-4.3.2.tar.bz2

CD GMP-4.3.2/

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

Make && make install


Install MPFR:

Cd.. /

Tar jxf mpfr-2.4.2.tar.bz2

CD MPFR-2.4.2/

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

Make && make install


To install the MPC:

Cd.. /

Tar xzf mpc-0.8.1.tar.gz

CD mpc-0.8.1

./CONFIGURE–PREFIX=/USR/LOCAL/MPC--WITH-MPFR=/USR/LOCAL/MPFR--with-gmp=/usr/local/gmp

Make && make install


Install GCC: (Note: You can also omit the steps above to use GCC to bring your own script.)/contrib/download_prerequisites Auto Correlation GMP,MPFR,MPC)

Cd.. /

Tar jxf gcc-4.8.3.tar.bz2

CD gcc-4.8.3

./configure--PREFIX=/USR/LOCAL/GCC--enable-threads=posix--disable-checking--disable-multilib--enable-languages =c,c++--with-gmp=/usr/local/gmp--with-mpfr=/usr/local/mpfr/--with-mpc=/usr/local/mpc/


If executed./contrib/download_prerequisites, direct./configure--PREFIX=/USR/LOCAL/GCC--enable-threads=posix-- Disable-checking--disable-multilib--enable-languages=c,c++ can


If execution continues error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+

Workaround:

1. Setting Environment variables

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

Re-unzip gmp-4.3.2.tar.bz2 mpc-0.8.1.tar.gz mpfr-2.4.2.tar.bz2 three files and rename it to GMP, MPC, MPFR Copy to gcc-4.8.3 and re-execute

./configure--PREFIX=/USR/LOCAL/GCC--enable-threads=posix--disable-checking--disable-multilib--enable-languages =c,c++

Continue execution:

Make && make install//it takes a long time

3. Unzip and install GDB

Cd.. /

Tar jxf gdb-7.6.1.tar.bz2

CD gdb-7.6.1

./configure

Make && make install

Period Error: Configure:error:no termcap Library found

Compile and install termcap directly

Download Link: http://download.csdn.net/detail/hxl_c0s0d0n/4359422

Installation is complete! And then make a link to use GCC.

Mkdir-p/data/backup/' Date +%y%m%d '

mv/usr/bin/{gcc,g++}/data/backup/' Date +%y%m%d '

New Soft Link:

Ln-s/USR/LOCAL/GCC/BIN/GCC/USR/BIN/GCC

Ln-s/usr/local/gcc/bin/g++/usr/bin/g++


Third, testing gcc and GDB

Direct input gcc-v, gdb-v can see the GCC version of 4.8.3, gdb version of 7.6.1 and related compilation parameters is OK!


CentOS 6.3 Upgrade GCC and GDB

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.