bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convenience libraries fail to be linked on Darwin


From: Ian Lister
Subject: Re: Convenience libraries fail to be linked on Darwin
Date: Thu, 31 Jan 2002 22:45:05 +1000 (EST)

Here is a patch that works around the below problem in libtool 1.4.2, for
me at least. I certainly don't claim that it's a patch that should be
committed anywhere, but hopefully it might point out the right area for a
real patch to be made.

=====8<-----
Index: ltmain.in
===================================================================
RCS file: /cvs/Darwin/Commands/GNU/libtool/libtool/ltmain.in,v
retrieving revision 1.5
diff -u -d -r1.5 ltmain.in
--- ltmain.in   19 Nov 2001 00:21:34 -0000      1.5
+++ ltmain.in   31 Jan 2002 12:21:12 -0000
@@ -1647,7 +1647,7 @@
        if test -z "$libdir"; then
          # Link the convenience library
          if test $linkmode = lib; then
-           deplibs="$dir/$old_library $deplibs"
+           :
          elif test "$linkmode,$pass" = "prog,link"; then
            compile_deplibs="$dir/$old_library $compile_deplibs"
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
Index: ltmain.sh
===================================================================
RCS file: /cvs/Darwin/Commands/GNU/libtool/libtool/ltmain.sh,v
retrieving revision 1.6
diff -u -d -r1.6 ltmain.sh
--- ltmain.sh   19 Nov 2001 00:21:34 -0000      1.6
+++ ltmain.sh   31 Jan 2002 12:21:19 -0000
@@ -1647,7 +1647,7 @@
        if test -z "$libdir"; then
          # Link the convenience library
          if test $linkmode = lib; then
-           deplibs="$dir/$old_library $deplibs"
+           :
          elif test "$linkmode,$pass" = "prog,link"; then
            compile_deplibs="$dir/$old_library $compile_deplibs"
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
=====8<-----

Ian

---------- Forwarded message ----------
Date: Mon, 14 Jan 2002 11:21:42 +1000 (EST)
From: Ian Lister <address@hidden>
To: address@hidden
Subject: Convenience libraries fail to be linked on Darwin

Using libtool 1.4.2 and Darwin 5.2 (and earlier), when trying to link a
convenience library into another library, libtool gives the name of the
convenience library to the linker twice, resulting in a link failure e.g:

/bin/sh ../../libtool --mode=link /usr/bin/cc  -Wall -O2 -g -pipe   -o
libexample.la -rpath /usr/local/lib -lssl -lcrypto -version-info 4:0:0
foo.lo bar.lo ../replace/libreplace.la -lc  -lm

causes libtool to try:

rm -fr .libs/libexample.la .libs/libexample.* .libs/libexample.*
/usr/bin/cc -dynamiclib -flat_namespace -undefined suppress -o
.libs/libexample.4.0.0.dylib foo.lo bar.lo -all_load
../replace/.libs/libreplace.al -lssl -lcrypto
../replace/.libs/libreplace.al -lc -lm -lc -install_name
/usr/local/lib/libexample.4.dylib -compatibility_version 5
-current_version 5.0

which results in:

ld: multiple definitions of symbol _inet_ntop
../replace/.libs/libreplace.al(inet_ntop.lo) definition of _inet_ntop in
section (__TEXT,__text)
../replace/.libs/libreplace.al(inet_ntop.lo) definition of _inet_ntop in
section (__TEXT,__text)
ld: multiple definitions of symbol _inet_pton
../replace/.libs/libreplace.al(inet_pton.lo) definition of _inet_pton in
section (__TEXT,__text)
../replace/.libs/libreplace.al(inet_pton.lo) definition of _inet_pton in
section (__TEXT,__text)
/usr/bin/libtool: internal link edit command failed
make[2]: *** [libexample.la] Error 1

(note that /usr/bin/libtool is a Darwin tool, not GNU libtool)

Ian Lister





reply via email to

[Prev in Thread] Current Thread [Next in Thread]