Install GCC in Linux

Source: Internet
Author: User
Tags gmp

1. First download the GCC package from GNU, ftp://gcc.gnu.org/, which is the latest version of gcc-4.5.1.tat.gz,

1) tar zxvf gcc-4.5.1.tar.gz

2) CD gcc-4.5.1

3)./congigure

The following error occurs:
GCC configure: Error: Building GCC requires GMP 4.2 +, mpfr 2.3.1 + and MCM 0.8.0 +
From the error, we can see that GCC compilation requires GMP, mpfr, the three libraries, which I use for gmp-4.3.2, mpfr-2.4.2, and mpc-0.8.1. These three packages are downloaded from the following address:

Http://gmplib.org/,http://www.mpfr.org/,http://www.multiprecision.org/


2. An error occurs during the installation of GMP:
No usable M4 in $ path or/usr/5bin (see config. log for reasons ).
The M4 file is missing. You can go here to download: http://ftp.gnu.org/gnu/m4. Here I download m4-1.4.1.tar.gz
1) tar zxvf m4-1.4.1.tar.gz
2) CD m4-1.4.1
3)./configure
4) make
5) make check (it is strongly recommended to check to make sure it is correct)
6) make install (root is required. It is recommended to install it in root)

3. You can install other products with M4. Since both mpfr and nmpc depend on GMP packages, GMP is installed first.
1) tar jxvf gmp-4.3.2.tar.bz2
2) CD gmp-4.3.2
3)./configure
4) make
5) make check
6) make install

 

4. Install mpfr
1) tar jxvf mpfr-2.4.2.tar.bz2
2) CD mpfr-2.4.2
3)./configure -- With-GMP-include =/usr/local/include -- With-GMP-Lib =/usr/local/lib
4) make
5) make check
6) make install

V. Install the MPC

1) tar zxvf mpc-0.8.1.tar.gz
2) CD mpc-0.8.1
3)./configure -- With-GMP-include =/usr/local/include -- With-GMP-Lib =/usr/local/lib
4) make
5) ldconfig-V (error while loading shared libraries: libmp Fr. so.1: cannot open shared objec, you can go to man LDD and ldconfig by yourself)
6) make check
7) make install

6. The default locations of these libraries are/usr/local/include and/usr/local/lib. These three libraries may not be found during GCC compilation, check whether the database location is in the environment variable LD_LIBRARY_PATH. To view the environment variable content, run the following command:
$ Echo $ LD_LIBRARY_PATH
The command to set the environment variable is as follows:
$ Export LD_LIBRARY_PATH = "$ LD_LIBRARY_PATH:/usr/local/lib"
Install GCC now
1) tar xvf gcc-4.5.1.tar.gz
2) CD gcc-4.5.1
3)./configure
4) make
5) make check
6) sudo make install

After a long time (I have waited for nearly an hour), the compilation can be completed.

 

 

 

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.