[Buildroot] [PATCH 1/1] package/openssl: static build w/ libgcrypt: prevent selection of libressl

Andreas Ziegler br015 at umbiko.net
Fri Apr 4 09:50:00 UTC 2025


Both libgcrypt and libressl export symbols sha3_update and sha3_final, that 
cannot be hidden in static builds and cause linker errors:

/home/buildroot/instance-0/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/11.4.0/../../../../armeb-buildroot-linux-musleabi/bin/ld: /home/buildroot/instance-0/output-1/host/armeb-buildroot-linux-musleabi/sysroot/usr/lib/libgcrypt.a(rndjent.o): in function `sha3_update':
/home/buildroot/instance-0/output-1/build/libgcrypt-1.10.3/random/./jitterentropy-sha3.c:281: multiple definition of `sha3_update'; /home/buildroot/instance-0/output-1/host/armeb-buildroot-linux-musleabi/sysroot/usr/lib/libcrypto.a(sha3.c.o):/home/buildroot/instance-0/output-1/build/libressl-3.8.4/crypto/sha/sha3.c:137: first defined here
/home/buildroot/instance-0/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/11.4.0/../../../../armeb-buildroot-linux-musleabi/bin/ld: /home/buildroot/instance-0/output-1/host/armeb-buildroot-linux-musleabi/sysroot/usr/lib/libgcrypt.a(rndjent.o): in function `sha3_final':
/home/buildroot/instance-0/output-1/build/libgcrypt-1.10.3/random/./jitterentropy-sha3.c:324: multiple definition of `sha3_final'; /home/buildroot/instance-0/output-1/host/armeb-buildroot-linux-musleabi/sysroot/usr/lib/libcrypto.a(sha3.c.o):/home/buildroot/instance-0/output-1/build/libressl-3.8.4/crypto/sha/sha3.c:155: first defined here

Prevent selection of libressl as the openssl provider in static build if 
libgcrypt is selected.

Fixes: https://autobuild.buildroot.org/results/ea5621b044c14aad51384cf164695e026dfc2586

Signed-off-by: Andreas Ziegler <br015 at umbiko.net>
---
 package/openssl/Config.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/openssl/Config.in b/package/openssl/Config.in
index d255a05596..556406d1d1 100644
--- a/package/openssl/Config.in
+++ b/package/openssl/Config.in
@@ -48,6 +48,8 @@ config BR2_PACKAGE_LIBRESSL
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	# uClibc doesn't provide __register_atfork() without NPTL
 	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HAS_THREADS_NPTL
+	# multiple definition of symbols in statically linked libraries
+	depends on !(BR2_PACKAGE_LIBGCRYPT && BR2_STATIC_LIBS)
 	help
 	  LibreSSL is a version of the TLS/crypto stack forked from
 	  OpenSSL in 2014, with goals of modernizing the codebase,
-- 
2.43.0



More information about the buildroot mailing list