https://bugzilla.novell.com/show_bug.cgi?id=690952
https://bugzilla.novell.com/show_bug.cgi?id=690952#c8
--- Comment #8 from Stanislav Brabec 2011-05-16 21:52:08 CEST ---
I finally see, where is the problem and how to fix:
Affected third party packages use libtool to link libraries. libtool has its
own heuristic, which decides, whether -Wl,-rpath should be included. The
libtool heuristic fails here. This heuristic uses .la files. But wxWidgets
libraries are not linked by libtool, and no .la files exist there. wx-config
explicitly provides -Wl,-rpath. It is used by the libraries directly linked
against wxWidgets (and this linking succeeds), but their .la file does not
store -Wl,-rpath. Second level libraries or binaries that link against these
first level libraries are linked with wxWidgets again (however it makes no
sense in a modern GNU-Linux system, it is a standard libtool behavior), but as
the .la file does not contain -Wl,-rpath information, the inherited -Wl,-rpath
are not added to LDFLAGS. Linking succeeds, but runtime is not able to find
libraries.
I see two possible fixes:
1. Fast and easy: Create syntethic .la files for wxWidgets libraries to
work-around linking problem.
2. Complex: Learn libtool to be smarter if .la file does not exist.
Here are reproducers:
------ empty-link-with-la.sh -----------------------
#!/bin/sh
libtool --tag=CC --mode=compile gcc -shared emptylib.c -c -o emptylib.lo
# -Wl,-rpath,/usr/lib64/wx-2.8-wxcontainer -L/usr/lib64/wx-2.8-wxcontainer
libtool --tag=CC --mode=link gcc -shared -rpath $PWD/empty_install emptylib.lo
-o libempty.la
mkdir -p $PWD/empty_install
libtool --mode=install install -c libempty.la $PWD/empty_install
ldd empty_install/libempty.so
echo "You see it is OK."
# emulate different directory
rm -rf .libs libempty.la
libtool --tag=CC --mode=link gcc -shared -rpath /usr/lib64
/home/sbrabec/empty_install/libempty.la -o libempty2.la
ldd .libs/libempty2.so
echo "Yes, it is OK."
libtool --tag=CC --mode=compile gcc empty.c -c -o empty.o
libtool --tag=CC --mode=link gcc empty.o libempty2.la -o empty
LD_LIBRARY_PATH=$PWD/.libs ldd .libs/empty
echo "Yes, it is OK as well."
/empty
------ empty-link-no-la.sh -----------------------
#!/bin/sh
libtool --tag=CC --mode=compile gcc -shared emptylib.c -c -o emptylib.lo
# -Wl,-rpath,/usr/lib64/wx-2.8-wxcontainer -L/usr/lib64/wx-2.8-wxcontainer
libtool --tag=CC --mode=link gcc -shared -rpath $PWD/empty_install emptylib.lo
-o libempty.la
mkdir -p $PWD/empty_install
libtool --mode=install install -c libempty.la $PWD/empty_install
ldd empty_install/libempty.so
echo "You see it is OK."
# emulate different directory
rm -rf .libs libempty.la
libtool --tag=CC --mode=compile gcc -shared emptylib.c -c -o emptylib.lo
# emulate SUSE Shared Library Policy
rm empty_install/libempty.la
libtool --tag=CC --mode=link gcc -shared -rpath /usr/lib64 -Wl,-rpath
-Wl,$PWD/empty_install emptylib.lo -L$PWD/empty_install -lempty -o libempty2.la
LD_LIBRARY_PATH=$PWD/.libs ldd .libs/libempty2.so
echo "This is still OK."
libtool --tag=CC --mode=compile gcc empty.c -c -o empty.o
libtool --tag=CC --mode=link gcc empty.o libempty2.la -o empty
LD_LIBRARY_PATH=$PWD/.libs ldd .libs/empty
echo "OOPS, this fails."
LD_LIBRARY_PATH=$PWD/.libs ./empty
-----------------------------
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.