Re: pkg check -B tcpdump: libcap_dns.so.2 not found

From: John W. O'Brien <john_freebsd-ports_at_radioprosciutto.org>
Date: Sat, 11 Nov 2023 18:05:41 UTC
On 11/11/23 00:51, Tatsuki Makino wrote:
> John W. O'Brien wrote on 2023/11/11 11:25:
>> On 11/10/23 16:26, Tatsuki Makino wrote:
[...]
> I can understand it because it is related to ldconfig up to /usr/local/lib/compat/pkg, but then it jumps to /lib/casper.
> This is due to the following.
> 
> https://cgit.freebsd.org/src/tree/libexec/rtld-elf/paths.h?h=stable/12#n59
> 
> This allows tcpdump to load libcap_dns.so.2.
> However, pkg does not seem to treat that directory as a base library directory.
> 
> It is presumed that the main branch will not have this problem because it has already been moved from /lib/casper to /lib.

"pkg check -B" reads /var/run/ld-elf.so.hints, which is maintained by 
ldconfig. By default, that does not include /lib/casper.


% sudo pkg check -B tcpdump
Checking tcpdump:   0%
(tcpdump-4.99.4_1) /usr/local/sbin/tcpdump - required shared library 
libcap_dns.so.2 not found
Checking tcpdump: 100%
% echo /lib/casper |
     sudo tee /usr/local/libdata/ldconfig/casper > /dev/null
% sudo service ldconfig restart
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib 
/usr/local/lib/compat/pkg /lib/casper /usr/local/lib/compat/pkg 
/usr/local/lib/perl5/5.36/mach/CORE /usr/local/llvm15/lib
32-bit compatibility ldconfig path: /usr/lib32
% sudo pkg check -B tcpdump
Checking tcpdump: 100%


As you pointed out before, rtld does not rely on elf-hints to find 
casper shlibs due to /lib/casper's being hard-coded among the standard 
library paths.

To me, it looks like the bug is in rc.d/ldconfig, where _LCD should 
match what rtld thinks of as the standard library paths.


stable/12

https://cgit.freebsd.org/src/tree/libexec/rtld-elf/paths.h?h=stable/12&id=6a0891c6ebb78bd59a3fc440675e31b6982de896#n59
https://cgit.freebsd.org/src/tree/libexec/rc/rc.d/ldconfig?h=stable/12&id=6a0891c6ebb78bd59a3fc440675e31b6982de896#n26


stable/13

https://cgit.freebsd.org/src/tree/libexec/rtld-elf/rtld_paths.h?h=stable/13&id=a6d08183731b28d1e9c898a0bc8708136776b250#n70
https://cgit.freebsd.org/src/tree/libexec/rc/rc.d/ldconfig?h=stable/13&id=a6d08183731b28d1e9c898a0bc8708136776b250#n25


main does not appear to be affected, as you noted, nor does stable/14.

I will see about submitting a patch.


>> Would freebsd-pkg@ be a better forum for this discussion?
> 
> I do not subscribe, so please take this :)

Neither do I. Maybe next time. :)

All: Thanks for your patience with what turned out to be off-topic for 
ports.