Hi!

While trying to link pkgin statically on -current, I noticed a problem
in libarchive.

The symptom:
  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

which lead me to investigating the static libarchive:

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

The shared library doesn't have this problem, but I haven't understood
the build system enough to find where this difference comes from.

I found:

/usr/src/external/bsd/libarchive> grep -r ZSTDDPLIBS
./bin/Makefile.inc:PROGDPLIBS+= ${ZSTDDPLIBS}
./lib/libarchive/Makefile:              ${ZSTDDPLIBS} \

and that seems to be defined in:
/usr/src/external/bsd/zstd/Makefile.zstd:ZSTDDPLIBS=    zstd ${ZSTD}/lib

Any ideas for the proper fix?

Thanks,
 Thomas

Reply via email to