GCC upgrade under Linux

Source: Internet
Author: User
Tags bz2 gmp

As the company's boss has recently arranged to upgrade GCC, so we have to tidy up this document, hoping to some friends have some help

1 Installing gmp4.3.2


Tar jxvf gmp-4.3.2.tar.bz2


mkdir/usr/local/gmp-4.3.2


cd/usr/local/gmp-4.3.2


/opt/gmp-4.3.2/configure--prefix=/usr/local/gmp-4.3.2


Make && make install


2 Installing mpfr2.4.2


Tar jxvf mpfr2.4.2.tar.bz2


mkdir/usr/local/mpfr-2.4.2


cd/usr/local/mpfr-2.4.2


/opt/mpfr-2.4.2/configure--prefix=/usr/local/mpfr-2.4.2--with-gmp=/usr/local/gmp-4.3.2

Make && make install

3 Installing mpc0.8.1


Tar jxvf gmpc0.8.1.tar.bz2


mkdir/usr/local/mpc-0.8.1


cd/usr/local/mpc-0.8.1


/opt/mpc-0.8.1/configure--prefix=/usr/local/mpc-0.8.1--with-gmp=/usr/local/gmp-4.3.2--with-mpfr=/usr/local/ mpfr-2.4.2

Make && make install


4 Installing the GCC configuration installation options


Put gcc-4.6.1.tar.bz2 into the/opt folder to extract


Cd/opt


Tar xjvf gcc-4.6.1.tar.bz2


Create the installation directory


Mkdir/usr/local/gcc-4.6.1/


Go to the installation directory


Cd/usr/local/gcc-4.6.1/


Configuring installation files


/opt/gcc-4.6.1/configure--prefix=/usr/local/gcc-4.6.1-enable-threads=posix-disable-checking-disable-multilib- enable-languages=c,c++--with-gmp=/usr/local/gmp-4.3.2--with-mpfr=/usr/local/mpfr-2.4.2--with-mpc=/usr/local/ mpc-0.8.1


Compiling the installation files


Make


The first error occurred in about more than 10 minutes.


The second error appears:


/usr/local/gcc-4.6.1/i686-pc-linux-gnu/libgcc/config.log


Ctrl+f Find error found below


/----------------------------------------------------------------------------------


/usr/local/gcc-4.6.1/./gcc/cc1:error while loading shared libraries:libmpc.so.2:cannot open shared object File:no such File or directory


configure:3058: $? = 1


----------------------------------------------------------------------------------/


Find a workaround on the web, you need to add the environment variable Ld_library_path to indicate the location of the previous three libraries, type the following command:


Export Ld_library_path= $LD _library_path:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2 /lib


Compiled again about three hours after the success






5 performing the installation of GCC


Make install




If not, then the installation should be successful now, but the new version of GCC is still not available because the new version of GCC has not been added to the command search path!


8. Create a soft link


sudo ln-s/usr/local/gcc-4.6.1/bin/gcc gcc461


sudo ln-s/usr/local/gcc-4.6.1/bin/g++ g++461


9. Add Environment variables


Open the BASHRC file in the/etc directory to add the following code:


ld_library_path=:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2/lib:/usr/local/ Gcc-4.6.1/lib


Export Ld_library_path


The above is the GCC upgrade process, we do the basic one step to get it done. There is a need to install the package can send me e-mail [email protected]


This article is from the "Zhanghe" blog, make sure to keep this source http://9206668.blog.51cto.com/9196668/1532555

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.