Bug 258972

Summary: Mk/Scripts/qa.sh: Reports extraneous dependencies
Product: Ports & Packages Reporter: Don Lewis <truckman>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Some People CC: henrik, ports-bugs, yuri
Priority: --- Keywords: needs-qa
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259005
Bug Depends on: 259069    
Bug Blocks:    

Description Don Lewis freebsd_committer freebsd_triage 2021-10-06 20:49:41 UTC
As an example, if I build net/nmsg:

====> Running Q/A tests (stage-qa)
Error: /usr/local/lib/libnmsg.so.8.0.0 is linked to /usr/local/lib/libpgm-5.2.so.0 from net/openpgm but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libpgm-5.2.so:net/openpgm
Error: /usr/local/lib/libnmsg.so.8.0.0 is linked to /usr/local/lib/libnorm.so.1 from net/norm but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libnorm.so:net/norm

but these libraries are not linked to libnmsg.so:

# readelf -d /wrkdirs/usr/ports/net/nmsg/work/stage/usr/local/lib/libnmsg.so

Dynamic section at offset 0x22aa0 contains 31 entries:
  Tag                Type                  Name/Value
 0x0000000000000001 NEEDED               Shared library: [libpcap.so.8]
 0x0000000000000001 NEEDED               Shared library: [libprotobuf-c.so.1]
 0x0000000000000001 NEEDED               Shared library: [libzmq.so.5]
 0x0000000000000001 NEEDED               Shared library: [libyajl.so.2]
 0x0000000000000001 NEEDED               Shared library: [libz.so.6]
 0x0000000000000001 NEEDED               Shared library: [libm.so.5]
 0x0000000000000001 NEEDED               Shared library: [libthr.so.3]
 0x0000000000000001 NEEDED               Shared library: [libc.so.7]
 0x000000000000000e SONAME               Library soname: [libnmsg.so.8]

These libraries are linked to libzmq.so.5, which comes from
ZEROMQ_LIB_DEPENDS=     libzmq.so:net/libzmq4

This appears to be a new problem since I don't recall seeing it a couple
weeks ago.  I took a brief look at Scripts/qa.sh and I don't see any
suspicious commits in that time period.

I've seen similar in another port in the last week.

If you try this example, I recommend disabling the DOXYGEN option to avoid bringing in some heavyweight dependencies used to build the documentation.
Comment 1 Don Lewis freebsd_committer freebsd_triage 2021-10-07 19:03:58 UTC
The problem only seems to show up on 14-CURRENT.

14.0-CURRENT 1400033 94c2d487f1 amd64 git+https 2021-09-26 02:32:03 - broken
13.0-STABLE 1300514 efc3ebeb6   amd64 git+https 2021-08-04 02:41:51 - correct
12.2-STABLE 1202508 bd28b2d73   amd64 git+https 2021-08-07 21:28:04 - correct
Comment 2 Henrik Gulbrandsen 2021-11-13 19:20:14 UTC
This bug also affects 13.0-STABLE at 4a36455c4. As I speculated in a comment to bug 259005, the underlying cause is indeed the same as for bug 259069. That is, Mk/Scripts/qa.sh expects "ldd -a" to list linked libraries in separate sections, but this request is sent via an environment variable, which apparently does not reach rtld anymore. The linked patch restores the expected behavior for me:

    https://www.gulbra.net/freebsd/patches/patch-PR258972-usr.bin-ldd-ldd.c