Created attachment 921676 [details] Test code explainig the problem Description of problem: Compiling a shared library using -Wl,--as-needed does not link to all needed libraries. Version-Release number of selected component (if applicable): gcc-c++-4.9.1-2.fc22.1.x86_64 How reproducible: Always. Steps to Reproduce: g++ --shared -o libtest.so -fPIC -I/usr/include/libAfterImage asim.cpp -Wl,--as-needed `afterimage-libs` (asim.cpp is attached to the report) Actual results: Even though -ltiff is part of `afterimage-libs`, libtest.so is not linked to it resulting in unresolved symbols. Expected results: The same as on F20, the same command line results in a shared library without unresolved symbols here. (gcc-c++-4.8.3-1.fc20.x86_64)
gcc just passes the flags to the linker, reassigning. Haven't verified it though.
Hi! Any progress on this? On F20 the libtest.so picks up freetype, tiff, X11 and GL: $ readelf -a libtest.so | grep NEEDED 0x0000000000000001 (NEEDED) delat bibliotek: [libAfterImage.so.0] 0x0000000000000001 (NEEDED) delat bibliotek: [libfreetype.so.6] 0x0000000000000001 (NEEDED) delat bibliotek: [libtiff.so.5] 0x0000000000000001 (NEEDED) delat bibliotek: [libX11.so.6] 0x0000000000000001 (NEEDED) delat bibliotek: [libGL.so.1] 0x0000000000000001 (NEEDED) delat bibliotek: [libc.so.6] and all symbols are resolved. On F21 and rawhide, using the same command line to compile, tiff is missing: $ readelf -a libtest.so | grep NEEDED 0x0000000000000001 (NEEDED) delat bibliotek: [libAfterImage.so.0] 0x0000000000000001 (NEEDED) delat bibliotek: [libfreetype.so.6] 0x0000000000000001 (NEEDED) delat bibliotek: [libX11.so.6] 0x0000000000000001 (NEEDED) delat bibliotek: [libGL.so.1] and there are lots of unresolved symbols.
Hi Mattias, Please try: binutils-2.24-21.fc2 Note - I have not backported the patch to F21 yet, because although it fixes the NEED for libtiff, it does not fix the NEED for libc. It is not clear to me yet whether this is important, so please let me know how you get on. Cheers Nick
Thank you. It works for me (I have tested -22.fc22). Having the fix in F21 too would be great. Many thanks, Mattias
Hi Matthias, binutils-2.24-20.fc21 now contains the patch as well. Cheers Nick
root's libASImage is now linked correctly in root-5.34.20-2.fc21 and root-5.34.20-2.fc22.