Мы столкнулись с проблемой компиляции PjSip
Ниже приведены мои сценарии сборки:
androidPaths:
MacBook-Pro:~ gokul$ pwd
/Users/apple
MacBook-Pro:~ gokul$ sudo -s
Password:
MacBook-Pro:~ root# cat androidPaths
export ANDROID_NDK=/Users/apple/Library/Android/sdk/ndk/19.2.5345600
export ANDROID_NDK_ROOT=/Users/apple/Library/Android/sdk/ndk/19.2.5345600
export NDK_ROOT=/Users/apple/Library/Android/sdk/ndk/19.2.5345600
export ANDROID_SDK=$HOME/Library/Android/sdk
PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK
PATH=$PATH:$ANDROID_SDK/build-tools/28.0.3
export PATH=$PATH:.
export ANDROID_HOME=$ANDROID_SDK
Ниже приведен мой bashr c config:
MacBook-Pro:~ root# cat .bashrc
if [ -f /etc/bashrc ]; then . /etc/bashrc
fi
export SDK_PATH=$HOME/Library/Android/sdk
export LANG=C; export LC_ALL=C
export LANG=en_US.UTF-8
export PATH=$PATH:$JAVA_HOME:/Users/apple/Library/Android/sdk/ndk/19.2.5345600:$HOME/Library/Android/sdk/platform-tools:$JAVA_HOME/bin:$JAVA_HOME/lib:$SDK_PATH/tools:$SDK_PATH/platform-tools
export ANDROID_NDK=/Users/apple/Library/Android/sdk/ndk/19.2.5345600
export ANDROID_NDK_ROOT=/Users/apple/Library/Android/sdk/ndk/19.2.5345600
export ANDROID_SDK=$HOME/Library/Android/sdk
PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platformtools:$ANDROID_NDK
export SWIG=$HOME/Library/pjsip/swig-4.0.1
PATH=$PATH:$SWIG
export PCRE_PATH=$HOME/Library/pjsip/pcre/bin
PATH=$PATH:$PCRE_PATH
Ниже представлен мой 32-битный скрипт Openssl:
turn off debug and assertions
echo "------------------------------------------------------------------source android
paths"
. ~/androidPaths
export NDK=/Users/apple/Library/Android/sdk/ndk/19.2.5345600
Only choose one of these, depending on your build machine...
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
Only choose one of these, depending on your device...
export TARGET=aarch64-linux-android
export TARGET=armv7a-linux-androideabi
export TOOL=arm-linux-androideabi
export TARGET=i686-linux-android
export TARGET=x86_64-linux-android
Set this to your minSdkVersion.
export API=23
Configure and build.
export AR=$TOOLCHAIN/bin/$TOOL-ar
export AS=$TOOLCHAIN/bin/$TOOL-as
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/$TOOL-ld
export RANLIB=$TOOLCHAIN/bin/$TOOL-ranlib
export STRIP=$TOOLCHAIN/bin/$TOOL-strip
export TOOLCHAIN_PATH=$NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin
export NDK_TOOLCHAIN_BASENAME=${TOOLCHAIN_PATH}/${TOOL}
export PATH=$TOOLCHAIN_PATH:$PATH
Set the Android API levels
ANDROID_API=23
//Set the target architecture
//Can be android-arm, android-arm64, android-x86 etc
architecture=android-arm
//modify the tar file name and all associated paths with each newer version
echo "------------------------------------------------------------------extraction from tar file..."
rm -rf arm
rm -rf openssl-1.1.1d
tar xvzf openssl-1.1.1d.tar.gz
echo "------------------------------------------------------------------Move to openssl..."
pushd openssl-1.1.1d
echo "------------------------------------------------------------------Make arm..."
./Configure ${architecture} -D__ANDROID_API__=$ANDROID_API
PATH=$TOOLCHAIN_PATH:$PATH make
#echo $PATH
popd
echo "------------------------------------------------------------------move arm components..."
mkdir arm
cp openssl-1.1.1d/*.so arm/.
cp openssl-1.1.1d/*.a arm/.
cp -rf openssl-1.1.1d/include arm/.
Скрипт сборки PjSip:
buildSip () { # args in order : TARGETABI, WITHSSL, JNILIBPATH
echo "----------------------------------------- BUILDING $TARGET_ABI ------------------------------"
echo "------------------------------------------------------------------extraction from tar file..."
tar xvjf pjproject-2.9.tar.bz2
echo "------------------------------------------------------------------modify default source..."
modifySource
pushd pjproject-2.9
echo "------------------------------------------------------------------configuring build..."
echo $1
echo $2
echo $3
APP_PLATFORM=android-23 TARGET_ABI=$1 ./configure-android --use-ndk-cflags --enable-opus-codec --enable-silk-codec --with-ssl=$2
make dep
make clean
make
pushd pjsip-apps/src/swig
make clean
make
popd
popd
echo "------------------------------------------------------------------extract shared libs"
cp -f pjproject-2.9/pjsip-apps/src/swig/java/android/app/src/main/jniLibs/armeabi-v7a/libpjsua2.so $3
}
extractSwigBindings () {
echo "------------------------------------------------------------------extract swig bindings"
cp -f pjproject-2.9/pjsip-apps/src/swig/java/android/app/src/main/java/org/pjsip/pjsua2/*.java org/pjsip/psjua
}
//echo "------------------------------------------------------------------Fail on first error..."
set -e
//turn off debug and assertions
export CFLAGS="-O0 -DNDEBUG"
echo "C_INCLUDE_PATH" $C_INCLUDE_PATH
echo "C_INCLUDE_PATH" $C_INCLUDE_PATH
echo "------------------------------------------------------------------source android paths"
source /Users/apple/androidPaths
echo ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
rm -rf jniLibs
rm -rf org
rm -rf pjproject-2.9
mkdir -p jniLibs/armeabi-v7a
mkdir -p jniLibs/arm64-v8a
mkdir -p org/pjsip/psjua
buildSip armeabi-v7a /Users/apple/Library/OpenSSLSetup/arm jniLibs/armeabi-v7a
extractSwigBindings
Проблема, которую мы получаем:
Openssl собирается успешно, и с помощью файлов .so я пытаюсь собрать PJSIP 2.9
Users/apple/Library/Android/sdk/ndk/19.2.5345600/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: fatal error: /Users/apple/Library/Android/sdk/ndk/19.2.5345600/sources/android/support/include: pread failed: Is a directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [android/app/src/main/jniLibs/armeabi-v7a/libpjsua2.so] Error 1
. Пожалуйста, предложите мне, где я делаю что-то не так, или дайте какие-либо ссылочные ссылки с предложениями или решением, которые были бы признательны.