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.