Re: Development version of BIND 9 - 9.21.10 with meson build system

Havard Eidnes via bind-users <[email protected]>
Newsgroups gmane.network.dns.bind9.user
Message-ID <20250925.200424.1812604176253065937.he__42173.4174991556$1758823498$gmane$org@uninett.no>
> you are the one who probably knows how to report this, so I am asking if
> you can make a magic to upgrade the userspace-rcu to something that's
> not five years old and outdated in the pkgin/pkgsrc?

You mean something like

https://mail-index.netbsd.org/pkgsrc-changes/2025/09/06/msg330001.html

Yes, that was me updating the package to 0.15.3. :)

> 2. Configure BIND 9
> LDFLAGS="$ORIGIN/../lib" PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH meson setup build --wipe -Dtracing=disabled -Dnamed-lto=off
>
>> Surely that RPATH is wrong, the first component should have been
>> "$ORIGIN/../lib/", no?

Some lost context here.  That "configure BIND 9" line wasn't the
one I specified.  Having to specify so many parameters indicates
to me that the defaults are wonky at best.

This is the relevant section of "readelf -a" for /usr/local/bin/dig:

Dynamic section at offset 0x408600 contains 33 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libdns.so]
 0x0000000000000001 (NEEDED)             Shared library: [libisc.so]
 0x0000000000000001 (NEEDED)             Shared library: [libisccfg.so]
 0x0000000000000001 (NEEDED)             Shared library: [libidn2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.12]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/:/usr/pkg/lib]

Here I think the RPATH is wrong.

If I have understood correctly, just "$ORIGIN/" as component
means that dig will look for the shared libraries mentioned above
in /usr/local/bin/ since that's the binary's $ORIGIN.  Note:
*not* in /usr/local/lib/ where the shared libraries are installed.

As for the individual libraries::

$ ls -l /usr/pkg/lib/libdns.so
lrwxrwxr-x  1 root  wheel  17 Sep 11 17:05 /usr/pkg/lib/libdns.so -> libdns-9.20.13.so
$ ls -l /usr/pkg/lib/libisc.so
lrwxrwxr-x  1 root  wheel  17 Sep 11 17:05 /usr/pkg/lib/libisc.so -> libisc-9.20.13.so
$ ls -l /usr/pkg/lib/libisccfg.so
lrwxrwxr-x  1 root  wheel  20 Sep 11 17:05 /usr/pkg/lib/libisccfg.so -> libisccfg-9.20.13.so
$

and

$ ls -l /usr/local/lib/libdns.so
-rwxr-xr-x  1 root  wheel  10016512 Sep 11 23:12 /usr/local/lib/libdns.so
$ ls -l /usr/local/lib/libisc.so
-rwxr-xr-x  1 root  wheel  5266832 Sep 11 23:12 /usr/local/lib/libisc.so
$ ls -l /usr/local/lib/libisccfg.so
-rwxr-xr-x  1 root  wheel  4527832 Sep 11 23:12 /usr/local/lib/libisccfg.so
$

These are obviously not present in /usr/local/bin.

If we use patchelf to correct the RPATH:

# patchelf --set-rpath '$ORIGIN/../lib:/usr/pkg/lib' /usr/local/bin/dig

and "readelf -a" now says:

Dynamic section at offset 0x408600 contains 33 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libdns.so]
 0x0000000000000001 (NEEDED)             Shared library: [libisc.so]
 0x0000000000000001 (NEEDED)             Shared library: [libisccfg.so]
 0x0000000000000001 (NEEDED)             Shared library: [libidn2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.12]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/usr/pkg/lib]

aand...

Gah!  No change:

$ type dig
dig is /usr/local/bin/dig
$ dig xxxxxx.no. ns
dig: Undefined PLT symbol "isc__lib_initialize" (symnum = 12)
$ ldd /usr/local/bin/dig
ldd: /usr/local/bin/dig: invalid ELF class 2; expected 1
$

> No, not really. This is just a weird NetBSD quirk that its dynamic linker
> can't be configured and requires RPATH for everything.

I think that "This" needs to be spelled out, but I will claim
that ld.elf_so on NetBSD isn't weirder than other such systems.
Granted, we tossed "ldconfig" and the associated functionality a
long time ago, I beleive at least partially for security reasons.

> The $ORIGIN/ is needed, so the built binaries can be executed from
> the build directory even without installing them.

Understood, but see above.  Some of the inter-library
dependencies may also require tweaking:

$ ktrace -i dig xxxxxx.no. ns
dig: Undefined PLT symbol "isc__lib_initialize" (symnum = 12)
$ kdump | grep NAMI
  7576   7576 ktrace   NAMI  "/home/he/bin/dig"
  7576   7576 ktrace   NAMI  "/usr/local/bin/dig"
  7576   7576 ktrace   NAMI  "/usr/libexec/ld.elf_so"
  7576   7576 dig      NAMI  "/etc/ld.so.conf"
  7576   7576 dig      NAMI  "/usr/local/bin/../lib/libdns.so"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libdns.so"
  7576   7576 dig      NAMI  "/usr/local/bin/../lib/libisc.so"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libisc.so"
  7576   7576 dig      NAMI  "/usr/local/bin/../lib/libisccfg.so"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libisccfg.so"
  7576   7576 dig      NAMI  "/usr/local/bin/../lib/libidn2.so.0"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libidn2.so.0"
  7576   7576 dig      NAMI  "/usr/local/bin/../lib/libpthread.so.1"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libpthread.so.1"
  7576   7576 dig      NAMI  "/usr/lib/libpthread.so.1"
  7576   7576 dig      NAMI  "/usr/local/bin/../lib/libc.so.12"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libc.so.12"
  7576   7576 dig      NAMI  "/usr/lib/libc.so.12"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libnghttp2.so.14"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libuv.so.1"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libkvm.so.6"
  7576   7576 dig      NAMI  "/usr/lib/libkvm.so.6"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libssl.so.15"
  7576   7576 dig      NAMI  "/usr/lib/libssl.so.15"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libcrypto.so.15"
  7576   7576 dig      NAMI  "/usr/lib/libcrypto.so.15"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libxml2.so.16"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libz.so.1"
  7576   7576 dig      NAMI  "/usr/lib/libz.so.1"
  7576   7576 dig      NAMI  "/usr/pkg/lib/liblzma.so.2"
  7576   7576 dig      NAMI  "/usr/lib/liblzma.so.2"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libm.so.0"
  7576   7576 dig      NAMI  "/usr/lib/libm.so.0"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libfstrm.so.0"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libprotobuf-c.so.1"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libexecinfo.so.0"
  7576   7576 dig      NAMI  "/usr/lib/libexecinfo.so.0"
  7576   7576 dig      NAMI  "/usr/pkg/lib/liburcu.so.8"
  7576   7576 dig      NAMI  "/usr/pkg/lib/liburcu-cds.so.8"
  7576   7576 dig      NAMI  "/usr/pkg/lib/liburcu-common.so.8"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libgcc_s.so.1"
  7576   7576 dig      NAMI  "/usr/lib/libgcc_s.so.1"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libns-9.20.13.so"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libunistring.so.5"
  7576   7576 dig      NAMI  "/usr/pkg/lib/libintl.so.1"
  7576   7576 dig      NAMI  "/usr/lib/libintl.so.1"
  7576   7576 dig      NAMI  "/lib/libcrypt.so.1"
  7576   7576 dig      NAMI  "/usr/lib/libelf.so.2"
$

Still picking up some libraries from BIND 9.20 from
/usr/pkg/lib/, in particular /usr/pkg/lib/libns-9.20.13.so, and
that's not a direct dependency of 'dig'..

There's also some other strange RPATHs in the libraries:

$ cd /usr/local/lib
$ readelf -a libdns.so | less
...
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/:XXXXXX:/usr/pk
g/lib]
$ readelf -a libisc.so | less
...
 0x000000000000000f (RPATH)              Library rpath: [XXXXXXXXXXXXXX:/usr/pkg/lib]
$ readelf -a libisccfg.so | less
...
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/:/usr/pkg/lib]
...

Hmm:

$ cd /usr/local/lib
$ grep -l libns-9.20.13 lib*.so
$ cd /usr/pkg/lib
$ grep -l libns-9.20.13 lib*.so
libisccfg-9.20.13.so
libisccfg.so
libns-9.20.13.so
libns.so
$

There is apparently some confusion here as well...  Yes, I've had
BIND 9.20 installed both in /usr/local before and have it in
/usr/pkg at the moment, the effect of this is partially:

$ cd /usr/local/lib
$ ls -ltr libisccfg*so
-rwxr-xr-x  1 root  wheel   529376 Feb 28  2021 libisccfg-9.16.12.so
-rwxr-xr-x  1 root  wheel   618424 Oct 31  2022 libisccfg-9.18.8.so
-rwxr-xr-x  1 root  wheel   618592 Jun  1  2023 libisccfg-9.18.15.so
-rwxr-xr-x  1 root  wheel   615560 Aug 17  2023 libisccfg-9.18.18.so
-rwxr-xr-x  1 root  wheel   616168 Apr 10  2024 libisccfg-9.18.25.so
-rwxr-xr-x  1 root  wheel   616728 Apr 17  2024 libisccfg-9.18.26.so
-rwxr-xr-x  1 root  wheel   618192 Jul 24  2024 libisccfg-9.18.28.so
-rwxr-xr-x  1 root  wheel   976504 Jul 30  2024 libisccfg-9.20.0.so
-rwxr-xr-x  1 root  wheel   986288 Oct 21  2024 libisccfg-9.20.3.so
-rwxr-xr-x  1 root  wheel  4527832 Sep 11 23:12 libisccfg.so
-rwxr-xr-x  1 root  wheel   991984 Sep 12 17:17 libisccfg-9.20.12.so
$

Will need to dig further into this.


Thanks for the hints about supplying the "-v" option to get more
details.  Before you know it you've written a "meson survival kit
for old farts" :)  I'll need to follow that up when I have more
idle time on my hands.


Best regards,

- Håvard
-- 
Visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.