Jean-Francois Dockes
2010-Sep-25 09:06 UTC
[Xapian-devel] xapian-config --libs should list -luuid -lz ?
On Linux (tested on Fedora, Xapian 1.2.3), "xapian-config --libs" just lists -lxapian. On FreeBSD it also lists -lz and -luuid. Shouldn't the latter be part of the output on Linux too ? jf
Olly Betts
2010-Sep-25 11:37 UTC
[Xapian-devel] xapian-config --libs should list -luuid -lz ?
On Sat, Sep 25, 2010 at 11:06:56AM +0200, Jean-Francois Dockes wrote:> On Linux (tested on Fedora, Xapian 1.2.3), "xapian-config --libs" just > lists -lxapian. On FreeBSD it also lists -lz and -luuid. Shouldn't the > latter be part of the output on Linux too ?No. On Linux, if a shared library depends on other shared libraries, then these are recorded in the dynamic section, and automatically pulled in by the dynamic loader. You can check these like so: readelf -d /usr/lib/libxapian.so|grep NEEDED So there's no need to specify these libraries again when linking the application (unless the application independently uses them, in which case you ought to). And in fact it's a bad explicitly link the application with these libraries, as it means that an ABI bump for one of them would require the application to be rebuilt, rather than just libxapian.so. If you maintain a Linux distro with binary packages then that would greatly increase the work which a library ABI bump causes. It is possible FreeBSD also pulls in dependent libraries automatically (and/or maybe some other platforms do too), but I'm not familiar enough with them to know, so currently this is only done on Linux. If anyone knows of other platforms which don't need to link dependent libraries explicitly, then do let me know. The simplest way to check is to only link with -lxapian (not -lz or -luuid) and see if you can create a disk-based database. If you test a platform and find it does, that's also useful information. Cheers, Olly