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

David Jones david.jones74 at gmail.com
Thu Dec 12 14:40:06 EST 2013


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"
>>
>> It get's the compile flags right, but not the linker:
>>
>> C compiler: gcc -pthread -fno-strict-aliasing -g -O2 -m32 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC
>> compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -I/opt/python/ia32/include/python2.7 -c'
>> gcc: _configtest.c
>> gcc -pthread _configtest.o -o _configtest
>> _configtest.o: could not read symbols: File in wrong format
>> collect2: ld returned 1 exit status
>>
>> I'm bulding it using a 32bit python build that I compiled on the same system.
>>
>> I tried:
>>
>>     OPT="-m32" FOPT="-m32" python setup.py build
>>
>> and
>>
>>     setarch x86_64 -B python setup.py build
>>
>> But with the same results.
>>
>>
>> Someone worked around this by altering ccompiler.py, but I'm trying to find a cleaner solution.
>>
>> See:http://stackoverflow.com/questions/11265057/how-do-i-install-a-32-bit-version-of-numpy
>>
>> Is there a standard way of doing this?
>>
> this might work:
>
> CC="gcc -m32" LDSHARED="gcc -m32" FF="gfortran -m32" linux32 python
> setup.py build
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

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:

build/temp.linux-i686-2.7/numpy/linalg/lapack_litemodule.o: could not 
read symbols: File in wrong format
collect2: ld returned 1 exit status
build/temp.linux-i686-2.7/numpy/linalg/lapack_litemodule.o: could not 
read symbols: File in wrong format
collect2: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -Wall -shared 
build/temp.linux-i686-2.7/numpy/linalg/lapack_litemodule.o 
build/temp.linux-i686-2.7/numpy/linalg/lapack_lite/python_xerbla.o 
-L/usr/lib/atlas -L/opt/python/ia32/lib -Lbuild/temp.linux-i686-2.7 
-llapack -lptf77blas -lptcblas -latlas -lpython2.7 -lgfortran -o 
build/lib.linux-i686-2.7/numpy/linalg/lapack_lite.so" failed with exit 
status 1

What build options does numpy recognize? The docs ony mention CC, OPT, 
and FOPT, but don't give any details on how to use them. Can you pass 
something to setup.py?




More information about the NumPy-Discussion mailing list