Android 使用 openssl 构建 PJSIP [英] Android build PJSIP with openssl
问题描述
我正在尝试在支持 SSL/TLS 的 Android 上构建 PJSIP.
I'm trying to build PJSIP on Android with SSL/TLS support.
我按照 这个答案成功构建了 OpenSSL(没有 fips,作为共享-.so 库)并将其安装在 ~/android(创建了 ~/android/ssl 目录).
I successfully built OpenSSL following this answer (without fips, as shared-.so libraries) and installed it in ~/android (which created the ~/android/ssl directory).
现在,当我这样做
./configure-android --with-ssl=/home/andrea/android/ssl
查看 config.log,第一个错误状态
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.
因此禁用 SSL 支持:
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'
但是libdl.so存在于ndk的目录中:
but libdl.so exists in the ndk's directory:
<ndk-dir>/platforms/android-14/arch-arm/usr/lib/
我想我必须告诉 ld 其他图书馆在哪里,ld 的建议是什么意思?
I guess I have to tell ld where the other libraries are, what does ld's suggestion mean?
try using -rpath or -rpath-link
我不明白 -rpath 或 rpath-link 是什么,也不明白在哪里应用它们.
I can't understand what -rpath or rpath-link are or where to apply them .
有什么想法吗?
推荐答案
我成功地使用 OpenSSL 构建了 PJSIP.请按照以下步骤操作:
I successfully built PJSIP with OpenSSL. please follow the following steps:
首先下载 openssl-android 并通过阅读自述文件进行编译.(把你的 android-ndk
放到 PATH
并在 openssl-android
根目录下执行命令 ndk-build
)然后只是将 libcrypto.so
和 libssl.so
从 libs/armeabi/
文件夹复制到 lib/
文件夹中的 lib/
code>openssl-android(你可以创建这个文件夹).你的目录结构现在应该是这样的:openssl-android/
-> 应用程序
->crypto
->include
->jni
->lib
->libs
->...
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
->...
现在只在pjsip的根目录下执行:./configure-android --with-ssl=/home/your-user-name/path-to-openssl-android-dir
now just execute in root directory of pjsip:
./configure-android --with-ssl=/home/your-user-name/path-to-openssl-android-dir
为了确认包含 openssl,只需将此命令通过管道传递给 grep,例如:
<代码>./configure-android --with-ssl=/home/your-user-name/path-to-openssl-android-dir |grep -wi ssl
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
然后您将看到这一行 result: OpenSSL library found, SSL support enabled
.这意味着,现在为您的 PJSIP 启用了 OpenSSL.现在你可以继续正常了.
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.
希望这会有所帮助.
这篇关于Android 使用 openssl 构建 PJSIP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!