3

我在我的 android 应用程序中使用CSipSimple库来实现 VoIP 呼叫功能,最近我的应用程序在 Play 商店中被拒绝,因为带有这些库的 OpenSSL 版本很旧。我需要根据新的/支持的 OpenSSL 版本更新 .so PJSIP 文件。

我正在尝试为 armeabi-v7、armeabi-v8a、armeabix86 和 armeabi 生成基于 OpenSSL(版本:openssl-1.1.1-pre6)的 .so 文件。我使用这些作为参考: 1. https://medium.com/@shehrazjazib/pjsip-build-for-android-with-integration-of-g729-codec-7d677ea68373 2. https://trac.pjsip.org /repos/wiki/Getting-Started/Android#OpenSSLSupport

我能够生成工具链并运行 configure-android 脚本。也能够成功执行 make dep。但是我在执行make时遇到错误,如下所示:

In file included from ../src/pjmedia-codec/openh264.cpp:19:
In file included from ../include/pjmedia-codec/openh264.h:22:
In file included from ../include/pjmedia-codec/types.h:28:
In file included from ../include/pjmedia-codec/config.h:35:
In file included from ../include/pjmedia/types.h:28:
In file included from ../include/pjmedia/config.h:27:
In file included from ../../pjlib/include/pj/config.h:313:
In file included from ../../pjlib/include/pj/compat/size_t.h:28:
In file included from /mnt/e/AndroidNDK/android-ndk-r17-linux-x86_64/android-ndk-r17/sources/cxx-stl/llvm-libc++/include/stddef.h:40:
/mnt/e/AndroidNDK/android-ndk-r17-linux-x86_64/android-ndk-r17/sources/cxx-stl/llvm-libc++/include/__config:169:10: fatal error:
      'features.h' file not found
#include <features.h>
         ^~~~~~~~~~~~
1 error generated.
/mnt/e/PJSIP/pjproject-2.7.2/build/rules.mak:173: recipe for target 'output/pjmedia-codec-arm-unknown-linux-androideabi/openh264.o' failed
make[2]: *** [output/pjmedia-codec-arm-unknown-linux-androideabi/openh264.o] Error 1
make[2]: Leaving directory '/mnt/e/PJSIPOpenSSL/pjproject-2.7.2/pjmedia/build'
Makefile:220: recipe for target 'libpjmedia-codec-arm-unknown-linux-androideabi.a' failed
make[1]: *** [libpjmedia-codec-arm-unknown-linux-androideabi.a] Error 2
make[1]: Leaving directory '/mnt/e/PJSIPOpenSSL/pjproject-2.7.2/pjmedia/build'
Makefile:14: recipe for target 'all' failed
make: *** [all] Error 1

我是原生android的新手,所以我对它知之甚少。我可以从 /usr/include 文件夹中插入 features.h ,但这反过来又会导致其他丢失的头文件出错。

请问谁能帮我解决这个错误?我需要能够为 PJSIP android 生成 .so 文件。

请注意:我在 Windows 10 操作系统上使用 Ubuntu bash。

编辑

我现在正在尝试在虚拟框中使用 ubuntu 操作系统,并在尝试使用 OpenSSL 生成 PjSip 文件时收到此链接器错误:

make depend && make _all
make[1]: Entering directory `/home/rspl/Downloads/openssl-1.1.0h'
make[1]: Leaving directory `/home/rspl/Downloads/openssl-1.1.0h'
make[1]: Entering directory `/home/rspl/Downloads/openssl-1.1.0h'
CC="/home/rspl/Downloads/android-ndk-r17/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Iusr/include --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm" /usr/bin/perl crypto/aes/asm/aes-armv4.pl void crypto/aes/aes-armv4.S
( trap "rm -f crypto/aes/aes-armv4.o.*" INT 0; \
      /home/rspl/Downloads/android-ndk-r17/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Iusr/include --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm -E  -I. -Icrypto/include -Iinclude -Icrypto -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -Wall -O3 -pthread -mandroid -fPIC --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm -Wa,--noexecstack  -fPIC -DOPENSSL_USE_NODELETE crypto/aes/aes-armv4.S | \
      /usr/bin/perl -ne '/^#(line)?\s*[0-9]+/ or print' > crypto/aes/aes-armv4.o.s && \
      /home/rspl/Downloads/android-ndk-r17/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Iusr/include --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -Wall -O3 -pthread -mandroid -fPIC --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm -Wa,--noexecstack  -fPIC -DOPENSSL_USE_NODELETE -c -o crypto/aes/aes-armv4.o crypto/aes/aes-armv4.o.s )
/home/rspl/Downloads/android-ndk-r17/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Iusr/include --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm  -I. -Icrypto/include -Iinclude -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -Wall -O3 -pthread -mandroid -fPIC --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm -Wa,--noexecstack  -fPIC -DOPENSSL_USE_NODELETE -MMD -MF crypto/aes/aes_cbc.d.tmp -MT crypto/aes/aes_cbc.o -c -o crypto/aes/aes_cbc.o crypto/aes/aes_cbc.c
/home/rspl/Downloads/android-ndk-r17/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Iusr/include --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm  -I. -Icrypto/include -Iinclude -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -Wall -O3 -pthread -mandroid -fPIC --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm -Wa,--noexecstack  -fPIC -DOPENSSL_USE_NODELETE -MMD -MF crypto/aes/aes_cfb.d.tmp -MT crypto/aes/aes_cfb.o -c -o crypto/aes/aes_cfb.o crypto/aes/aes_cfb.c
/home/rspl/Downloads/android-ndk-r17/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Iusr/include --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm  -I. -Icrypto/include -Iinclude -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -Wall -O3 -pthread -mandroid -fPIC --sysroot=/home/rspl/Downloads/android-ndk-r17/platforms/android-27/arch-arm -Wa,--noexecstack  -fPIC -DOPENSSL_USE_NODELETE -MMD -MF crypto/aes/aes_ecb.d.tmp -MT crypto/aes/aes_ecb.o -c -o crypto/aes/aes_ecb.o crypto/aes/aes_ecb.c
crypto/aes/aes_ecb.c:10:20: fatal error: assert.h: No such file or directory
 #include <assert.h>
                    ^
compilation terminated.
make[1]: *** [crypto/aes/aes_ecb.o] Error 1
make[1]: Leaving directory `/home/rspl/Downloads/openssl-1.1.0h'
make: *** [all] Error 2

由于 gcc 无法在 crypto/include 中找到头文件,因此我在 CFLAGS 中明确添加了 -Iusr/include 以仍然得到相同的错误。

4

1 回答 1

0

因为某些方法/文件已在高级版本的 NDK 中被弃用或删除。

尝试在配置注释的开头添加:NDK_TOOLCHAIN_VERSION=clang 或 NDK_TOOLCHAIN_VERSION=4.9。

于 2018-06-12T18:34:06.907 回答