Bug 11019 - resolv_wrapper - undefined reference to `__ns_name_compress'
Summary: resolv_wrapper - undefined reference to `__ns_name_compress'
Alias: None
Product: cwrap
Classification: Unclassified
Component: library (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: Andreas Schneider
QA Contact:
Depends on:
Reported: 2014-12-19 14:16 UTC by Matthias Dieter Wallnöfer
Modified: 2015-03-15 13:09 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Dieter Wallnöfer 2014-12-19 14:16:07 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?
Comment 1 Andreas Schneider 2014-12-20 20:09:44 UTC
No, we should probably use dn_comp() instead of ns_name_comrpess().
Comment 2 Matthias Dieter Wallnöfer 2014-12-21 10:54:06 UTC
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.

./configure --bundled-libraries='!resolv_wrapper'
Comment 3 Andreas Schneider 2014-12-24 13:50:44 UTC
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.
Comment 4 Andreas Schneider 2015-01-12 16:38:13 UTC
Fixed with resolv_wrapper 1.1.1.
Comment 5 Matthias Dieter Wallnöfer 2015-01-13 18:45:00 UTC
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 LIBRESOLV_WRAPPER_SO_PATH /mnt/other/samba/bin/default/lib/resolv_wrapper/libresolv-wrapper.so
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
Comment 6 Andreas Schneider 2015-01-14 16:52:22 UTC
Is this with resolv_wrapper 1.1.2?
Comment 7 Matthias Dieter Wallnöfer 2015-01-15 08:21:56 UTC
yes (with those 5 latest commits applied).

(In reply to Andreas Schneider from comment #6)
Comment 8 Matthias Dieter Wallnöfer 2015-01-18 14:44:59 UTC
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.
Comment 9 Matthias Dieter Wallnöfer 2015-02-26 17:53:35 UTC
Andreas, did you consider my last comment?
Comment 10 Andreas Schneider 2015-03-05 20:07:54 UTC
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?
Comment 11 Matthias Dieter Wallnöfer 2015-03-15 13:09:57 UTC
It is okay.