How to Build a 32-bit Python Module Distribution w/ Setup.py on x86_64 Host

≡放荡痞女 提交于 2019-12-21 20:28:46

问题


I need to compile a 32-bit distribution of PyEphem. It does not seem like this should be difficult, however, I'm running into some compiler issues.

$ 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

The build system is running Ubuntu 10.04. Are the python header files tied to the architecture of the local hosts?

Update: I found some interesting info about Python cross-compiling.


回答1:


Have you installed a 32-bit python on your machine? I think that it should be OK if you run it from 32-bit python, and make sure you're linking to the right python.h.

I've never tried to cross-compile on Linux, but I have compiled against different pythons installed side by side on 64-bit Windows.

Then of course, there's the nuclear option of installing a 32-bit VM and compiling from there.



来源:https://stackoverflow.com/questions/3792285/how-to-build-a-32-bit-python-module-distribution-w-setup-py-on-x86-64-host

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!