Add
-Dc_link_args=-Wl,-rpath='$ORIGIN/..lib' -Dc_link_args=-Wl,-z,noseparate-code

to meson invocation. This might get you going.

So, far, I am not seeing “NetBSD quirks”, but broken base system with linker 
(ld) allowing options that are broken and a broken dynamic linker. This has 
nothing to do with BIND 9 and needs to be fixed in NetBSD directly. Also if the 
base system doesn’t include /usr/local/lib, it probably should add 
$ORIGIN/../lib to rpath by default and not rely on applications to do that 
because … reasons.

Ondrej
--
Ondřej Surý — ISC (He/Him)

My working hours and your working hours may be different. Please do not feel 
obligated to reply outside your normal working hours.

> On 1. 10. 2025, at 19:46, Havard Eidnes <h...@uninett.no> wrote:
> 
>> 
>> With ld.elf_so compiled with DEBUG and LD_DEBUG set in the
>> environment, attempts at executing dig out of the build directory
>> is met with
>> 
>> _rtld_error: /usr/local/src/bind-9.21.12/build-dir/.//libdns-9.21.12.so: 
>> wrong number of segments (4 != 2)
>> 
>> Applying the change from
>> 
>>  https://mail-index.netbsd.org/source-changes/2023/01/06/msg142652.html
>> 
>> to ld.elf_so and rebuild & re-install fixes both issues [...]
> 
> It looks like the use of "-Wl,-z,separate-code" is the one which
> is responsible for bumping the number of LOAD segments in the
> shared libraries from 2 to 4.
> 
> There are several paths out of that situation:
> 
> 1) On NetBSD, insist on NetBSD >= 11.0_BETA.  The fix above is
>   part of what's in 11.0_BETA.  I've not verified this myself
>   yet.
> 
> 2) On NetBSD, and on NetBSD < 11.0_BETA, drop the usage of that
>   linker option.  Requires meson magic above my current
>   abilities.
> 
> 2b) Or ... insist that users otherwise matching #2 manually edit
>   out that option from meson.build.  Obviously that's a less
>   desireable "solution".
> 
> 3) Apply the above patch to netbsd-10, and wait for the next 10.x
>   release for the fix availability.  There's a non-zero chance
>   that this change interacts badly with other features (TLS on
>   arm, e.g.) that it's not a straight-forward solution to apply
>   this fix without "more engineering".  The focus in the NetBSD
>   camp is more on netbsd-11 and getting that into a release-able
>   form, and getting the next 10.x release out the door may take
>   quite a while if it ever happens.
> 
> 4) Move the build setup for BIND 9.21.x to e.g. pkgsrc-wip and
>   eventually to pkgsrc proper where local patches can be
>   applied, effectuating e.g. #2b above, and indicate that's
>   where the NetBSD build setup for BIND 9.21.x is to be
>   maintained.
> 
> Help with #2 would be appreciated, but as you see, there are
> other options.
> 
> Regards,
> 
> - Håvard

-- 
Visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from 
this list.

Reply via email to