I think we need to add, around line 58, -lmd (after -larchive) to /usr/ports/ports-mgmt/pkg/work/pkg-1.13.2/auto.def to avoid /usr/bin/ld: /var/ports/usr/ports/ports-mgmt/pkg/work/pkg-1.13.2/libpkg/libpkg_flat.a(loslib.o): in function `os_tmpname': loslib.c:(.text+0x78f): warning: warning: tmpnam() possibly used unsafely; consider using mkstemp() /usr/bin/ld: /usr/lib/libarchive.a(archive_digest.o): in function `__archive_libmd_sha1init': archive_digest.c:(.text+0x72): undefined reference to `_libmd_SHA1_Init' ... This is on FreeBSD 12.1-STABLE #0 r359159M: Sat Mar 21 13:31:04 AEDT 2020 using FreeBSD clang version 9.0.1
I would need more information to be able to reproduce that, as I cannot do it for now.
(In reply to Baptiste Daroussin from comment #1) If pkg links to archivers/libarchive then the problem is not reproducible; and this is my workaround ;) In both the amd64 and i386 jails, there is no: - /usr/local/lib/libarchive* - base openssl (because we build with libressl). Prior to building packages, we remove all remnants of prior builds, inluding various "pkg delete -y -a". From here we rebuild everything. (And yes, we do reinstall a previously working /usr/local/sbin/pkg-static into our bare bones build jails) # make -C /usr/ports/ports-mgmt/pkg -VCFLAGS -Vspace -VLDFLAGS -O2 -pipe -Wl,-m,elf_x86_64_fbsd -Wl,--strip-debug -Wl,--build-id=md5 -Wl,--hash-style=sysv -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3 -g0 -ggdb0 -DSTRIP_FBSDID -UDEBUGGING -UDEBUG -fno-math-errno -fomit-frame-pointer -fno-asynchronous-unwind-tables -march=core2 -Wno-error -fno-strict-aliasing -Wl,--strip-debug -Wl,--build-id=md5 -Wl,--hash-style=sysv When I examine base's tar and pkg they are both linked to libmd, # ldd /usr/bin/tar /usr/sbin/pkg | grep -E ":|archiv|md" /usr/bin/tar: libarchive.so.7 => /usr/lib/libarchive.so.7 (0x178e5daf4000) libmd.so.6 => /lib/libmd.so.6 (0x178e5dc4f000) /usr/sbin/pkg: libarchive.so.7 => /usr/lib/libarchive.so.7 (0x801d1d000) libmd.so.6 => /lib/libmd.so.6 (0x806a80000) (I selected tar because I know it also needs libarchive) This is on a very recent FreeBSD12.1 r359159. I don't know what else would be helpful to reproduce?
I am not able to reproduce in any case, if it still happens to you, please feel free to reopen