Opened 7 years ago
Closed 7 years ago
#751 closed defect (fixed)
Add `-lrt` to pkg-config if necessary.
Reported by: | mgautier | Owned by: | Olly Betts |
---|---|---|---|
Priority: | normal | Milestone: | 1.4.5 |
Component: | Build system | Version: | git master |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Operating System: | All |
Description
If xapian uses rt
library, the -lrt
flag must be present in the pkg-config
settings.
This patch add it if necessary.
Attachments (1)
Change History (6)
by , 7 years ago
Attachment: | pkgconfig_librt.patch added |
---|
comment:1 by , 7 years ago
Component: | Other → Build system |
---|---|
Type: | enhancement → defect |
comment:2 by , 7 years ago
Could you please respond to the question in my previous comment, and let me know if the suggested fix works for you?
It'd be good to address this in the imminent 1.4.5 release.
comment:3 by , 7 years ago
Sorry, I forget you and this issue ...
I've just test what you've suggested and it seems to work perfectly. I had to change a bit my build system, but it is not your problem :)
For you information, we are building a library using xapian and different platform (native and cross-compilation (win32, armhf, android, ...)) with native and dynamic linking. The host platform is linux (fedora and ubuntu). I didn't know about DT_NEEDED but it seems that linux has it. The problem (undefined symbol) appears when doing static linking.
Anyway, adding Libs.private: @XAPIAN_LIBS@
fixes my problem and it is a far better solution than my patch.
It would be nice to have it in the next xapian release.
Thanks.
comment:4 by , 7 years ago
Milestone: | → 1.4.5 |
---|---|
Status: | new → assigned |
Linux does have DT_NEEDED
for shared libraries - it's essentially a list of dependencies embedded in a shared library so that when the system dynamically loads libxapian.so
it knows it has to dynamically load all these other libraries:
$ readelf -a /usr/lib/x86_64-linux-gnu/libxapian.so|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]
I don't think there's an equivalent way for a .a
to encode dependencies, so it has to be handled at a higher level.
Thanks for the confirmation, will apply the Libs.private
change for 1.4.5.
comment:5 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in git master e8cb77e1d06e8538e6a639c05d47c6ee8eaa15f9, backported for 1.4.5 in 4a730136e49a3500f5b1b6108bead33b958ba89f.
I don't know much about pkg-config, but this doesn't sound right to me - the application linked against xapian doesn't need any symbols from librt, only the xapian library itself does.
I think the correct fix is to add:
What platform are you seeing this on? Presumably one without DT_NEEDED or equivalent.