[PATCH] tools build: Link crypto lib for libopenssl feature

Leo Yan posted 1 patch 1 month ago
tools/build/feature/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tools build: Link crypto lib for libopenssl feature
Posted by Leo Yan 1 month ago
The perf static build reports that the BPF skeleton is disabled due to
the missing libopenssl feature.

Linking the crypto library fixes the static build failure.

Fixes: 7678523109d1 ("tools/build: Add a feature test for libopenssl")
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/build/feature/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1fbcb3ce74d2..8b1e32cb22fd 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -384,7 +384,7 @@ $(OUTPUT)test-libpfm4.bin:
 	$(BUILD) -lpfm
 
 $(OUTPUT)test-libopenssl.bin:
-	$(BUILD) -lssl
+	$(BUILD) -lssl -lcrypto
 
 $(OUTPUT)test-bpftool-skeletons.bin:
 	$(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
-- 
2.34.1
Re: [PATCH] tools build: Link crypto lib for libopenssl feature
Posted by Namhyung Kim 3 weeks, 2 days ago
Hi Leo,

On Sat, Mar 07, 2026 at 02:05:53PM +0000, Leo Yan wrote:
> The perf static build reports that the BPF skeleton is disabled due to
> the missing libopenssl feature.
> 
> Linking the crypto library fixes the static build failure.

I'm not sure if it's enough.  My build still doesn't have BPF skeleton
support even with this change.  It seems to want zlib and zstd as well.

Here's my tools/build/feature/test-libopenssl.make.output.

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-dso_dlfcn.o): in function `dlfcn_globallookup':
(.text+0x18): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-bio_addr.o): in function `BIO_lookup_ex':
(.text+0xe77): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-bio_sock.o): in function `BIO_gethostbyname':
(.text+0x85): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `zlib_stateful_expand_block':
(.text+0x83): undefined reference to `inflate'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `zlib_stateful_compress_block':
(.text+0x157): undefined reference to `deflate'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `zlib_stateful_finish':
(.text+0x1bd): undefined reference to `inflateEnd'
/usr/bin/ld: (.text+0x1c6): undefined reference to `deflateEnd'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `zlib_stateful_init':
(.text+0x293): undefined reference to `inflateInit_'
/usr/bin/ld: (.text+0x308): undefined reference to `deflateInit_'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `bio_zlib_ctrl':
(.text+0x506): undefined reference to `zError'
/usr/bin/ld: (.text+0x5f8): undefined reference to `deflate'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `bio_zlib_write':
(.text+0x8c9): undefined reference to `deflate'
/usr/bin/ld: (.text+0x946): undefined reference to `zError'
/usr/bin/ld: (.text+0x9e7): undefined reference to `deflateInit_'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `bio_zlib_read':
(.text+0xad9): undefined reference to `inflate'
/usr/bin/ld: (.text+0xb56): undefined reference to `zError'
/usr/bin/ld: (.text+0xbcb): undefined reference to `inflateInit_'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `zlib_oneshot_expand_block':
(.text+0xc64): undefined reference to `uncompress'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `zlib_oneshot_compress_block':
(.text+0xce4): undefined reference to `compress'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zlib.o): in function `bio_zlib_free':
(.text+0xd39): undefined reference to `inflateEnd'
/usr/bin/ld: (.text+0xd64): undefined reference to `deflateEnd'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `zstd_stateful_expand_block':
(.text+0x9e): undefined reference to `ZSTD_decompressStream'
/usr/bin/ld: (.text+0xa9): undefined reference to `ZSTD_isError'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `zstd_stateful_compress_block':
(.text+0x178): undefined reference to `ZSTD_compressStream2'
/usr/bin/ld: (.text+0x180): undefined reference to `ZSTD_isError'
/usr/bin/ld: (.text+0x1bf): undefined reference to `ZSTD_endStream'
/usr/bin/ld: (.text+0x1c7): undefined reference to `ZSTD_isError'
/usr/bin/ld: (.text+0x1ef): undefined reference to `ZSTD_flushStream'
/usr/bin/ld: (.text+0x1f7): undefined reference to `ZSTD_isError'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `zstd_stateful_finish':
(.text+0x22b): undefined reference to `ZSTD_freeCStream'
/usr/bin/ld: (.text+0x234): undefined reference to `ZSTD_freeDStream'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `zstd_stateful_init':
(.text+0x2fd): undefined reference to `ZSTD_createCStream_advanced'
/usr/bin/ld: (.text+0x316): undefined reference to `ZSTD_initCStream'
/usr/bin/ld: (.text+0x337): undefined reference to `ZSTD_createDStream_advanced'
/usr/bin/ld: (.text+0x34c): undefined reference to `ZSTD_initDStream'
/usr/bin/ld: (.text+0x374): undefined reference to `ZSTD_freeCStream'
/usr/bin/ld: (.text+0x37d): undefined reference to `ZSTD_freeDStream'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `bio_zstd_new':
(.text+0x42c): undefined reference to `ZSTD_createDStream_advanced'
/usr/bin/ld: (.text+0x444): undefined reference to `ZSTD_initDStream'
/usr/bin/ld: (.text+0x449): undefined reference to `ZSTD_DStreamInSize'
/usr/bin/ld: (.text+0x46e): undefined reference to `ZSTD_createCStream_advanced'
/usr/bin/ld: (.text+0x488): undefined reference to `ZSTD_initCStream'
/usr/bin/ld: (.text+0x48d): undefined reference to `ZSTD_CStreamInSize'
/usr/bin/ld: (.text+0x4f4): undefined reference to `ZSTD_freeDStream'
/usr/bin/ld: (.text+0x4fd): undefined reference to `ZSTD_freeCStream'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `bio_zstd_ctrl':
(.text+0x6dc): undefined reference to `ZSTD_getErrorName'
/usr/bin/ld: (.text+0x78d): undefined reference to `ZSTD_flushStream'
/usr/bin/ld: (.text+0x798): undefined reference to `ZSTD_isError'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `bio_zstd_write':
(.text+0x9a2): undefined reference to `ZSTD_compressStream2'
/usr/bin/ld: (.text+0x9ad): undefined reference to `ZSTD_isError'
/usr/bin/ld: (.text+0xa24): undefined reference to `ZSTD_getErrorName'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `bio_zstd_read':
(.text+0xbcd): undefined reference to `ZSTD_decompressStream'
/usr/bin/ld: (.text+0xbd8): undefined reference to `ZSTD_isError'
/usr/bin/ld: (.text+0xc14): undefined reference to `ZSTD_getErrorName'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `zstd_oneshot_expand_block':
(.text+0xd87): undefined reference to `ZSTD_decompress'
/usr/bin/ld: (.text+0xd94): undefined reference to `ZSTD_isError'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `zstd_oneshot_compress_block':
(.text+0xe0a): undefined reference to `ZSTD_compress'
/usr/bin/ld: (.text+0xe17): undefined reference to `ZSTD_isError'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libcrypto.a(libcrypto-lib-c_zstd.o): in function `bio_zstd_free':
(.text+0xe77): undefined reference to `ZSTD_freeDStream'
/usr/bin/ld: (.text+0xe95): undefined reference to `ZSTD_freeCStream'
collect2: error: ld returned 1 exit status

Thanks,
Namhyung
Re: [PATCH] tools build: Link crypto lib for libopenssl feature
Posted by Leo Yan 3 weeks, 2 days ago
Hi Namhyung,

On Mon, Mar 16, 2026 at 11:40:38AM -0700, Namhyung Kim wrote:
> Hi Leo,
> 
> On Sat, Mar 07, 2026 at 02:05:53PM +0000, Leo Yan wrote:
> > The perf static build reports that the BPF skeleton is disabled due to
> > the missing libopenssl feature.
> > 
> > Linking the crypto library fixes the static build failure.
> 
> I'm not sure if it's enough.  My build still doesn't have BPF skeleton
> support even with this change.  It seems to want zlib and zstd as well.

I did not see the build failure on Ubuntu 24.04 but I can reproduce the
issue after changed to Debian sid.  I will send a new version.

Thanks!