The Samba-Bugzilla – Bug 11019
resolv_wrapper - undefined reference to `__ns_name_compress'
Last modified: 2015-03-15 13:09:57 UTC
resolv_wrapper uses ns_name_compress() from glibc. This works fine on recent Linux distributions, but creates problems on older ones.
I have a CentOS 5 i386 system with libresolv-2.5.
When resolv_wrapper would be linked statically, there would be no issue:
$ readelf -s /usr/lib/libresolv.a | grep compress
19: 00000000 0 NOTYPE GLOBAL DEFAULT UND __ns_name_compress
21: 00000000 0 NOTYPE GLOBAL DEFAULT UND __ns_name_uncompress
17: 000007f0 149 FUNC GLOBAL DEFAULT 1 __ns_name_uncompress
24: 00000c10 151 FUNC GLOBAL DEFAULT 1 __ns_name_compress
But when linking dynamically, __ns_name_compress() is hidden/local:
$ readelf -s /usr/lib/libresolv.so | grep compress
149: 00b7df30 153 FUNC LOCAL DEFAULT 12 __ns_name_uncompress
201: 00b7e3c0 174 FUNC LOCAL DEFAULT 12 __ns_name_compress
There is a mailing list thread for this kind of issue: https://lists.gnu.org/archive/html/bug-glibc/2002-01/msg00086.html
The workaround is to just disable resolv_wrapper in WAF. I am not sure, if there is a real solution here. Maybe a check could be introduced to disable resolv_wrapper automatically on older libresolv versions?
No, we should probably use dn_comp() instead of ns_name_comrpess().
Did resolv_wrapper become a mandatory library since also this configuration fails? I thought that it was just an optional component which could be disabled.
If you do not want to run the testsuite, you can disable it. But we need to correctly fix it so we can run the testsuite on CentOS5 and RHEL5 too.
Fixed with resolv_wrapper 1.1.1.
Andreas, I think that your patch is not enough, since it does not distinguish between statically and dynamically linked, as I have explained it.
My include/config.h states:
#define HAVE_DECL_NS_NAME_COMPRESS 1
#define HAVE_NS_NAME_COMPRESS 1
#define LIBRESOLV_WRAPPER_SO_PATH /mnt/other/samba/bin/default/lib/resolv_wrapper/libresolv-wrapper.so
#define RESOLV_WRAPPER 1
But the build still breaks.
default/lib/resolv_wrapper/resolv_wrapper_1.o: In function `rwrap_fake_question':
/mnt/other/samba/bin/../lib/resolv_wrapper/resolv_wrapper.c:363: undefined reference to `__ns_name_compress'
default/lib/resolv_wrapper/resolv_wrapper_1.o: In function `rwrap_fake_rdata_common':
/mnt/other/samba/bin/../lib/resolv_wrapper/resolv_wrapper.c:394: undefined reference to `__ns_name_compress'
default/lib/resolv_wrapper/resolv_wrapper_1.o: In function `rwrap_fake_srv':
/mnt/other/samba/bin/../lib/resolv_wrapper/resolv_wrapper.c:491: undefined reference to `__ns_name_compress'
default/lib/resolv_wrapper/resolv_wrapper_1.o: In function `rwrap_fake_soa':
/mnt/other/samba/bin/../lib/resolv_wrapper/resolv_wrapper.c:533: undefined reference to `__ns_name_compress'
/mnt/other/samba/bin/../lib/resolv_wrapper/resolv_wrapper.c:541: undefined reference to `__ns_name_compress'
default/lib/resolv_wrapper/resolv_wrapper_1.o:/mnt/other/samba/bin/../lib/resolv_wrapper/resolv_wrapper.c:585: more undefined references to `__ns_name_compress' follow
collect2: ld gab 1 als Ende-Status zurück
Is this with resolv_wrapper 1.1.2?
yes (with those 5 latest commits applied).
(In reply to Andreas Schneider from comment #6)
Another test showed that with the revert of commit 90de53f970a87fd4b6ade5e5f280cc58587b58ef it works. So for RHEL/CentOS 5 the declaration checking is not enough, you really need to look for the library symbol.
Andreas, did you consider my last comment?
I've added code that the wrappers are only built if you enable selftest. Is that enough for you or do you care running 'make test' on CentOS5?
It is okay.