Configure finds broken libsrtp2

I am using a USB drive mounted at /tmp/usb as target for my asterisk installation. On this USB drive I install asterisk and all of it’s dependencies, then I move it to an embedded device which runs asterisk. This was working great with all versions that I tried it on up to 19.4.1. Now I switched to asterisk 20 and it is no longer detecting a proper libsrtp2 because it can’t find libcrypto.so.1.1:

configure:33001: checking for srtp_init in -lsrtp2
configure:33024: gcc -std=gnu11 -o conftest -g -O2    conftest.c -lsrtp2 -L/tmp/usb//lib  -lm  >&5
/usr/bin/ld: warning: libcrypto.so.1.1, needed by /tmp/usb//lib/libsrtp2.so, not found (try using -rpath or -rpath-link)
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_CIPHER_CTX_reset@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_aes_128_gcm@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_CIPHER_CTX_ctrl@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `HMAC_CTX_free@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_aes_192_ctr@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `OPENSSL_cleanse@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `HMAC_Init_ex@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_EncryptFinal_ex@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_Cipher@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_EncryptUpdate@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `HMAC_CTX_new@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_CIPHER_CTX_free@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_sha1@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_aes_256_gcm@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `HMAC_Final@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_EncryptInit_ex@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `HMAC_Update@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_aes_128_ctr@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_CIPHER_CTX_new@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_CipherInit_ex@OPENSSL_1_1_0'
/tmp/usb//lib/libsrtp2.so: undefined reference to `EVP_aes_256_ctr@OPENSSL_1_1_0'
collect2: error: ld returned 1 exit status

However, /tmp/usb//lib/libcrypto.so.1.1 exists and contains those symbols. I assume I need to set rpath somehow, asterisk does even detect that and sets AST_RPATH='-Wl,-rpath,${exec_prefix}/lib', however that doesn’t seem to be used when checking if libsrtp is usable and works properly. How can I fix this and why was it working before? Should I just add the rpath option to my CCFLAGS so it is always used?

Adding to this: I manually created the test-c-file and ran
gcc -std=gnu11 -o conftest -g -O2 conftest.c -lsrtp2 -L/tmp/usb/lib -lm
which didn’t work while
gcc -std=gnu11 -o conftest -g -O2 conftest.c -lsrtp2 -L/tmp/usb/lib -lm -Wl,--rpath=/tmp/usb/lib
did work. So when the AST_RPATH stuff gets added to the test-compiler-call it should work properly. Now the interesting question is if this is a bug, intended behaviour and/or if there are negative side-effects if the configure-script is modified to use AST_RPATH for checking if libraries exist.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.