Python 3.1.1 with --enable-shared: won't create any extensions
Synopsis: Building Python 3.1 on RHEL 5.3 64-bit with the -enable-shared option will not compile all extensions. The "normal" structure works great without problems.
Please note that this question can blur the line between programming and system administration. However, I believe that since it deals directly with OS and programming issues, I would cross-post it on both StackOverflow and ServerFault. Also on Python 3.1.1 with --enable-shared: won't create any extensions . Thank!
Problem:
Building Python 3.1 on RHEL 5.3 64 bit with --enable-shared
cannot compile all extensions. The "normal" structure works great without problems.
I can build python 3.1 just fine, but when built as a shared library it throws a lot of warnings (see below) and refuses to build any of the modules based on c
. Despite this glitch, I can still build mod_wsgi 3.0c5 against it and run it under apache. Needless to say, Python's functionality has been greatly reduced ...
It is 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 it is for is a long term project, so I'm fine with alpha quality software if needed. Here are some details about the problem.
Leading:
- Dell PowerEdge
- Intel Xenon
- RHEL 5.3 64bit
- Nothing special "
Build:
- Python 3.1.1 source distribution
- Works fine with
./configure
- Doesn't work with
./configure --enable-shared
( export CFLAGS="-fPIC"
done)
make a conclusion
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
source to share
No one has answered this question yet
Check out similar questions: