Compiling scipy in 32 bit in a 64 bit environment (el5)

Posted by Johan on Thursday, March 1, 2012

During the last 2 days I’ve been trying to compile an old product in 32 bit mode on a 64 bit Redhat Enterprise Linux 5 environment which should not be that hard.

Python itself is no problem:
TCC=“gcc -m32” ./configure

(got information from here)

And this approach works for almost every 3rd party software, except for Scipy.

Scipy contains a lot of FORTRAN code and it wasn’t obvious how to get to understand that it should both build and link with the -m32 flag.

After a lot of trial and error this is what I used:
F90FLAGS=“-m32” F77FLAGS=“-m32”
LDFLAGS=“-g -Wall -shared -m32 -fPIC”
$PYTHON config_fc –fcompiler=gnu95 install

There is probably other flags that are better but these worked for me, I think the LDFLAGS is what did it since they are used when g77 is linking the FORTRAN code. The flags also worked fine for numpy.

I will try to write more often but I have had a lot to do recently.