Build gcc 4.5.X from scratch on Ubuntu

First of all just as anywhere else mentions, you need GMPMPFR andMPC to compile gcc. But these are not enough, you will need PPL,CLOOG and libelf too. You might try these to get from debian/ubuntu repositories but you may not be able to find them. Even if you do, you may not be able to install because of the same dependency conflicts.

You really can try to grab it from ubuntu repo if you are lucky and can find the exact version you are looking for as follow:

$ sudo apt-get install gcc-4.5 g++-4.5
$ ln -s /usr/bin/gcc-4.5 /usr/bin/gcc
$ ln -s /usr/bin/g++-4.5 /usr/bin/g++

If you can’t find exact version, just got for the manual way which I prefer:

I compiled all of them manually and here are the versions used:

  • gmp-5.0.1
  • mpc-0.9
  • mpfr-3.0.0
  • ppl-0.11.1
  • cloog-ppl-0.15.10
  • libelf-0.8.13
  • and of course gcc-4.5.2

Any of those require any other library than the ones in the list, i installed using apt. After ./configure && make && make installing all dependencies i did those to get a build.

mkdir gcc-build
cd gcc-build
../gcc-4.5.2/./configure --disable-ppl-version-check --enable-languages=c,c++
make -j3
make install

Creating a dir like gcc-build and building there is the preferred way of doing things, but docs say doing a build in the same directory as sources may yield unexpected results.


One thought on “Build gcc 4.5.X from scratch on Ubuntu

  1. Pingback: Build Barrelfish operating system from scratch “Development Environment on Ubuntu 12.04 LTS” | Abdel Rahman Hegazi

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s