This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python 2.5 fails with -Wl,--as-needed in LDFLAGS
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: loewis, masterdriverz
Priority: normal Keywords: patch

Created on 2006-09-21 12:01 by masterdriverz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
as-needed.patch masterdriverz, 2006-09-21 12:01 Patch to fix --as-needed in python 2.5
Messages (3)
msg51135 - (view) Author: Chaza (masterdriverz) Date: 2006-09-21 12:01
Python 2.5 fails at final linking with this error:

i686-pc-linux-gnu-ranlib libpython2.5.a
i686-pc-linux-gnu-gcc -pthread -Wl,--as-needed -Xlinker
-export-dynamic -o
python \
                        Modules/python.o \
                        -L. -lpython2.5 -lpthread -ldl
 -lutil -L/usr/lib -lz  
-lm
./libpython2.5.so: undefined reference to `inflateEnd'
./libpython2.5.so: undefined reference to `deflate'
./libpython2.5.so: undefined reference to `deflateInit_'
./libpython2.5.so: undefined reference to `inflateInit2_'
./libpython2.5.so: undefined reference to `inflate'
./libpython2.5.so: undefined reference to `crc32'
./libpython2.5.so: undefined reference to `deflateEnd'
./libpython2.5.so: undefined reference to `deflateCopy'
./libpython2.5.so: undefined reference to `deflateInit2_'
./libpython2.5.so: undefined reference to `adler32'
./libpython2.5.so: undefined reference to `inflateCopy'
collect2: ld returned 1 exit status
make: *** [python] Error 1

!!! ERROR: dev-lang/python-2.5_rc1 failed.

Attached patch fixes this, by changing the linking
order from "Modules/python.o -L. -lpython2.5 -lpthread
-ldl -lutil -L/usr/lib -lz -lm" to "Modules/python.o
-lpython2.5 -L. -lpthread -ldl -lutil -L/usr/lib -lz
-lm" , basically swapping "-L. -lpython2.5" around. The
patch edits configure.in and swaps them for Linux, BSD
and SunOS.
msg51136 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-09-24 17:25
Logged In: YES 
user_id=21627

Can you please provide exact instructions on how to
reproduce the problem?

The patch looks wrong. If libpython2.5.so has references to
libz, then it should be linked with libz itself (rather than
linking the executable with libz).

Notice that the procedure to create a shared libpython is
mostly unmaintained and unsupported; so patches to improve
it would be appreciated.
msg51137 - (view) Author: Chaza (masterdriverz) Date: 2006-09-29 20:57
Logged In: YES 
user_id=1096685

Sorry for noise, I can't reproduce this anymore.
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44004
2006-09-21 12:01:50masterdriverzcreate