Ubuntu11.04 install GCC4.6.1

Source: Internet
Author: User
Tags gmp
First download the source code: Release

First download the source code:
Ftp://ftp.dti.ad.jp/pub/lang/gcc/releases/gcc-4.6.1/
# Download gcc-4.6.1.tar.bz2

Ftp://ftp.dti.ad.jp/pub/lang/gcc/infrastructure/
# Download gmp-4.3.2.tar.bz2 mpfr-2.4.2.tar.bz2 mpc-0.8.1.tar.gz

Step 0:

123
$sudo apt-get install build-essential$sudo apt-get install zlibc$sudo apt-get install zlib1g-dev

Step 1: Install gmp-4.3.2

1234
#cd to src_dir$./configure --prefix=/usr/local/gmp-4.3.2$make$sudo make install

Step 2: Install mpfr-2.4.2

1234
#cd to src_dir$./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2$make$sudo make install

Step 3: Install mpc-0.8.1

1234
#cd to src_dir$./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$sudo make install

Step 4: Install gcc-4.6.0

12345
$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#cd to src_dir$./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$make$sudo make install

Step 5: Multi-version support
To enable Ubuntu to support multiple gcc versions, you need to make the following settings:

1234
$SudoUpdate-alternatives-- Install /Usr/Bin/Gcc Gcc /Usr/Bin/Gcc-4.5 40$SudoUpdate-alternatives-- Install /Usr/Bin/Gcc Gcc /Usr/Local/Gcc-4.6.1/Bin/Gcc 60# Select the desired version$ SudoUpdate-alternatives-- Config Gcc

Step 6: Add a new shared library
In order to use the latest shared library during software compilation

1
$sudo vim /etc/ld.so.conf.d/x86_64-linux-gnu.conf

Add the following content
/Usr/local/gcc-4.6.1/lib64/
Save and execute. Update the shared library.

1
$sudo ldconfig

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.