在64位系统上编译32位

我正在尝试使用以下configure命令在64位ubuntu系统上编译32位版本的python:

CC="gcc -m32" LDFLAGS="-L/lib32 -L/usr/lib32 \ -Lpwd/lib32 -Wl,-rpath,/lib32 \ -Wl,-rpath,/usr/lib32" \ ./configure --prefix=/opt/pym32 

然后make,make install。 没有错误,但它应该是错误的,因为“readelf -h python”告诉我python是作为ELF64构建的。

使用“–build”和“–host”。

 ./configure --help System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] 

您需要使用./configure --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu在64位Linux系统中编译32位Linux。 您仍然需要添加其他./configure选项。

如果你想要编译版本,你应该发布(在一个pastebin中)gcc的详细输出。 否则,就不可能知道。

建议使用chroot的解决方案可以帮助你,Mikko友情提供一个链接,指导用户如何在64位机器上使用chroot 32bit python :