[Xapian-devel] xapian-config --libs outputs libstdc++.la as a dependency

Olly Betts olly at survex.com
Sat Jan 14 02:49:00 GMT 2006


On Fri, Jan 13, 2006 at 09:47:48PM +0000, Olly Betts wrote:
> On Fri, Jan 13, 2006 at 07:48:10AM +0100, Jean-Francois Dockes wrote:
> > What happens is that "xapian-config --libs" outputs libstdc++.la in the
> > list of libraries. Something like:
> > 
> > -L/usr/i686-pc-linux-gnu/bin -L/usr/i686-pc-linux-gnu/lib \
> >  /usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libstdc++.la 
> 
> Hmm, that's not good.

I've attached a simple patch which should fix this in most cases.  I'll
probably go with this for the forthcoming release at least.  It'll work
so long as no .la files listed in libxapian.la's dependency_libs have
dependency_libs themselves that aren't pulled in anyway.

The patch is for xapian-config.  You'll need to patch xapian-config.in
instead if you patch before running configure (the same patch should
apply to either).

Cheers,
    Olly
-------------- next part --------------
--- xapian-config.orig
+++ xapian-config
@@ -132,6 +132,14 @@
 	test /usr/lib != "$libdir" && L="-L$libdir "
 	D=
 	eval `grep ^dependency_libs= "$libdir/libxapian.la"`
+	# Replace "/path/to/libfoo.la" with "-L/path/to -lfoo" which doesn't
+	# take into account any dependency_libs which libfoo.la may pull in
+	# but the only .la that we're likely to see is libstdc++.la and it'll
+	# hopefully work there as any dependency libs will probably be pulled
+	# in by the compiler for us.  Recursively pulling in dependency_libs
+	# is probably too hard to do in sh - we'd need to reimplement
+	# xapian-config in C or C++.
+	dependency_libs=`echo " $dependency_libs "|sed 's![     ][      ]*!  !g;s! \(/[^ ]*\)/lib\([^ ]*\).la ! -L\1 -l\2 !g;s!  ! !g;s!^ !!;s! $!!'`
 	test -n "$dependency_libs" && D=" $dependency_libs"
 	echo "$F$L-lxapian$D"
 	;;


More information about the Xapian-devel mailing list