Building gcc from subversion on Ubuntu/x86_64

Ubuntu makes more or less everything Linux-related easier. Nonetheless, there are a few steps one needs to go through to build the absolute latest gcc on a stock 64-bit Ubuntu 10.10 install.

  1. For a full-fledged compiler that can generate both 32-bit and 64-bit code, the 32-bit libraries are also required. Some of the dependencies also need a C++ compiler.
  2. sudo apt-get install g++ ia32-libs libc6-dev-i386

  3. gcc has a number of dependencies less usual dependencies as well. Some of these are in the Ubuntu repositories.

    sudo apt-get install m4 flex bison libmpfr-dev libmpc-dev

  4. Install ppl (Parma Polyhedral Library) manually. Unfortunately Ubuntu does not have up-to-date versions of this package, so you have to build it yourself. Make sure to add /usr/local/lib to LD_LIBRARY_PATH or ld.so.conf

    wget -c http://www.cs.unipr.it/ppl/Download/ftp/releases/0.11.1/ppl-0.11.1.tar.bz2
    tar -xjf ppl-0.11.1.tar.bz2
    ./configure
    make
    sudo make install
    sudo echo '/usr/local/lib' > /etc/ld.so.conf.d/local
    sudo ldconfig
    cd ..

  5. Get the gcc source from the subversion repository and build it. It’s about 140MB uncompressed and you’ll need around 500MB for the build itself. Also, I disable java as it slows down the build process tremendously (and I don’t use it).

    svn checkout svn://gcc.gnu.org/svn/gcc/trunk gcc-trunk
    mkdir objdir
    cd objdir
    ../gcc-trunk/configure --enable-languages=c,c++,objc,obj-c++,fortran,lto \
    --with-ppl=/usr/local
    make bootstrap
    sudo make install

Comments are closed.