[GCC] gcc 4.6.0 installation instructions

Source: Internet
Author: User
Tags gmp

 

The operating system is redhat x86_64.

Prepare the gcc source code package

Gcc-4.6.0.tar.bz2
Http://gcc.gnu.org or
Ftp://gcc.gnu.org

 

First, prepare three databases, all of which are high-precision big data computing databases.

Gmp-5.0.2 or higher
Http://gmplib.org/

Mpc-0.9 or higher
Http://www.multiprecision.org/index.php? Prog = nmpc

Mpfr-3.0.1 or higher
Http://www.mpfr.org

 

Decompress the downloaded package. If bz2 is used, use tar-xvjf. If gz is used, use tar.
-Xvzf: assume that all the installation packages are downloaded under/home/gogdi.pdf.

cd /home/gogdizzytar -xvjf gmp-5.0.2.tar.bz2 tar -xvjf mpfr-3.0.1.tar.bz2 tar -xvzf mpc-0.9.tar.gztar -xvjf gcc-4.6.0.tar.bz2

 

Since the MCM depends on gmp and mpfr, the final processing is done.

Install gmp Library

 

cd gmp-5.0.2./configure --prefix=/usr/local/lib/gmp-5.0.2/make && make install

Install the mpfr Library

cd ../mpfr-3.0.1./configure --prefix=/usr/local/lib/mpfr-3.0.1/make && make install

Install the mpc Library

cd ../mpc-0.9./configure --prefix=/usr/local/lib/mpc-0.9/ --with-mpfr=/usr/local/lib/mpfr-3.0.1/ --with-gmp=/usr/local/lib/gmp-5.0.2/make && make install

Configure the path of these three libraries (/etc/ld. so. conf content isInclude lD. So. conf. d/*. conf,So we add a file in ld. so. conf. d)

cd /etc/ld.so.conf.dcat >gcc-4.6.0.conf <<EXIT> /usr/local/lib/gmp-5.0.2/lib> /usr/local/lib/mpfr-3.0.1/lib> /usr/local/lib/mpc-0.9/lib> EXITldconfig

 

In this way, the path is compiled into/etc/ld. so. cache, which will be used in future program compilation and connection.

The following compilation and installation of gcc-4.6.0, due to the long compilation, and may be due to poor configuration, compilation failed, so to create a new folder to save the compilation results, once the compilation fails, it will directly RM all the compilation results, reconfigure.

Compilation configuration options are numerous, detailed introduction (http://gcc.gnu.org/install/configure.html ):

cd /home/gogdizzymkdir gcc-4.6.0-buildcd gcc-4.6.0-build../gcc-4.6.0/configure --prefix=/usr/lib/gcc/x86_64-redhat-linux/4.6.0/ --with-gmp=/usr/local/lib/gmp-5.0.2/ --with-mpfr=/usr/local/lib/mpfr-3.0.1/ --with-mpc=/usr/local/lib/mpc-0.9/ --mandir=/usr/sharegcc-4.6.0/man --infodir=/usr/share/gcc-4.6.0/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,go --disable-dssi --enable-plugin --with-cpu=genericmake && make install

(I specified -- Host = x86_64-redhat-linux compiled to half of the error, a variable can not enumerate the error, and then simply do not specify the host, the default is the x86_64-unknown-linux, but compiled successfully.

 

Enter gcc-V to check whether it is in the old version. This is because/usr/bin/GCC is called by default, while we install in fact/usr/lib/GCC/x86_64-redhat-linux/4.6.0/, in order to use the new GCC compiler. Need to re-build a soft chain for GCC

cd /usr/bin/mv gcc gcc.bakmv g++ g++.bakln -s /usr/lib/gcc/x86_64-redhat-linux/4.6.0/bin/gcc gccln -s /usr/lib/gcc/x86_64-redhat-linux/4.6.0/bin/g++ g++

 

At this time, run gcc-V and find that it is a new version. if you write a CPP program, the compilation is normal. However, problems may occur during the running. Because the runtime involves the dynamic library libstdc ++. so.6, it will be searched in/usr/lib or/usr/lib64 by default. However, the old library is here and the version does not match. Update the new database.

cd /usr/lib/gcc/x86_64-redhat-linux/4.6.0/libmv ./* /usr/libcd /usr/lib/gcc/x86_64-redhat-linux/4.6.0/lib64mv ./* /usr/lib64

 

Now, the operation is successful, but the subsequent operations for replacing lib are all tested by myself. I do not know whether it is comprehensive or reliable. If I want to restore the old version, you need to back up files of the same name under/usr/lib and/usr/lib64 first!

 

 

Reference:

Http://www.linuxidc.com/Linux/2011-05/35364.htm

 

 

 

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.