Menu

#1374 configure: fix checking for DTLS_method

backport-needed
open
nobody
None
5
2018-09-17
2018-09-12
No

configure: fix checking for DTLS_method

During checking of DTLS_method, the stub program is linked only with -ssl
libssl.a lacks some function from -lcrypto:
RAND_()
ERR_
()
BUF_MEM_*()
etc.
and -lz:
- inflate()
- deflate()

Append -lcrypto and -lz to LIBS variable when checking DTLS_method.

1 Attachments

Discussion

  • Bart Van Assche

    Bart Van Assche - 2018-09-16

    Since I would like to test this patch before applying it: on which operating system did you develop and test this patch?

     
  • Bart Van Assche

    Bart Van Assche - 2018-09-16

    How about this patch?

    diff --git a/configure b/configure
    index 6504a8e58a20..63d9b0cccc46 100755
    --- a/configure
    +++ b/configure
    @@ -23197,7 +23197,7 @@ if ${ac_cv_lib_crypto_EVP_md5+:} false; then :
       $as_echo_n "(cached) " >&6
     else
       ac_check_lib_save_LIBS=$LIBS
    -LIBS="-lcrypto  $LIBS"
    +LIBS="-lcrypto -lz $LIBS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     /* end confdefs.h.  */
    
    @@ -23291,7 +23291,7 @@ _ACEOF
                 LIBS="$netsnmp_save_LIBS"
             fi
             netsnmp_save_LIBS="$LIBS"
    -        LIBS="-lssl"
    +        LIBS="-lssl $LIBCRYPTO"
             for ac_func in TLS_method TLSv1_method DTLS_method DTLSv1_method                       SSL_library_init SSL_load_error_strings
     do :
       as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
    diff --git a/configure.d/config_os_libs2 b/configure.d/config_os_libs2
    index 4a1ad1551f95..c91b4818d556 100644
    --- a/configure.d/config_os_libs2
    +++ b/configure.d/config_os_libs2
    @@ -306,7 +306,7 @@ if test "x$tryopenssl" != "xno" -a "x$tryopenssl" != "xinternal"; then
             LIBS="$netsnmp_save_LIBS"
    
             if test x$CRYPTO = x; then
    -            AC_CHECK_LIB([crypto], [EVP_md5], [CRYPTO="crypto"])
    +            AC_CHECK_LIB([crypto], [EVP_md5], [CRYPTO="crypto"], [], [-lz])
             fi
    
             if test x$CRYPTO != x; then
    @@ -342,7 +342,7 @@ if test "x$tryopenssl" != "xno" -a "x$tryopenssl" != "xinternal"; then
                 LIBS="$netsnmp_save_LIBS"
             fi
             netsnmp_save_LIBS="$LIBS"
    -        LIBS="-lssl"
    +        LIBS="-lssl $LIBCRYPTO"
             AC_CHECK_FUNCS([TLS_method TLSv1_method DTLS_method DTLSv1_method]dnl
                            [SSL_library_init SSL_load_error_strings])
             LIBS="$netsnmp_save_LIBS"
    
     
  • Bart Van Assche

    Bart Van Assche - 2018-09-17

    A version of this patch that also works for Windows has been pushed out. Please retest.

     
  • Giulio Benetti

    Giulio Benetti - 2018-09-17

    Sorry, same problem as before, but we're almost there.
    Now it's missing only zlib on "checking for DTLS_method"
    I'm going to try to fix your patch too.

    Here you have a Merge request for the same problem though:
    https://sourceforge.net/p/net-snmp/code/merge-requests/17/

     

    Last edit: Giulio Benetti 2018-09-17
  • Giulio Benetti

    Giulio Benetti - 2018-09-17

    Found the problem.
    There was a mix of issues.
    Going to send a patch for libz check in static linking.

     
  • Bart Van Assche

    Bart Van Assche - 2018-09-17

    Please retest with the latest master branch.

     
  • Giulio Benetti

    Giulio Benetti - 2018-09-17

    And invert AC_CHECK_LIB like below too?
    Because otherwise, with latest master we've got the same -lz dependency problem.

           if test x$CRYPTO = x; then
                AC_CHECK_LIB([crypto], [EVP_md5],
                             [CRYPTO="crypto"; LIBCRYPTO="-lcrypto -lz"], [
                    AC_CHECK_LIB([crypto], [EVP_md5],
                             [CRYPTO="crypto"; LIBCRYPTO="-lcrypto"])], [], [-lz])
            else
                LIBCRYPTO="-l${CRYPTO}"
            fi
    
     
  • Bart Van Assche

    Bart Van Assche - 2018-09-17

    No. I think that the root cause was not the order of the tests but caching of the test results. A change that clears the cached result has been checked in. Hence please retest with the latest master branch.

     
  • Giulio Benetti

    Giulio Benetti - 2018-09-17

    I explained myself bad. I've already tried, but stil gives problem with DTLS.

    So:
    Build static with master and AC_CHECK_LIB() with -lz inverted works.
    Now I'm going to compile without -lz, so let's see what happens

    Any other idea?

     

    Last edit: Giulio Benetti 2018-09-17
  • Giulio Benetti

    Giulio Benetti - 2018-09-17

    I mean I recompile Buildroot from scratch with same Architecture, static and without zlib package.
    All with my latest patch inverting the testing of -lz.
    So let's see if that rules(nested AC_CHECK_LIB()) works or not.
    If I find it tries to link with -lz, there is something wrong, otherwise it should be ok.

     
  • Giulio Benetti

    Giulio Benetti - 2018-09-17

    And of course my patch on top of latest commit of master you've pointed me.

     
  • Giulio Benetti

    Giulio Benetti - 2018-09-17

    Pardon, you were right.
    configure recognizes correctly EVP_md5 linking it with -lz
    But still getting error:
    The DTLS based transports require the libssl library from OpenSSL to be available and support DTLS

    I dig more.

     
  • Giulio Benetti

    Giulio Benetti - 2018-09-17

    Well, using AC_MSG_NOTICE() as logger, I've found the problem.
    I open another Merge Request.
    There shouldn't be other drawbacks.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.