Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My gcc compiler is a bit outdated - gcc 4.3, so I want to build a new gcc from source since I ran apt-get update, but there were no pre-built version available yet. Has anyone experienced this process before?

Thanks,
Chan

share|improve this question
    
consider asking in askubuntu.com ... –  akira Jan 22 '11 at 6:22

3 Answers 3

up vote 5 down vote accepted

Install new version of GMP, MPFR, MPC from sources:

curl -O http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.gz
tar zxf gmp-5.0.1.tar.gz
cd gmp-5.0.1/
./configure --prefix=/usr
sudo make install
cd ..

curl -O http://www.mpfr.org/mpfr-current/mpfr-3.0.0.tar.gz
tar zxf mpfr-3.0.0.tar.gz
cd mpfr-3.0.0/
./configure --prefix=/usr
sudo make install
cd ..

curl -O http://www.multiprecision.org/mpc/download/mpc-0.8.2.tar.gz
tar zxf mpc-0.8.2.tar.gz 
cd mpc-0.8.2/
./configure --prefix=/usr
sudo make install
share|improve this answer
    
It is usually a better idea to install these through packages: sudo apt-get build-dep gcc-4.5 –  Etienne Perot Dec 26 '11 at 6:12

You're going to want to download the source packages. You can get the from http://gcc.gnu.org/releases.html

Next you're going to want to install the package build-essentials from apt. Use the following command:

sudo apt-get install build-essential

Next you're going to want to extract the source package to its own directory:

mkdir -p ~/compiling/gcc
cd !$
tar -zxvf ~/path/to/downloaded/gcc-4.5.2.tar.gz
cd gcc-4.5.2

Then you're going to want to compile it, usually the process is as follows:

./configure
make
sudo make install

However, if you omit the last part you can still run the program by calling it directly, while keeping your currently installed version of gcc for normal use.

share|improve this answer

I followed these steps from GNU website and got gcc installed perfectly: http://gcc.gnu.org/install/prerequisites.html

Basically, you will need to install

  • gmp-5.0.1
  • mpc-0.8.2
  • mpfr-3.0.0

and other libraries mentioned can be found under Synaptic Package Manager.

That's all

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.