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

David Jones david.jones74 at gmail.com
Fri Dec 13 08:38:47 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:
>>
>
> 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 "$@"
> EOF
> ...
> CC=gcc-32 ....

No luck. Here are my results:

bash~$ CC=gcc-32 LDSHARED=ld-32 LDFLAGS="-m32 -shared" linux32 python2.7 
setup.py build

/home/build/bin/ld-32: line 1: !/bin/sh: No such file or directory
/usr/bin/ld: cannot find -lpython2.7
collect2: ld returned 1 exit status
/home/build/bin/ld-32: line 1: !/bin/sh: No such file or directory
/usr/bin/ld: cannot find -lpython2.7
collect2: ld returned 1 exit status
error: Command "ld-32 -m32 -shared 
build/temp.linux-i686-2.7/numpy/core/src/dummymodule.o -L. 
-Lbuild/temp.linux-i686-2.7 -lm -lpython2.7 -o 
build/lib.linux-i686-2.7/numpy/core/_dummy.so" failed with exit status 1

This makes no sense to me. The linker is set to 32 bit. My python 
library path is 32 bit. I know it can find the library, or the build 
wouldn't have even started.
>
> _______________________________________________
> 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