1 Date: Thu, 29 Jul 1999 14:56:40 +0200 (CEST)
2 From: Peter Breitenlohner <peb@mppmu.mpg.de>
3 Reply-To: Peter Breitenlohner <peb@mppmu.mpg.de>
4 To: bug-libtool@gnu.org
5 Subject: a suggestion for libtool (1.3.2)
6 Message-ID: <Pine.LNX.3.95.990729134449.8802F-200000@pcl163a.mppmu.mpg.de>
8 Content-Type: MULTIPART/MIXED; BOUNDARY="1803957763-1087116776-933253000=:8802"
9 Resent-Message-ID: <"2rP1j3.0.z77.p-4et"@mescaline.gnu.org>
10 Resent-From: bug-libtool@gnu.org
11 X-Mailing-List: <bug-libtool@gnu.org> archive/latest/952
12 X-Loop: bug-libtool@gnu.org
14 Resent-Sender: bug-libtool-request@gnu.org
16 X-UIDL: e9e213a8e1d8afc0286b4a4305ab5a36
22 This message is in MIME format. The first part should be readable text,
23 while the remaining parts are likely unreadable without MIME-aware tools.
24 Send mail to mime@docserver.cac.washington.edu for more info.
26 --1803957763-1087116776-933253000=:8802
27 Content-Type: TEXT/PLAIN; charset=US-ASCII
29 With our setup I found it necessary to apply the following patch to ltmain.sh
30 (1.3.2) although it should, of course, be applied to ltmain.in instead.
32 Let me explain the functionality of this modification and its necessity
33 arising from our situation.
36 Gcc (or rather the ld invoked by gcc) searches for libraries in more
37 directories than those specified with "-L" or the standard ones /lib,
38 /usr/lib, and /usr/local/lib. Most notably there is /usr/<target>/lib or
39 /usr/local/<target>/lib, depending on where gcc was installed.
41 According to the general libtool philosophy, when
42 gcc foo.o bar.o -ltest -o foo
43 succeeds in locating libtest.so (or libtest.a) in /usr/<target>/lib, then
44 libtool --mode=link gcc bar.lo -ltest -rpath <whatever> -o bar.la
45 should equally succeed in locating /usr/<target>/lib/libtest.so.
47 Note that with different incarnations of gcc for different <target>s one
48 certainly wouldn't want to add "-L/usr/<target>/lib" to the command line.
49 The proposed modification uses "gcc -print-file-name=libtest.so" to locate
50 the dependency libraries.
53 My actual situation is as follows:
54 We have a lot of users on our Linux systems (neither RedHat, nor SuSe, nor
55 Debian, nor ...) and some groups `absolutely need libc5' whereas others
56 `absolutely need glibc'. In order to allow for coexistence of libc (5.4.38
57 or so) and glibc (first 2.0.6, now 2.1.1) for quite some time as well as for a
58 really smooth transition, gcc behaves as either "gcc -b i486-pc-linux-gnulibc1"
59 or "gcc -b i486-pc-linux-gnu", depending on the value of an environment
60 variable. Actually /usr/bin/gcc is a symbolic link to a small shell script
61 that invokes either /usr/i486-pc-linux-gnulibc1/bin/gcc or
62 /usr/i486-pc-linux-gnu/bin/gcc and similarly for the binutils;
63 consequently, there are libc5 and glibc vesions of shared libraries, e.g.
64 /usr/i486-pc-linux-gnulibc1/lib/libncurses.so and
65 /usr/i486-pc-linux-gnu/lib/libncurses.so etc.
67 All that worked really nice, until I recently tried to compile
68 w3c-libwww-5.2.8 that uses libtool. First I had to replace their libtool-1.2e
69 (which couldn't resolve shared library dependencies at all) by version 1.3.2
70 in order to locate libdl.so etc. (in /lib), but still had problems to locate
71 libz.so (in /usr/<target>/lib) until I manufactured the patch.
74 Peter Breitenlohner <peb@mppmu.mpg.de>
77 --1803957763-1087116776-933253000=:8802
78 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="libtool-1.3.2-diff"
79 Content-Transfer-Encoding: BASE64
80 Content-ID: <Pine.LNX.3.95.990729145640.8802G@pcl163a.mppmu.mpg.de>
83 diff -ur libtool-1.3.2.orig/ltmain.sh libtool-1.3.2/ltmain.sh
84 --- libtool-1.3.2.orig/ltmain.sh Wed May 26 02:31:24 1999
85 +++ libtool-1.3.2/ltmain.sh Tue Jul 27 09:43:49 1999
86 @@ -1902,7 +1902,15 @@
87 # If $name is empty we are operating on a -L argument.
88 if test "$name" != "" ; then
89 libname=`eval \\$echo \"$libname_spec\"`
90 - for i in $lib_search_path; do
91 + # First try to locate the library through gcc
93 + if test "$CC" = "gcc" ; then
94 + eval library_names=\"$library_names_spec\"
95 + set dummy $library_names
97 + gcc_path="`gcc -print-file-name=$potlib | sed 's%/*'$potlib'$%%'`"
99 + for i in $gcc_path $lib_search_path; do
100 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
101 for potent_lib in $potential_libs; do
104 --1803957763-1087116776-933253000=:8802--