Quoting Ralf Wildenhues <[EMAIL PROTECTED]>:
Hi Aleksandar,* Aleksandar Milivojevic wrote on Thu, Jan 12, 2006 at 04:49:48PM CET:I've a problem with libtool (1.5.22 and the version included with gcc 4.0.2). Platform is sparc*-sun-solaris*. Using gcc 4.0.2. The linker doesn't seem to influence it (I've had same problem with gcc build that uses Sun ld and the build that uses Gnu ld). When creating shared libraries, the library path is not hardcoded into executable. On Solaris system, this may result in dynamic linker failing to load dynamic libraries during runtime../libtool --mode=link gcc -o libfoo.la -rpath /prefix/lib list-of-files gcc -shared list-of-files -lc -Wl,-soname -Wl,libfoo.so.0 -o .libs/libfoo.so.0.0.0 The resulting link command is missing "-Wl,--rpath -Wl,/prefix/lib" options (example using Gnu ld).Please rerun above command with `./libtool --debug' and post the output, packed (bzip2 or gzip preferred); also `./libtool --debug'.
Ok, here's the real example. Using Sun ld as linker.Two attachments included. libtool-debug.tar.gz is the debug output. libtool-nodebug.txt is short non-debug output from the build+install with some "ldd" and "dump -Lv" commands showing how Sun dynamic linker fails to find libgcc_s.so during runtime because the libb.so library is missing RPATH (the "a" executable itself has it, but it is irrelevant on Solaris).
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
$ gcc -c a.c -o a.o
$ ./libtool --mode=compile gcc -c b.c -o b.lo
gcc -c b.c -fPIC -DPIC -o .libs/b.o
gcc -c b.c -o b.o >/dev/null 2>&1
$ ./libtool --mode=link gcc -o libb.la -rpath /home/amilivojevic/s9/lib b.lo
rm -fr .libs/libb.a .libs/libb.la .libs/libb.lai .libs/libb.so .libs/libb.so.0
.libs/libb.so.0.0.0
gcc -shared -Wl,-h -Wl,libb.so.0 -o .libs/libb.so.0.0.0 .libs/b.o -lc
(cd .libs && rm -f libb.so.0 && ln -s libb.so.0.0.0 libb.so.0)
(cd .libs && rm -f libb.so && ln -s libb.so.0.0.0 libb.so)
ar cru .libs/libb.a b.o
ranlib .libs/libb.a
creating libb.la
(cd .libs && rm -f libb.la && ln -s ../libb.la libb.la)
$ ./libtool --mode=link gcc -o a a.o -rpath /home/amilivojevic/s9/lib -lb
gcc -o .libs/a a.o /home/amilivojevic/tmp/test/.libs/libb.so
-R/home/amilivojevic/s9/lib
creating a
$ ./libtool --mode=install cp libb.la /home/amilivojevic/s9/lib
cp .libs/libb.so.0.0.0 /home/amilivojevic/s9/lib/libb.so.0.0.0
(cd /home/amilivojevic/s9/lib && { ln -s -f libb.so.0.0.0 libb.so.0 || { rm -f
libb.so.0 && ln -s libb.so.0.0.0 libb.so.0; }; })
(cd /home/amilivojevic/s9/lib && { ln -s -f libb.so.0.0.0 libb.so || { rm -f
libb.so && ln -s libb.so.0.0.0 libb.so; }; })
chmod +x /home/amilivojevic/s9/lib/libb.so.0.0.0
cp .libs/libb.lai /home/amilivojevic/s9/lib/libb.la
cp .libs/libb.a /home/amilivojevic/s9/lib/libb.a
chmod 644 /home/amilivojevic/s9/lib/libb.a
ranlib /home/amilivojevic/s9/lib/libb.a
----------------------------------------------------------------------
Libraries have been installed in:
/home/amilivojevic/s9/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- use the `-RLIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
$ ./libtool --mode=install cp a /home/amilivojevic/s9/bin
cp .libs/a /home/amilivojevic/s9/bin/a
$ ldd /home/amilivojevic/s9/lib/libb.so
libc.so.1 => /usr/lib/libc.so.1
libgcc_s.so.1 => (file not found)
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,UltraAX-e2/lib/libc_psr.so.1
$ ldd /home/amilivojevic/s9/bin/a
libb.so.0 => /home/amilivojevic/s9/lib/libb.so.0
libc.so.1 => /usr/lib/libc.so.1
libgcc_s.so.1 => (file not found)
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,UltraAX-e2/lib/libc_psr.so.1
$ dump -Lv /home/amilivojevic/s9/bin/a | grep RPATH
[6] RPATH /home/amilivojevic/s9/lib
$ dump -Lv /home/amilivojevic/s9/lib/libb.so | grep RPATH
$ ls -l /home/amilivojevic/s9/lib/libb* /home/amilivojevic/s9/lib/libgcc_s*
-rw-r--r-- 1 amilivojevic users 660 Jan 13 08:46
/home/amilivojevic/s9/lib/libb.a
-rw-r--r-- 1 amilivojevic users 782 Jan 13 08:46
/home/amilivojevic/s9/lib/libb.la
lrwxrwxrwx 1 amilivojevic users 13 Jan 13 08:46
/home/amilivojevic/s9/lib/libb.so -> libb.so.0.0.0
lrwxrwxrwx 1 amilivojevic users 13 Jan 13 08:46
/home/amilivojevic/s9/lib/libb.so.0 -> libb.so.0.0.0
-rwxr-xr-x 1 amilivojevic users 5876 Jan 13 08:46
/home/amilivojevic/s9/lib/libb.so.0.0.0
lrwxrwxrwx 1 amilivojevic users 13 Dec 29 15:19
/home/amilivojevic/s9/lib/libgcc_s.so -> libgcc_s.so.1
-rw-r--r-- 1 amilivojevic users 232728 Dec 29 15:19
/home/amilivojevic/s9/lib/libgcc_s.so.1
libtool-debug.tar.gz
Description: Debug output, one command per file
_______________________________________________ Bug-libtool mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-libtool
