Python 3.1.1 with --enable-shared :不会构建任何扩展 [英] Python 3.1.1 with --enable-shared : will not build any extensions

查看:51
本文介绍了Python 3.1.1 with --enable-shared :不会构建任何扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

总结:使用 --enable-shared 在 RHEL 5.3 64 位上构建 Python 3.1 无法编译所有扩展.构建正常"工作正常,没有任何问题.

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.

请注意,这个问题似乎模糊了编程和系统管理之间的界限.然而,我相信因为它必须直接处理获得语言支持,而且它与支持编程过程密切相关,所以我会在这里交叉发布.同样在:https://serverfault.com/questions/73196/python-3-1-1-with-enable-shared-will-not-build-any-extensions.谢谢!

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: https://serverfault.com/questions/73196/python-3-1-1-with-enable-shared-will-not-build-any-extensions. Thank you!

问题:

使用 --enable-shared 在 RHEL 5.3 64 位上构建 Python 3.1 无法编译所有扩展.构建正常"工作正常,没有任何问题.

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.

我可以很好地构建 python 3.1,但是当作为共享库构建时,它会发出许多警告(见下文),并且拒绝构建任何基于 c 的模块.尽管失败了,我仍然可以针对它构建 mod_wsgi 3.0c5,并在 apache 下运行它.不用说,Python的功能大大减少了……

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...

有趣的是,Python 3.2a0(来自 svn)使用 --enable-shared 编译得很好,而 mod_wsgi 编译得很好.但是在启动 apache 时,我得到:

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:

无法将/etc/httpd/modules/mod_wsgi.so 加载到服务器:/etc/httpd/modules/mod_wsgi.so:未定义符号:PyCObject_FromVoidPtr

这是一个长期项目,所以如果需要,我可以使用 alpha 质量的软件.以下是有关该问题的更多详细信息.

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.

主持人:

  • 戴尔 PowerEdge
  • 英特尔氙气
  • RHEL 5.3 64 位
  • 没什么特别的"

构建:

  • Python 3.1.1 源代码分发
  • ./configure
  • 一起工作正常
  • 不能与 ./configure --enable-shared 一起正常工作
  • Python 3.1.1 source distribution
  • Works fine with ./configure
  • Does not work fine with ./configure --enable-shared

(导出CFLAGS="-fPIC"已经完成)

制作输出

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

构建bz2"扩展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.ogcc -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针对'a local symbol'不能在制作共享对象时使用;重新编译 -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

推荐答案

您的构建环境有问题.它正在从 /usr/local/lib 中获取一个 libpython3.1.a;这会混淆错误消息.它尝试与该库链接,但失败了 - 但是,它首先不应该尝试这样做,因为它应该使用它刚刚构建的 libpython.我建议不要安装 /usr/local 中的 Python 3.1.

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.

您没有在输出中显示是否在构建树中创建了 libpython3.1.so.1.0;找出它是否存在、它是如何链接的以及它导出了哪些符号很重要.

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 with --enable-shared :不会构建任何扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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