Should not libuuid be included in xapian-core.pc

Olly Betts olly at survex.com
Tue Mar 7 00:42:30 GMT 2017


On Fri, Mar 03, 2017 at 03:20:11PM +0100, Emmanuel Engelhart wrote:
> Small (maybe stupid) question about the Xapian pkg-config file. libuuid
> seems to be mandatory to libxapian...

It's not exactly mandatory - as xapian-core's INSTALL file says:

| Xapian also requires a way to generate UUIDs.  On FreeBSD, NetBSD, and
| Microsoft Windows, Xapian makes use of built-in UUID APIs.  On Linux and
| Android, Xapian 1.4.2 and higher can read UUIDs from a special file under
| /proc.  Otherwise you need to install libuuid which you can find in
| util-linux-ng (http://userweb.kernel.org/~kzak/util-linux-ng/).  On Debian and
| Ubuntu, the package to install is uuid-dev, while on Fedora, it is
| libuuid-devel (on older Fedora versions you instead need e2fsprogs-devel).

So some platforms don't need libuuid at all, for some platforms it's
optional, for others you do need it.

> but its' not in pkg-config file "xapian-core.pc". Why? Is that an
> omission?

I don't know much about .pc files - the current file was an external
contribution - but looking at the pkg-config docs, maybe uuid should
be listed in Requires.private (though only when the xapian library was
actually built to use libuuid of course!)

On ELF-based platforms I suspect things will work without it being there,
as ELF has DT_NEEDED which records such private dependencies so the
dynamic linker knows to load them automatically - e.g. on Linux:

$ readelf -a /usr/lib/x86_64-linux-gnu/libxapian.so.30|grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libuuid.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]

So there's presumably zlib too (which is mandatory).  Not sure about
the others - most of them are stuff the toolchain should provide, but
librt isn't.

A tested patch from someone who knows about pkg-config is certainly
welcome.  Ideally tested on a platform where the .pc file we currently
provide doesn't work.

Cheers,
    Olly



More information about the Xapian-devel mailing list