BIND 9.21.21: Problem with dynamic libraries on NetBSD

Lars-Johan Liman <[email protected]>
Newsgroups gmane.os.netbsd.general
Message-ID <[email protected]>
Hi!

Is anyone else experimenting with BIND 9.21.21 on amd64?

This could be a NetBSD problem rather than a BIND problem, but I only
have problems with BIND. It's either a problem with BIND or its building
process, or it's a problem with NetBSD triggered only by BIND or its
building process. Or, of course, the more likely option: its a problem
with yours truly and his perception of what's going on. :-)

BIND version: 9.21.21
NetBSD version: 10.1

After having straightened out the dependencies, BIND builds nice enough,
except for two warnings from ninja:

[334/371] Linking target dig
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
[352/371] Linking target nslookup
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs

but, trying to run the utilities yields:

% pwd
/usr/local/src/bind/bind-9.21.21/build

% printenv LD_LIBRARY_PATH
/usr/local/src/bind/bind-9.21.21/build

% ls -l libdns-9.21.21.so
-rwxr-xr-x  1 liman  wheel  10749144 Apr 19 10:26 libdns-9.21.21.so

% ./tsig-keygen
./tsig-keygen: Shared object "libdns-9.21.21.so" not found

The named binary itself is OK, because named doesn't need
libdns-9.21.21.so.

% ./named -v
BIND 9.21.21 (Development Release) <id:ec2e1ce>

The problem seems to be that ld.elf_so is unhappy with
libdns-9.21.21.so. It finds the file, does mmap() of it, but then
immediately does an munmap() and goes looking for better fish.

  6002   6002 tsig-keygen open("/usr/local/src/bind/bind-9.21.21/build/.//libdns-9.21.21.so", 0, 0x3) = 3
  6002   6002 tsig-keygen __fstat50(0x3, 0x7f7fffb27d38) = 0
  6002   6002 tsig-keygen mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0) = 0x7902210f1000
  6002   6002 tsig-keygen munmap(0x7902210f1000, 0x1000) = 0
  6002   6002 tsig-keygen close(0x3)               = 0
  6002   6002 tsig-keygen open("/usr/pkg/lib/libdns-9.21.21.so", 0, 0x6) Err#2 ENOENT
  6002   6002 tsig-keygen open("/usr/lib/libdns-9.21.21.so", 0, 0x2) Err#2 ENOENT
  6002   6002 tsig-keygen write(0x2, 0x7f7fffb283d8, 0x3a) = 58
       "./tsig-keygen: Shared object "libdns-9.21.21.so" not found"

This is interesting too:

% ldd named tsig-keygen
ldd: /usr/local/src/bind/bind-9.21.21/build/named: invalid ELF class 2; expected 1
ldd: /usr/local/src/bind/bind-9.21.21/build/tsig-keygen: invalid ELF class 2; expected 1

... which Google tells me can be due to an arch mismatch (32/64-bit),
but other tools tell me that that's not the case:

% file named tsig-keygen libdns-9.21.21.so
named:             ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 10.1, with debug_info, not stripped
tsig-keygen:       ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 10.1, with debug_info, not stripped
libdns-9.21.21.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, for NetBSD 10.1, with debug_info, not stripped

... and load-linking named obviously works (see above).

Has anyone figured out what's going on, and possibly found a
fix/workaround (like a scheme for compiling BIND 9.21.21 that differs
from mine)? (Instructions to RTFM will be gracefully heeded, if useful
pointers are provided. ;-) )

				Cheers,
				  /Liman
-- 
#-------------------------------------------------------------------------
# Lars-Johan Liman, M.Sc.		 ! E-mail: [email protected]
# Cafax AB				 ! https://www.cafax.se/
# Computer Consultants, Sweden		 ! Voice : +46 8 - 564 702 30
#-------------------------------------------------------------------------
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.