Forums » Development »
[Solved] A compilation error about mbedtls
Added by ouyang.wei.victor 12 months ago
When I tried to compile lighttpd with mbedtls 3.2.0, the following error occurred
configure:18214: /arm-x86-sysroots/i686-linux/usr/bin/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -o conftest -std=c11 -fPIC -I/home/o99130/mbedtls/output/include -I/arm-x86-sysroots/acp-am335x-cpm3/usr/include -I/home/o99130/work/sic-or/3rdparty/misc/lighttpd/lighttpd-1.4.73/../../../openlib/pcre2/lib/../include -I/arm-x86-sysroots/acp-am335x-cpm3-13-3-LCD/usr/include -I/arm-x86-sysroots/acp-am335x-cpm3/usr/include/c++/4.9.1 -I/arm-x86-sysroots/acp-am335x-cpm3/usr/include/c++/4.9.1/arm-linux-gnueabihf --sysroot=/arm-x86-sysroots/acp-am335x-cpm3 -D_REENTRANT -I/home/o99130/mbedtls/output//include -fPIC -L/arm-x86-sysroots/acp-am335x-cpm3/usr/lib -L/home/o99130/mbedtls/output/lib/ -L/home/o99130/work/sic-or/3rdparty/misc/lighttpd/lighttpd-1.4.73/../../../openlib/pcre2/lib/ --sysroot=/arm-x86-sysroots/acp-am335x-cpm3 -L/home/o99130/mbedtls/output//lib conftest.c -lmbedtls -lmbedcrypto -ldl >&5 /arm-x86-sysroots/i686-linux/usr/bin/arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.1/../../../../arm-linux-gnueabihf/bin/ld: warning: libmbedx509.so.4, needed by /home/o99130/mbedtls/output/lib//libmbedtls.so, not found (try using -rpath or -rpath-link) /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_free' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_info' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_profile_default' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_verify_restartable' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_check_key_usage' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_get_name' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_check_extended_key_usage' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_parse_der' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_dn_gets' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_init' /home/o99130/mbedtls/output/lib//libmbedtls.so: undefined reference to `mbedtls_x509_crt_profile_suiteb'
The error output indicates that libmbedtls.so depends on libmbedx509.so. However, the configure file test compilation environment does not link to libmbedx509.so. Change line 18189 to
LIBS="-lmbedtls -lmbedx509 -lmbedcrypto "$DL_LIB" $LIBS"
Compilation passed.Hope it helps people who have the same problem as me.
Replies (1)
RE: A compilation error about mbedtls - Added by gstrauss 12 months ago
--- a/configure.ac +++ b/configure.ac @@ -764,7 +764,7 @@ if test "x$use_mbedtls" = "xyes"; then AC_DEFINE(HAVE_LIBMBEDTLS, [1], [Have libmbedtls library]) AC_DEFINE(HAVE_LIBMBEDX509, [1], [Have libmbedx509 library]) AC_DEFINE(HAVE_LIBMBEDCRYPTO, [1], [Have libmbedcrypto library]) ], - [],[-lmbedcrypto "$DL_LIB"]) + [],[-lmbedx509 -lmbedcrypto "$DL_LIB"]) ],[],[-lmbedcrypto "$DL_LIB"]) ],[],[]) LIBS="$OLDLIBS"