Building SAGE 4.1.1 on Fedora 11

While building SAGE 4.1.1 on a AMD Phenom II running Fedora 11, GCC 4.4.1 will hang the machine when compiling “base3.c” of PARI. Apparently it was sucking up all the available memory.

According to this thread, it happens on Ubuntu 9.10 too and the solution is to compile with -O1 instead of -O3 optimization. Unfortunately it wasn’t obvious (to me, at least) how to make GCC use -O1 specifically for PARI only.

Digging around in SAGE’s build system, I figured it could be done by repacking the PARI spkg with a modified “get_cc” script:

cd sage-4.1.1/spkg/standard
tar jxf pari-2.3.3.p1.spkg
sed 's/OPTFLAGS=-O3/OPTFLAGS=-O1/g' \
  pari-2.3.3.p1/src/config/get_cc > get_cc
mv get_cc pari-2.3.3.p1/src/config/get_cc
mv pari-2.3.3.p1.spkg pari-2.3.3.p1.spkg.orig
tar jcf pari-2.3.3.p1.spkg pari-2.3.3.p1

After that, I was able to compile SAGE using its standard build procedure. Admittedly this is a quick hack. A better solution may be to set OPTFLAGS according to the version of GCC used.

Updates: According to this thread, it is fixed in Ubuntu Karmic.

Posted in hacks. Tags: , , . 2 Comments »