rpki-client / rpki-client-portable

Portability shim for OpenBSD's rpki-client

Home Page:https://rpki-client.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

symbol collision between libcompat.a and libtls

gottaeat opened this issue · comments

in a case where libcrypto and libssl is provided by the system openssl 3.0.8 and only libtls is built from libressl 3.7.0 (with --enable-libtls-only), the build fails with the following symbol collision:

ld.lld: error: duplicate symbol: ASN1_time_tm_cmp
>>> defined in ../compat/.libs/libcompat.a(a_time_tm.o)
>>> defined in /mss/work/table/INS/lib/libtls.a(libcrypto_la-a_time_tm.o)

ld.lld: error: duplicate symbol: ASN1_time_parse
>>> defined in ../compat/.libs/libcompat.a(a_time_tm.o)
>>> defined in /mss/work/table/INS/lib/libtls.a(libcrypto_la-a_time_tm.o)
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)

building and using libcrypto and libssl alongise libtls from libressl, the pkg-config calls made by configure will pick the libs provided by the libressl installation, and the collision does not happen.

i am seeing this while building rpki-client 8.2 on an x86_64 musl 1.2.3 host with a complete and standalone llvm 15.0.7 toolchain.

libressl 3.7.0 is configured with:

./configure \
 --build=x86_64-apathy-linux-musl \
 --host=x86_64-apathy-linux-musl  \
 --prefix="/mss/work/table/INS"   \
\
 --enable-asm                     \
 --enable-static                  \
 --disable-extratests             \
 --enable-libtls-only             \
 --disable-nc                     \
 --disable-shared                 \
 --disable-tests                  \
 --disable-windows-ssp

rpki-client 8.2 is configured with:

./configure \
 --build=x86_64-apathy-linux-musl \
 --host=x86_64-apathy-linux-musl  \
 --prefix="/opt/rpki-client-8.2"  \
 --localstatedir=/var             \
\
 --with-user="mss"

system openssl:

openssl version
OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)

clang && ld:

apathy clang version 15.0.7
Target: x86_64-apathy-linux-musl
Thread model: posix
InstalledDir: /opt/llvm-15.0.7/bin

apathy LLD 15.0.7 (compatible with GNU linkers)

I changed the order in the configure script to first add -ltls to the ldflags and then check for ASN1_time_tm_cmp() and friends. This should solve your problem with the duplicate symbols since libcompat.a will no longer include them.
So this should be fixed in bf0fbec