gpt4 book ai didi

python - 如何在 x86_64 主机上使用 Setup.py 构建 32 位 Python 模块分发

转载 作者:行者123 更新时间:2023-11-28 18:55:15 26 4
gpt4 key购买 nike

我需要编译 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 的有趣信息.

最佳答案

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

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

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

关于python - 如何在 x86_64 主机上使用 Setup.py 构建 32 位 Python 模块分发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3792285/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com