On Wed, Nov 23, 2005 at 05:04:07PM +0000, Ralf Wildenhues wrote: > Marc Espie <espie <at> nerim.net> writes:
> > I'm very annoyed at > > libtool --mode=link cc -L/usr/local/lib -o foo foo.o ./libbar.la > > expanding into some stuff like: > > cc -L/usr/local/lib -L. -o foo foo.o -lbar > > which gets us the libbar installed under /usr/local/lib instead of the one > > we just built... > > Genuine bug in Libtool's OpenBSD support, most likely some wrong assumption > about which path overrides which. Current branch-1-5 does not do this on > GNU/Linux nor on FreeBSD -- sorry, I don't currently have access to OpenBSD. > > For static libbar, it creates on both systems > gcc -o foo foo.o ./.libs/libbar.a > and for shared libbar it creates > gcc -o .libs/foo foo.o ./.libs/libbar.so -Wl,--rpath -Wl,/tmp/inst I think you are not understanding Marc's point. what happens with -L/usr/local/lib? anyway, I think a more likely scenerio would be something like: /bin/sh ./libtool --tag=CC --mode=link -L/usr/X11R6/lib -o foo foo-foo.o lib/libbar.la -lX11 the problem is that -L/usr/X11R6/lib will come before -Llib/.libs in the compile_cmd. however, if the command were given as: /bin/sh ./libtool --tag=CC --mode=link -o foo foo-foo.o lib/libbar.la -L/usr/X11R6/lib -lX11 then the library include paths would be -Llib/.libs -L/usr/X11R6/lib, which is the desired order. this can be blamed to some degree on automake. if you have this in a Makefile.am: foo_SOURCES = foo.c foo_LDADD = lib/libbar.la -lX11 -lXv foo_DEPENDENCIES = lib/libbar.la foo_CPPFLAGS = -I/usr/X11R6/include foo_LDFLAGS = -L/usr/X11R6/lib then you will get a link command like so in Makefile: LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ foo$(EXEEXT): $(foo_OBJECTS) $(foo_DEPENDENCIES) @rm -f foo$(EXEEXT) $(LINK) $(foo_LDFLAGS) $(foo_OBJECTS) $(foo_LDADD) $(LIBS) so you end up with the local, newly created libraries coming after all possible LDFLAGS in the libtool command. at least this is what happens with automake-1.9.6. the real question is, IMO, how would libtool know what are local, new libraries? think of this: /bin/sh ./libtool --tag=CC --mode=link -o foo foo-foo.o /usr/local/lib/libglib-2.0.la $(top_builddir)lib/libbar.la -L/usr/X11R6/lib -lX11 there are two libtool libraries, both with full paths on the command line. how would libtool know the path to one should come before the path to the other? seems to me that straightening this out would require major changes to both libtool and automake. -- <[EMAIL PROTECTED]>