NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/59506: static libarchive is missing zstd symbols



>Number:         59506
>Category:       lib
>Synopsis:       static libarchive is missing zstd symbols
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 03 09:35:00 +0000 2025
>Originator:     Thomas Klausner
>Release:        NetBSD 10.99.14
>Organization:

>Environment:
	
	
Architecture: x86_64
Machine: amd64
>Description:
When linking pkgin against libarchive, it fails

  CCLD     pkgin
ld: /usr/lib/libarchive.a(archive_read_support_filter_zstd.o): in function `zstd_filter_close':
archive_read_support_filter_zstd.c:(.text+0x11): undefined reference to `ZSTD_freeDStream'
ld: /usr/lib/libarchive.a(archive_read_support_filter_zstd.o): in function `zstd_bidder_init':
archive_read_support_filter_zstd.c:(.text+0x42): undefined reference to `ZSTD_DStreamOutSize'
ld: archive_read_support_filter_zstd.c:(.text+0x7c): undefined reference to `ZSTD_createDStream'
ld: archive_read_support_filter_zstd.c:(.text+0xd9): undefined reference to `ZSTD_freeDStream'
ld: /usr/lib/libarchive.a(archive_read_support_filter_zstd.o): in function `zstd_filter_read':
archive_read_support_filter_zstd.c:(.text+0x1a4): undefined reference to `ZSTD_decompressStream'
ld: archive_read_support_filter_zstd.c:(.text+0x1af): undefined reference to `ZSTD_isError'
ld: archive_read_support_filter_zstd.c:(.text+0x1ee): undefined reference to `ZSTD_initDStream'
ld: archive_read_support_filter_zstd.c:(.text+0x1f9): undefined reference to `ZSTD_isError'
ld: archive_read_support_filter_zstd.c:(.text+0x27a): undefined reference to `ZSTD_getErrorName'
ld: archive_read_support_filter_zstd.c:(.text+0x2a6): undefined reference to `ZSTD_getErrorName'
*** [pkgin] Error code 1

since libarchive.a is missing some symbols:

nm /usr/lib/libarchive.a| grep U.ZSTD
                 U ZSTD_CCtx_reset
                 U ZSTD_CCtx_setParameter
                 U ZSTD_CStreamOutSize
                 U ZSTD_cParam_getBounds
                 U ZSTD_compressStream
                 U ZSTD_createCStream
                 U ZSTD_endStream
                 U ZSTD_freeCStream
                 U ZSTD_getErrorName
                 U ZSTD_initCStream
                 U ZSTD_isError
                 U ZSTD_maxCLevel
                 U ZSTD_minCLevel
                 U ZSTD_versionNumber
                 U ZSTD_createDStream
                 U ZSTD_decompressStream
                 U ZSTD_freeDStream
                 U ZSTD_getErrorName
                 U ZSTD_isError
                 U ZSTD_DStreamOutSize
                 U ZSTD_createDStream
                 U ZSTD_decompressStream
                 U ZSTD_freeDStream
                 U ZSTD_getErrorName
                 U ZSTD_initDStream
                 U ZSTD_isError
                 U ZSTD_DStreamOutSize
                 U ZSTD_createDStream
                 U ZSTD_decompressStream
                 U ZSTD_freeDStream
                 U ZSTD_getErrorName
                 U ZSTD_initDStream
                 U ZSTD_isError

In libarchive I see in src/external/bsd/libarchive/lib/libarchive/Makefile

# XXX Avoid exporting symbols of statically linked deps like zstd.
# XXX Should do this in bsd.lib.mk, perhaps.
.for _lib _dir in ${LIBDPLIBS}
LDADD+=         -Wl,--exclude-libs,lib${_lib}
.endfor

This looks wrong for the static library
>How-To-Repeat:

Apply this to pkgsrc/pkgtools/pkgin/Makefile:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkgin/Makefile,v
retrieving revision 1.139
diff -u -r1.139 Makefile
--- Makefile	20 May 2025 08:21:45 -0000	1.139
+++ Makefile	3 Jul 2025 08:41:12 -0000
@@ -34,6 +34,13 @@
 
 USE_FEATURES=		nbcompat
 
+# link statically to make upgrades of itself easier
+CFLAGS+=		-static
+# needed by sqlite3
+LIBS+=		-lm -lpthread
+# needed by libarchive
+LIBS+=		-lz -lbz2 -llzma -larchive
+
 .include "../../mk/bsd.prefs.mk"
 
 SUBST_CLASSES.NetBSD+=	osrel

and build pkgin.
>Fix:
Please.

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index