libssh2 / libssh2

the SSH library

Home Page:https://libssh2.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autotools cannot cross-build with openssl 1.1.1t for Raspbian

DevAGCO opened this issue · comments

Describe the bug
When building the library with Raspberry Pi's official cross-compiling tools, and using newer version of openssl (through conan), the linker error below shows up.
Configured with CMake:
find_package(OpenSSL REQUIRED)
configure --host=arm-linux-gnueabihf --with-libssl-prefix=${OpenSSL_LIB_DIRS}/..

To Reproduce
Build the project as a CMake "ExternalProject" using the official Raspberry Pi cross-compiling tools: https://github.com/raspberrypi/tools.

Interesting observation:

  • it builds fine with older version of openSSL (1.0.2s)

Expected behavior
Building smoothly.

Version (please complete the following information):

  • Ubuntu 20.04
  • libssh2 version: 1.11.0
  • openSSL version: 1.1.1t

Additional context
Error message:

../../staging/usr/lib/libssh2.a(crypto.o): In function `_libssh2_cipher_init':
crypto.c:(.text+0xa4c): undefined reference to `EVP_CIPHER_CTX_init'
../../staging/usr/lib/libssh2.a(crypto.o): In function `_libssh2_openssl_crypto_init':
crypto.c:(.text+0xc90): undefined reference to `OPENSSL_add_all_algorithms_noconf'
crypto.c:(.text+0xc94): undefined reference to `OpenSSL_add_all_ciphers'
crypto.c:(.text+0xc98): undefined reference to `OpenSSL_add_all_digests'
../../staging/usr/lib/libssh2.a(crypto.o): In function `_libssh2_sha1_init':
crypto.c:(.text+0x2858): undefined reference to `EVP_MD_CTX_init'
../../staging/usr/lib/libssh2.a(crypto.o): In function `_libssh2_sha1':
crypto.c:(.text+0x28a8): undefined reference to `EVP_MD_CTX_init'
../../staging/usr/lib/libssh2.a(crypto.o): In function `_libssh2_sha256_init':
crypto.c:(.text+0x292c): undefined reference to `EVP_MD_CTX_init'
../../staging/usr/lib/libssh2.a(crypto.o): In function `_libssh2_sha256':
crypto.c:(.text+0x297c): undefined reference to `EVP_MD_CTX_init'
../../staging/usr/lib/libssh2.a(crypto.o): In function `_libssh2_sha384_init':
crypto.c:(.text+0x2a00): undefined reference to `EVP_MD_CTX_init'
../../staging/usr/lib/libssh2.a(crypto.o):crypto.c:(.text+0x2a50): more undefined references to `EVP_MD_CTX_init' follow
../../staging/usr/lib/libssh2.a(crypt.o): In function `crypt_dtor':
crypt.c:(.text+0x1b0): undefined reference to `EVP_CIPHER_CTX_cleanup'
../../staging/usr/lib/libssh2.a(mac.o): In function `mac_method_hmac_sha2_512_hash':
mac.c:(.text+0xdc): undefined reference to `HMAC_CTX_init'
mac.c:(.text+0x180): undefined reference to `HMAC_CTX_cleanup'
../../staging/usr/lib/libssh2.a(mac.o): In function `mac_method_hmac_sha2_256_hash':
mac.c:(.text+0x1c8): undefined reference to `HMAC_CTX_init'
mac.c:(.text+0x26c): undefined reference to `HMAC_CTX_cleanup'
../../staging/usr/lib/libssh2.a(mac.o): In function `mac_method_hmac_sha1_hash':
mac.c:(.text+0x2b4): undefined reference to `HMAC_CTX_init'
mac.c:(.text+0x358): undefined reference to `HMAC_CTX_cleanup'
../../staging/usr/lib/libssh2.a(mac.o): In function `mac_method_hmac_md5_hash':
mac.c:(.text+0x418): undefined reference to `HMAC_CTX_init'
mac.c:(.text+0x4bc): undefined reference to `HMAC_CTX_cleanup'
../../staging/usr/lib/libssh2.a(mac.o): In function `mac_method_hmac_ripemd160_hash':
mac.c:(.text+0x57c): undefined reference to `HMAC_CTX_init'
mac.c:(.text+0x620): undefined reference to `HMAC_CTX_cleanup'
collect2: error: ld returned 1 exit status

Can you post the complete build log?

We would need a verbose log output for a failing build to see what is happening. Cross-builds are prone to pick up the wrong/mismatched header / lib, which seems to be a likely cause in this case as well.

Can't reproduce...
Managed to build with 1.1.1u succesfully today.

Thanks for your feedbacks @DevAGCO.