Python 3.1.1与--enable-shared:不会构建任何扩展 [英] Python 3.1.1 with --enable-shared : will not build any extensions
问题描述
总结:使用 - enable-shared
在RHEL 5.3上构建Python 3.1 64位无法编译所有扩展。建立正常工作正常没有任何问题。
请注意,这个问题似乎模糊了编程和系统管理之间的界限。但是,我相信,因为它必须直接处理获得语言支持,它与支持编程的过程有关,我将在这里交叉。也在: http:// serverfault .com / questions / 73196 / python-3-1-1-with-enable-shared-will-not-build-any-extensions 。谢谢!
问题:
在RHEL 5.3上构建Python 3.1 64位与 - enable-shared
无法编译所有扩展。建立正常工作正常没有任何问题。
我可以构建python 3.1很好,但是当构建为共享库时,它会发出很多警告并拒绝构建任何基于 c
的模块。尽管这个失败,我仍然可以构建mod_wsgi 3.0c5对它,并运行它在apache。不用说,Python的功能大大减少了...
有趣的是,注意到Python 3.2a0(来自svn)使用--enable-shared编译良好, mod_wsgi编译精细。但是当启动apache时,我得到:
无法加载/etc/httpd/modules/mod_wsgi.so到服务器:/ etc / httpd / modules /mod_wsgi.so:undefined symbol:PyCObject_FromVoidPtr
这个项目是一个长期项目,所以我可以alpha质量软件(如果需要)。以下是有关此问题的一些详情。
主机:
- Dell PowerEdge
- Intel Xenon
- RHEL 5.3 64位
- / li>
构建:
- Python 3.1.1源代码分发
- 与
./ configure
使用
./ configure --enable-shared
export CFLAGS = - fPIC
已完成)
make output p>
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3- - 原型原型。 -IInclude -I./Include -fPIC -DPy_BUILD_CORE -c ./Modules/_weakref.c -o模块/ _weakref.o
构建'bz2'扩展
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-原型-I。 -I./Include -I在/ usr /本地/包括-IInclude -I /家/建设/的rpmbuild / BUILD / Python的3.1.1 -c /home/build/RPMBUILD/BUILD/Python-3.1.1/Modules/ bz2module.c -o建立/ temp.linux-x86_64-3.1 /家/建设/的rpmbuild / BUILD / Python的3.1.1 /模块/ bz2module.o
GCC -pthread -shared -fno严格走样 - DNDEBUG -g -fwrapv -O3 -Wall -Wstrict的原型构建/ temp.linux-x86_64-3.1 /家/建设/的rpmbuild / BUILD / Python的3.1.1 /模块/ bz2module.o -L / USR / local / lib目录-L。 -lbz2 -lpython3.1 -o build / lib.linux-x86_64-3.1 / bz2.so
/ usr / bin / ld:/usr/local/lib/libpython3.1.a(abstract.o):在创建共享对象时不能使用针对本地符号的重定位R_X86_64_32;使用-fPIC重新编译
无法构建这些模块:
_bisect _codecs_cn _codecs_hk
_codecs_iso2022 _codecs_jp _codecs_kr
_codecs_tw _collections _csv
_ctypes _ctypes_test _curses
_curses_panel _dbm _elementtree
_gdbm _hashlib _heapq
_json _lsprof _multibytecodec
_multiprocessing _pickle _random
_socket _sqlite3 _ssl
_struct _testcapi数组
atexit对audioop binascii
BZ2 CMATH隐窝
日期时间的fcntl GRP
和itertools数学mmap
nis operator ossaudiodev
parser pyexpat readline
resource select spwd
syslog termios time
unicodedata zlib
您的构建环境有问题。它从 / usr / local / lib
中拾取libpython3.1.a;这会混淆错误消息。它试图链接到那个库,但是,它不应该尝试,首先,因为它应该使用它刚刚构建的libpython。我建议在 / usr / local
中安装Python 3.1。
在您的输出中是否在构建树中创建了libpython3.1.so.1.0;重要的是要确定它是否存在,它是如何链接的,以及它导出的符号。
Summary: Building Python 3.1 on RHEL 5.3 64 bit with --enable-shared
fails to compile all extensions. Building "normal" works fine without any problems.
Please note that this question may seem to blur the line between programming and system administration. However, I believe that because it has to deal directly with getting language support in place, and it very much has to do with supporting the process of programming, that I would cross-post it here. Also at: http://serverfault.com/questions/73196/python-3-1-1-with-enable-shared-will-not-build-any-extensions. Thank you!
Problem:
Building Python 3.1 on RHEL 5.3 64 bit with --enable-shared
fails to compile all extensions. Building "normal" works fine without any problems.
I can build python 3.1 just fine, but when built as a shared library, it emits many warnings (see below), and refuses to build any of the c
based modules. Despite this failure, I can still build mod_wsgi 3.0c5 against it, and run it under apache. Needless to say, the functionality of Python is greatly reduced...
Interesting to note that Python 3.2a0 (from svn) compiles fine with --enable-shared, and mod_wsgi compiles fine against it. But when starting apache, I get:
Cannot load /etc/httpd/modules/mod_wsgi.so into server: /etc/httpd/modules/mod_wsgi.so: undefined symbol: PyCObject_FromVoidPtr
The project that this is for is a long-term project, so I'm okay with alpha quality software if needed. Here are some more details on the problem.
Host:
- Dell PowerEdge
- Intel Xenon
- RHEL 5.3 64bit
- Nothing "special"
Build:
- Python 3.1.1 source distribution
- Works fine with
./configure
- Does not work fine with
./configure --enable-shared
(export CFLAGS="-fPIC"
has been done)
make output
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -fPIC -DPy_BUILD_CORE -c ./Modules/_weakref.c -o Modules/_weakref.o
building 'bz2' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -I./Include -I/usr/local/include -IInclude -I/home/build/RPMBUILD/BUILD/Python-3.1.1 -c /home/build/RPMBUILD/BUILD/Python-3.1.1/Modules/bz2module.c -o build/temp.linux-x86_64-3.1/home/build/RPMBUILD/BUILD/Python-3.1.1/Modules/bz2module.o
gcc -pthread -shared -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes build/temp.linux-x86_64-3.1/home/build/RPMBUILD/BUILD/Python-3.1.1/Modules/bz2module.o -L/usr/local/lib -L. -lbz2 -lpython3.1 -o build/lib.linux-x86_64-3.1/bz2.so
/usr/bin/ld: /usr/local/lib/libpython3.1.a(abstract.o): relocation R_X86_64_32 against 'a local symbol' can not be used when making a shared object; recompile with -fPIC
Failed to build these modules:
_bisect _codecs_cn _codecs_hk
_codecs_iso2022 _codecs_jp _codecs_kr
_codecs_tw _collections _csv
_ctypes _ctypes_test _curses
_curses_panel _dbm _elementtree
_gdbm _hashlib _heapq
_json _lsprof _multibytecodec
_multiprocessing _pickle _random
_socket _sqlite3 _ssl
_struct _testcapi array
atexit audioop binascii
bz2 cmath crypt
datetime fcntl grp
itertools math mmap
nis operator ossaudiodev
parser pyexpat readline
resource select spwd
syslog termios time
unicodedata zlib
Something is wrong with your build environment. It is picking up a libpython3.1.a from /usr/local/lib
; this confuses the error messages. It tries linking with that library, which fails - however, it shouldn't have tried that in the first place, since it should have used the libpython that it just built. I recommend taking the Python 3.1 installation in /usr/local
out of the way.
You don't show in your output whether a libpython3.1.so.1.0 was created in the build tree; it would be important to find out whether it exists, how it was linked, and what symbols it has exported.
这篇关于Python 3.1.1与--enable-shared:不会构建任何扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!