[SciPy-user] Trying to build scipy 32-bit on a 64-bit machine

David Cournapeau david at ar.media.kyoto-u.ac.jp
Tue Feb 26 22:02:31 EST 2008


Jeremy Mayes wrote:
> Hi,
>
> Thanks for the response.  It wasn't too bad building python.  And let 
> me change my initial statement slightly.  I'm trying to build 32-bit 
> binaries to run on an x86_64 machine.  You only have to pass gcc the 
> -m32 flag to get it to do that, so, it's not horrible.
Yes, configuring compiler for cross-compilation is not hard, if you 
already have one. But that's not the problem. When you set -m32, gcc 
does not just emit different machine code for the output; it also uses 
different runtime, and different headers for the C library. It is 
actually a different compiler, only the front end is the same.

It looks easy because most of the work is done by your distribution (if 
you did not build the compiler by yourself); and with pure C programs 
using autoconf, it is not too difficult, because autoconf detects 
cross-compilation (although I doubt it worked just by setting -m32; but 
maybe 64 bits OS can run 32 bits binaries, in which case it may not be 
detected as cross compilation by autoconf ? I tried the opposite, and it 
certainly does not work, since a 32 bits OS with a 32 bits CPU cannot 
execute amd64 binaries, of course).

But in the case of python, it is a different matter: are you sure you 
managed to build a 32 bits python ? How did you do it ? Because it is 
far from trivial, and setting CFLAGS is certainly not enough (unless, 
again, amd64 linux can run 32 bits binaries "natively").

Concerning distutils: setting CFLAGS won't work as you would expect from 
autoconf projects. It is ackward to control CFLAGS with distutils, 
unfortunately.

cheers,

David



More information about the SciPy-User mailing list