![Giulio Benetti](/assets/img/avatar_default.png)
In commit: https://git.buildroot.net/buildroot/commit/?id=13722d58f77d0e9fea9eefc50bf083d19f835433 Patch "0003-configure-Invert-AC_CHECK_LIB-EVP_md5-.-without-lz-w.patch" was intended to fix AC_CHECK_FUNCS() failure on openssl functions. This was due to missing -lz during static linking. But the patch is wrong and results in explicitly linking against -lz in both shared and static build. This makes no sense, since shared linking has transitive dependency so it doesn't need to list -lz after -lssl, -lssl is enough. Differently static linking needs -lz to be listed after -lssl. So the real cause of previous build failure: http://autobuild.buildroot.net/results/881/881139fb049738b16609d39ad5a49bd77ff6b4aa/ is that when AC_CHECK_FUNCS(), $LIBS variable is overwritten with $LIBCRYPTO without taking into accout previous $LIBS content(i.e. where -lz is present). This results in AC_CHEC_FUNCS() to fail while trying to statically link without listing -lz. Then: - Remove current "0003-configure-Invert-AC_CHECK_LIB-EVP_md5-.-without-lz-w.patch" - Add patch "0003-configure-fix-AC_CHECK_FUNCS-EVP_sha224-EVP_sha384-..patch" where add $LIBS content to tail of new $LIBS variable like this: LIBS="$LIBCRYPTO $LIBS" NOTE: $LIBS is at the end to ensure static linking to work correctly. - Add patch 0004-configure-fix-AC_CHECK_FUNCS-TLS_method-TLSv1_method.patch where add $LIBS content to tail of new $LIBS variable like this: LIBS="-lssl $LIBCRYPTO $LIBS" NOTE: $LIBS is at the end to ensure static linking to work correctly. This way AC_CHECK_FUNCS(), when static linking, try to link with -lz too appending it at the end of linking library list. And after every AC_CHECK_FUNCS(), previously saved $LIBS variable gets back to its original value(i.e. containing -lz if present) resulting in having or not -lz appended to library list according to static or shared build. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
40 lines
1.4 KiB
Diff
40 lines
1.4 KiB
Diff
From 1ab6e3fc3cf61fa5a7b7363e59095e868474524b Mon Sep 17 00:00:00 2001
|
|
From: Giulio Benetti <giulio.benetti@micronovasrl.com>
|
|
Date: Mon, 15 Oct 2018 19:34:26 +0200
|
|
Subject: [PATCH 2/2] configure: fix AC_CHECK_FUNCS(TLS_method TLSv1_method
|
|
...) failure on static linking
|
|
|
|
If building as static lib, AC_CHECK_FUNCS(TLS_method TLSv1_method ...)
|
|
fails due to missing -lz in $LIBS.
|
|
At the moment, $LIBS contains "-lssl $LIBCRYPTO" only discarding
|
|
previous $LIBS content.
|
|
|
|
Add $LIBS to:
|
|
LIBS="-lssl $LIBCRYPTO"
|
|
as:
|
|
LIBS="-lssl $LIBCRYPTO $LIBS"
|
|
This way $LIBS will contain -lz at the end of linking command that in
|
|
static linking build is mandatory.
|
|
|
|
Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
|
|
---
|
|
configure.d/config_os_libs2 | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/configure.d/config_os_libs2 b/configure.d/config_os_libs2
|
|
index 93044000b..c811c63ec 100644
|
|
--- a/configure.d/config_os_libs2
|
|
+++ b/configure.d/config_os_libs2
|
|
@@ -349,7 +349,7 @@ if test "x$tryopenssl" != "xno" -a "x$tryopenssl" != "xinternal"; then
|
|
LIBS="$netsnmp_save_LIBS"
|
|
fi
|
|
netsnmp_save_LIBS="$LIBS"
|
|
- LIBS="-lssl $LIBCRYPTO"
|
|
+ LIBS="-lssl $LIBCRYPTO $LIBS"
|
|
AC_CHECK_FUNCS([TLS_method TLSv1_method DTLS_method DTLSv1_method]dnl
|
|
[SSL_library_init SSL_load_error_strings])
|
|
LIBS="$netsnmp_save_LIBS"
|
|
--
|
|
2.17.1
|
|
|