概要: RHEL 5.3 64 ビットで Python 3.1 をビルド--enable-shared
すると、すべての拡張機能のコンパイルに失敗します。「通常」のビルドは問題なく正常に動作します。
この質問は、プログラミングとシステム管理の境界をあいまいにしているように見えるかもしれないことに注意してください。ただし、言語サポートを適切に取得することに直接対処する必要があり、プログラミングのプロセスをサポートすることに非常に関係しているため、ここにクロスポストすると思います. また: https://serverfault.com/questions/73196/python-3-1-1-with-enable-shared-will-not-build-any-extensions。ありがとうございました!
問題:
RHEL 5.3 64 ビットで Python 3.1 をビルド--enable-shared
すると、すべての拡張機能のコンパイルに失敗します。「通常」のビルドは問題なく正常に動作します。
Python 3.1 は問題なくビルドできますが、共有ライブラリとしてビルドすると、多くの警告が発生し (以下を参照)、c
ベース モジュールのビルドを拒否します。この失敗にもかかわらず、それに対して mod_wsgi 3.0c5 をビルドし、apache で実行することはできます。言うまでもなく、Python の機能は大幅に低下しています...
Python 3.2a0 (svn から) は --enable-shared で正常にコンパイルされ、mod_wsgi はそれに対して正常にコンパイルされることに注意してください。しかし、Apacheを起動すると、次のようになります。
Cannot load /etc/httpd/modules/mod_wsgi.so into server: /etc/httpd/modules/mod_wsgi.so: undefined symbol: PyCObject_FromVoidPtr
これが対象とするプロジェクトは長期的なプロジェクトなので、必要に応じてアルファ品質のソフトウェアで問題ありません。問題の詳細を次に示します。
ホスト:
- Dell PowerEdge
- インテル キセノン
- RHEL 5.3 64 ビット
- 特にない"
建てる:
- Python 3.1.1 ソース配布
- 正常に動作します
./configure
- うまく動作しません
./configure --enable-shared
(export 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
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