【问题标题】:How to Build a 32-bit Python Module Distribution w/ Setup.py on x86_64 Host如何在 x86_64 主机上使用 Setup.py 构建 32 位 Python 模块分发
【发布时间】:2010-09-25 02:57:27
【问题描述】:

我需要编译 PyEphem 的 32 位发行版。看起来这应该不难,但是,我遇到了一些编译器问题。

$ CFLAGS=-m32 python setup.py bdist -p i386
running bdist
running bdist_dumb
running build
running build_py
running build_ext
building 'ephem._libastro' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -m32 -fPIC -Ilibastro-3.7.3 -I/usr/include/python2.6 -c extensions/_libastro.c -o build/temp.linux-x86_64-2.6/extensions/_libastro.o
In file included from /usr/include/python2.6/Python.h:58,
                 from extensions/_libastro.c:3:
/usr/include/python2.6/pyport.h:685:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
error: command 'gcc' failed with exit status 1

构建系统运行的是 Ubuntu 10.04。 python头文件是否与本地主机的架构相关联?

更新:我发现了一些关于 Python cross-compiling 的有趣信息。

【问题讨论】:

    标签: python gcc cross-compiling setup.py


    【解决方案1】:

    您是否在您的机器上安装了 32 位 python?我认为如果你从 32 位 python 运行它应该没问题,并确保你链接到正确的 python.h。

    我从未尝试在 Linux 上进行交叉编译,但我已经针对 64 位 Windows 上并排安装的不同 python 进行了编译。

    当然,还有安装 32 位 VM 并从那里编译的核选项。

    【讨论】:

      猜你喜欢
      • 2012-07-20
      • 2015-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-02
      • 2013-05-29
      • 2011-12-17
      • 1970-01-01
      相关资源
      最近更新 更多