如何在 64 位 Linux 上构建 32 位 python 2.6? [英] How to build 32bit python 2.6 on 64bit Linux?

查看:15

问题描述

我被困了一个下午,试图让 python 以 32 位模式构建.我在 64 位 Linux 机器上运行 openSUSE 11.3,我安装了必要的 -devel 和 -32 位包,以在 32 位模式下构建应用程序.

I'm stuck for a full afternoon now trying to get python to build in 32bit mode. I run a 64bit Linux machine with openSUSE 11.3, I have the necessary -devel and -32bit packages installed to build applications in 32bit mode.

python 构建的问题似乎不在于 make 运行本身,而在于之后运行由 make 调用的 setup.py.

The problem with the python build seems to be not in the make run itself, but in the afterwards run of setup.py, invoked by make.

我找到了以下适用于 Ubuntu Linux 的说明:h**p://indefinestudies.org/2010/02/08/how-to-build-32-bit-python-on-ubuntu-9-10-x86_64/

I found the following instructions for Ubuntu Linux: h**p://indefinitestudies.org/2010/02/08/how-to-build-32-bit-python-on-ubuntu-9-10-x86_64/

当我按照描述做时,我得到以下输出:

When I do as described, I get the following output:

http://pastebin.com/eP8WJ8V4

但我有 libreadline、libopenssl 等 -32 位软件包.已安装,但当然,它们驻留在/lib 和/usr/lib 下,而不是/lib64 和/usr/lib64 下.

But I have the -32bit packages of libreadline, libopenssl, etc.pp. installed, but of course, they reside under /lib and /usr/lib and not /lib64 and /usr/lib64.

当我启动由此构建产生的 python 二进制文件时,我得到:

When I start the python binary that results from this build, i get:

./python
Python 2.6.6 (r266:84292, Oct  5 2010, 21:22:06) 
[GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "/etc/pythonstart", line 7, in <module>
    import readline
ImportError: No module named readline

那么如何获取setup.py来观察LDFLAGS=-L/lib命令??

So how to get setup.py to observe the LDFLAGS=-L/lib command??

非常感谢任何帮助.

问候,菲利普

推荐答案

您需要通过适当的gcc 和 ld 的标志告诉编译器编译和生成 32 位二进制文​​件.

You'll need to pass the appropriate flags to gcc and ld to tell the compiler to compile and produce 32bit binaries.

使用--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 位系统中为 32 位 Linux 编译位Linux系统.

You need to use ./configure --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu to compile for 32-bit Linux in a 64-bit Linux system.

注意:您仍然需要添加其他 ./configure 选项.

Note: You still need to add the other ./configure options.

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆