Ubuntu 11.04 Installing GCC 4.6.1

Source: Internet
Author: User
Tags bz2 gmp

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

Ftp://ftp.dti.ad.jp/pub/lang/gcc/infrastructure/
#下载 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
In order for Ubuntu to support multiple GCC versions, the following settings are required:

1234
$ sudo update-alternatives--install/usr/bin/gcc gcc/usr/bin/gcc-4.5 40$ sudo update-alternatives--install/usr/bin/gc C GCC/USR/LOCAL/GCC-4.6.1/BIN/GCC 60# Select the version you need $sudo update-alternatives--config gcc

Step 6: Add a new version of shared library
In order to compile the software, you can use the latest shared library

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

Add the following:
/usr/local/gcc-4.6.1/lib64/
Save after execution, update shared library

1
$sudo Ldconfig

Ubuntu 11.04 Installing GCC 4.6.1

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.