configure.ac: link to all mbed TLS libs during library detection
PATCH 1/1 configure.ac: link to all mbed TLS libs during library detection
When for some reason the dependencies of the compiled mbed TLS libaries (libmbedtls, libmbedcrypto and libmbedx509) are not correct, the configure script will fail to link against libmbedcrypto and/or libmbedx509. This is reported to happen after using 'make install' to install mbedtls.
This patch makes sure the configure tests link to all three. The build process itself already did.
--- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
configure.ac +2 -1
@@ -843,7 +843,8 @@ elif test "${with_crypto_library}" = "mbedtls"; then saved_LIBS="${LIBS}" if test -z "${MBEDTLS_CFLAGS}" -a -z "${MBEDTLS_LIBS}"; then - # if the user did not explicitly specify flags, try to autodetect + # if the user did not explicitly specify flags, try to autodetect + LIBS="${LIBS} -lmbedtls -lmbedcrypto -lmbedx509" AC_CHECK_LIB( [mbedtls], [mbedtls_ssl_init],
Signature · 1 line
2.7.4
ACK. Tested on ubuntu 14.04 with "default Makefile"-installed mbedtls (it works if you have cmake build your Makefile first...)
Your patch has been applied to the master branch.
gmane archive lookup is broken right now, so no URL: below - but the message ID is there.
commit e860059baa912ced7acf00f9b1e85a3d80dc0b1f
Author: Steffan Karger Date: Sun May 1 20:23:06 2016 +0200
configure.ac: link to all mbed TLS libs during library detection
Signed-off-by: Steffan Karger <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hi,
Quoted 7 lines · Steffan Karger
When for some reason the dependencies of the compiled mbed TLS libaries (libmbedtls, libmbedcrypto and libmbedx509) are not correct, the configure script will fail to link against libmbedcrypto and/or libmbedx509. This is reported to happen after using 'make install' to install mbedtls.
This patch makes sure the configure tests link to all three. The build process itself already did.
It originally looked good on my test systems, but I found more caveats - when you have static libraries, dependency resolving only happens left-to-right, and libmbedx509.a wants stuff from libmbedcrypto.a - so we end up with
configure:28582: gcc -o conftest -g -O2 conftest.c -lmbedtls
-lresolv -lmbedtls -lmbedcrypto -lmbedx509 >&5
Undefined first referenced
symbol in file mbedtls_pk_load_file /usr/lib/libmbedx509.a(x509_crt.o) mbedtls_pk_parse_subpubkey /usr/lib/libmbedx509.a(x509_crt.o)
ld: fatal: symbol referencing errors. No output written to conftest
... unless we change the ordering. Patch below.
(Linking the final openvpn seems to work no matter what library order, because some .o "further to the left" already uses these functions, so when the linker looks at libmedx509.a unresolved symbols, it already knows where to find them. Still changing both places to be consistent)
gert
Quoted 6 lines · Gert Doering
configure.ac +0
-0@@ -844,11 +844,11 @@ elif test "${with_crypto_library}" = "mbedtls"; then if test -z "${MBEDTLS_CFLAGS}" -a -z "${MBEDTLS_LIBS}"; then # if the user did not explicitly specify flags, try to autodetect
configure.ac elif test "${with_crypto_library}" = "mbedtls"; then · line 854
Quoted 10 lines
configure.ac +2
-2- LIBS="${LIBS} -lmbedtls -lmbedcrypto -lmbedx509" + LIBS="${LIBS} -lmbedtls -lmbedx509 -lmbedcrypto" AC_CHECK_LIB( [mbedtls], [mbedtls_ssl_init], - [MBEDTLS_LIBS="-lmbedtls -lmbedcrypto -lmbedx509"], + [MBEDTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"], [AC_MSG_ERROR([Could not find mbed TLS.])], [${PKCS11_HELPER_LIBS}] )
Yes, makes sense. ACK.
-Steffan
[Openvpn-devel] [PATCH applied] Re: Fix library order in -lmbedtls test.
In reply to Gert DoeringPatch has been applied to the master branch.
commit 1ae17b7e97881ab57352b0bd525f15e6e9b60011
Author: Gert Doering Date: Thu May 5 13:48:16 2016 +0200
Fix library order in -lmbedtls test.
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Steffan Karger <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11605
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering