[Numpy-discussion] building 32 bit numpy on 64 bit linux

David Jones david.jones74 at gmail.com
Fri Dec 13 09:02:35 EST 2013

On 12/12/13 16:35, Julian Taylor wrote:
> On 12.12.2013 20:40, David Jones wrote:
>> On 12/12/13 15:54, Julian Taylor wrote:
>>> On 12.12.2013 19:58, David Jones wrote:
>>>> I'm trying to compile 32-bit numpy on a 64 bit Centos 6 system, but fails with the message:
>>>> "Broken toolchain: cannot link a simple C program"
> ...
>>> this might work:
>>> CC="gcc -m32" LDSHARED="gcc -m32" FF="gfortran -m32" linux32 python
>>> setup.py build
>> That didn't work. It says it can't find executable "gcc -m32". I tried
>> changing ccompiler.py, per the stackoverflow post. I got further that
>> time, but it fails with the message:
So this is what ended of working:

CC=gcc-32 LDSHARED=ld-32 LDFLAGS="-m32 -shared -L$LD_LIBRARY_PATH" 
python2.7 setup.py build

Somehow the value of LD_LIBRARY_PATH gets lost along the way. Perhaps 
distutils re-exports it with a different value, prior to calling the linker.

I was getting a gfortran error at one point, but I guess it inherits 
-m32 from gcc-m32, so it doesn't have to be set explicitly.

I still want to look into the code, to see what's going on in there. I 
may just write a custom config module, that allows me to pass in the 
build flags more cleanly.
> weird it works for me with libpython2.7-dev:i386 installed on amd64
> Ubuntu 13.10 (multiarch is friggin great :D)
> But I had to add an additional LDFLAGS="-m32 -shared"
> CC="gcc -m32" LDSHARED="gcc -m32 -shared" LDFLAGS="-m32 -shared" linux32
> python setup.py build
> you should be able to work around this error message by writing small
> wrapper scripts for the compiler:
> cat << EOF > gcc-32
> #!/bin/sh
> gcc -m32 "$@"
> ...
> CC=gcc-32 ....
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list