问题
I'm trying to build PJSIP on Android with SSL/TLS support.
I successfully built OpenSSL following this answer (without fips, as shared-.so libraries) and installed it in ~/android (which created the ~/android/ssl directory).
Now, when i do
./configure-android --with-ssl=/home/andrea/android/ssl
and look at the config.log, the first error states
<ndk-directories-and-stuff>/arm-linux-androideabi/bin/ld: warning: libdl.so, needed by /home/andrea/android/ssl/lib/libcrypto.so, not found (try using -rpath or -rpath-link)
a lot of undefined references follow.
As consequence SSL support is disabled:
aconfigure:7012: result: ** OpenSSL libraries not found, disabling SSL support **
ac_cv_header_openssl_ssl_h=yes
ac_cv_lib_ssl_SSL_library_init=no
CFLAGS=' -I/home/andrea/android/android-ndk-r8e/platforms/android-14/arch-arm/usr/include -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -I/home/andrea/android/ssl/include'
LDFLAGS=' -nostdlib -L/home/andrea/android/android-ndk-r8e/platforms/android-14/arch-arm/usr/lib/ -L/home/andrea/android/ssl/lib'
ac_no_ssl=''
libssl_present=''
openssl_h_present='1'
but libdl.so exists in the ndk's directory:
<ndk-dir>/platforms/android-14/arch-arm/usr/lib/
I guess I have to tell ld where the other libraries are, what does ld's suggestion mean?
try using -rpath or -rpath-link
I can't understand what -rpath or rpath-link are or where to apply them .
any ideas?
回答1:
I successfully built PJSIP with OpenSSL. please follow the following steps:
First download openssl-android and compile it by reading ReadMe File. (Put your android-ndk
to PATH
and execute command ndk-build
in openssl-android
root) then just copy libcrypto.so
and libssl.so
from libs/armeabi/
folder to lib/
folder in root of openssl-android
(you can create this folder). your directory structure now should be like:openssl-android/
->apps
->crypto
->include
->jni
->lib
->libs
->...
now just execute in root directory of pjsip:./configure-android --with-ssl=/home/your-user-name/path-to-openssl-android-dir
for confirmation that openssl is included just pipe this command to grep like:./configure-android --with-ssl=/home/your-user-name/path-to-openssl-android-dir | grep -wi ssl
then you will see this line result: OpenSSL library found, SSL support enabled
. This means, OpenSSL is now enabled for your PJSIP. Now you can continue normal.
hope this helps.
来源:https://stackoverflow.com/questions/16632796/android-build-pjsip-with-openssl