编译linphone Android

这里写自定义目录标题

编译步骤:(参考ReadMe)

在编译之前,需要修改如下文件权限,一定要在编译之前修改,否则编译会失败
chmod u+x linphone-sdk/cmake/Android/gradlew
chmod u+x llinphone-sdk/external/libvpx/configure
chmod u+x linphone-sdk/cmake/dummy.sh
chmod u+x linphone-sdk/external/libvpx/build/make/*
创建build 目录
开启编译选项:
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DLINPHONESDK_PLATFORM=Android …
编译SDK
cmake --build .
需要安装:

apt install android sdk (命令自行查找)wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
下载android-ndk-r21-linux-x86_64.zip ,安装后设置环境变量
下载commandlinetools-linux-6200805_latest.zip ,并解压到$ANDROID_HOME/cmdline-tools/, 添加路径环境变量(解决下面问题1)
sudo apt-get install clang (安装clang)
sudo apt-get install g+±multilib (安装多依赖库编译)

获取源码(修改):

7z x linphone_sdk.7z -r -o. (-o 后面没有空格直接带解压后目标路径)
在编译之前可以执行以下命令更新子模块
git submodule sync && git submodule update --init --recursive

修改下面目录下 dummy.sh ,添加执行权限: chmod u+x
/home/opt/xiongxc/android/linphone-sdk/cmake/

注意一定要从源码开始直接编译android SDK,同一个代码库不能编译了desktop后再编android

编译过程中遇到文件不可执行的问题,通过下面命令
find . -name *.sh | xargs chmod u+x

git源码地址https://gitlab.linphone.org/BC/public/linphone-sdk.git --recursive

问题1:
报错:
Android Platform 28 SDK license not accepted
解决方法:
yes | sdkmanager --licenses && sdkmanager --update

问题2:
sdkmanager command not found
解决方法:

  1. android studio 官网下载commandlinetools-linux-6200805_latest.zip
  2. https://stackoverflow.com/questions/60440509/android-command-line-tools-sdkmanager-always-shows-warning-could-not-create-se

Set your preferred ANDROID_HOME (just like before)
Download and unpack the commandlinetools zip file into a directory called cmdline-tools, which is inside ANDROID_HOME
Append the directory $ANDROID_HOME/cmdline-tools/tools/bin to environment variable PATH, so that the system knows where to find sdkmanager
sdkmanager下载
https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip

问题3:

/opt/linphone-sdk-build/linphone-sdk/build/android-armv7/EP_vpx_configure.sh: Permission denied

find . -name *.sh | xargs chmod u+x

其他问题1:

报错 speed
修改:/opt/linphone-sdk/build/WORK/android-arm64/Build/ms2/CMakeCache.txt
//Path to a file.SPEEXDSP_INCLUDE_DIRS:PATH=SPEEXDSP_INCLUDE_DIRS-NOTFOUND
SPEEXDSP_INCLUDE_DIRS:PATH=/usr/include/
//Path to a library.SPEEXDSP_LIBRARIES:FILEPATH=SPEEXDSP_LIBRARIES-NOTFOUND
SPEEXDSP_LIBRARIES:FILEPATH=/usr/lib/x86_64-linux-gnu/

其他问题2:
/usr/include/features.h:448:10: fatal error: ‘gnu/stubs.h’ file not found
#include
^~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/gnu/stubs.h
解决方法:
sudo apt-get install g+±multilib

编译完成:
在…/build/linphone-sdk/desktop