Building GCC 4.7.2 for Rocks Cluster

Its was not easy, but here were the basic steps I used. First and foremost read the prerequisites, both online and within the documentation that comes with the tarball. They really should update the website. Download the following, first from gcc’s infrastructure ftp site, cloog-0.17, isl-.10, and ppl-0.11. Then from their respective sites, download, gmp, mpfr, and mpc. Then finally the latest gcc source tarball.

I use the following blog post as my starting point, also checking the spec files from RedHat rpms to get an idea of ‘standard’ config options. I setup the following environment:

  • I create a folder where I’ll be doing all this work in, I like to call it workshop
  • Download all my source packages into workshop and then make another directory, builds, to hold the final results of each built package. So builds/gmp, builds/mpfr, etc
  • Also to keep from contaminating the source and for simple cleanup when I had to redo a build, always create a separate folder within a source package’s directory to build in. Its just good practice to do so.

First off, gmp:
tar -jxf gmp-5.0.5.tar.bz2
cd gmp-5.0.5
mkdir build
../configure --prefix=/opt/hpc/gcc --build=x86_64-linux-gnu --enable-mpbsd --enable-cxx

As I plan on building the Graphite extensions, the --enable-cxx is important

For mpfr:
../configure --prefix=/opt/hpc/gcc --build=x86_64-linux-gnu --disable-assert --with-gmp=/opt/hpc/gcc

for mpc:
../configure --prefix=/opt/hpc/gcc --build=x86_64-linux-gnu --with-gmp=/opt/hpc/gcc --with-mpfr=/opt/hpc/gcc

Now while they have moved on from using PPL within Cloog, its still needed to compile gcc

for ppl:
../configure --prefix=/opt/hpc/gcc --build=x86_64-linux-gnu --enable-shared --disable-rpath --with-gmp-prefix=/opt/hpc/gcc

for isl
../configure --prefix=/opt/hpc/gcc --build=x86_64-linux-gnu --with-gmp-prefix=/opt/hpc/gcc

for cloog:
../configure --prefix=/opt/hpc/gcc --build=x86_64-linux-gnu --with-gmp=system --with-gmp-prefix=/opt/hpc/gcc --with-isl=system --with-isl-prefix=/opt/hpc/gcc --with-isl-exec-prefix=/opt/hpc/gcc --with-bits=gmp

Here the --with-bits=gmp is specified in the GCC Prereq’s page

Finally GCC, but there is a small ‘bug’ that keeps it from using Cloog 0.17. Simply edit the configure script and replace the version number it is looking for(0.16.1) with 0.17.0. There is a patch. Also read the included docs to know to include this option: --enable-cloog-backend=isl

I then also used this post, along with checking the spec file for various config options. One warning, do not use --enable-gnu-unique-object unless you are running the latest glibc and gnu assembler, or else make will error out. Also I included LD_LIBRARY_PATH or else compilation of libgcc fails as it will complain it cannot find the shared libraries.

for gcc:
LD_LIBRARY_PATH=/opt/hpc/gcc/lib ../configure --prefix=/opt/hpc/gcc --build=x86_64-inux-gnu --with-gmp=/opt/hpc/gcc --with-mpfr=/opt/hpc/gcc --with-mpc=/opt/hpc/gcc --with-ppl=/opt/hpc/gcc --with-cloog=/opt/hpc/gcc --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-tls --enable-libgomp --disable-nls --with-fpmath=sse --enable-cloog-backend=isl --enable-languages=c,c++,objc,obj-c++,fortran

While I did install where I wanted them to go, for packaging reasons I used make install DESTDIR=/path/to/builds/packageName to separate each package. I then use rocks create package to build individual rpms for each.


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