Windows Linux子系统下编译LinPhone SDK

LinPhone

  • LinPhone
    • 环境配置
      • 代码下载
      • 编译环境配置
    • LinPhone SDK 编译

环境配置

编译环境:Windows10 WSL2 Ubuntu 20.04子系统

代码下载

git clone https://gitlab.linphone.org/BC/public/linphone-sdk.git
cd linphone-sdk
git submodule update --init --recursive

编译环境配置

  1. NDK下载

地址 https://developer.android.google.cn/ndk/downloads?hl=en

选择linux版本下载

注意下载 22 版本,不然编译会报错,这边下载的是 https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip

CMake Error at cmake/LinphoneSdkCheckBuildToolsAndroid.cmake:49 (message):

Unsupported Android NDK version 23. Please install version 22

  1. cmdline-tools 下载

地址 https://developer.android.com/studio#downloads

选择linux版本下载

  1. 配置Java环境

openjdk11下载地址 https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz

java配置

sudo vim /etc/profile
export PATH="usr/bin:$PATH"

# java
export JAVA_HOME=/mnt/c/Users/Von/library/linux/jdk-11
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=.:$JAVA_HOME/bin:$PATH

再运行

source /etc/profile
  1. 下载Android
## 注意 cmdline-tools 与 SDK 的路径关系
mkdir /mnt/c/Users/Von/library/linux/Android/Sdk
/mnt/c/Users/Von/library/linux/Android/Sdk/cmdline-tools/latest/bin$ ./sdkmanager --install "platforms;android-30"
./sdkmanager --install tools
./sdkmanager --install platform-tools
  1. 配置Android环境
sudo vim /etc/profile

添加如下配置

# Android NDK
export ANDROID_NDK_HOME=/mnt/c/Users/Von/library/linux/Android/android-ndk-r23
export PATH=$ANDROID_NDK_HOME:$PATH

# Android SDK
export ANDROID_HOME=/mnt/c/Users/Von/library/linux/Android/Sdk
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH

# Android cmd tool
export ANDROID_CMD_TOOL=$ANDROID_HOME/cmdline-tools/latest
export PATH=$ANDROID_CMD_TOOL/bin:$PATH

再运行

source /etc/profile
  1. 其他环境
sudo apt install cmake
sudo apt-get install python-is-python2
# pip 若无法下载
# curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
# sudo python2 get-pip.py
# 或者 下载python3-pip,具体情况,根据自己需要什么配置决定
sudo apt-get install python-pip
sudo apt-get install yasm
sudo apt-get install nasm
sudo apt-get install doxygen
sudo apt-get install pkg-config
pip install pystache
pip install six
sudo apt-get install clang
sudo apt-get install g++-multilib

LinPhone SDK 编译

chmod u+x linphone-sdk/cmake/Android/gradlew
chmod u+x linphone-sdk/external/libvpx/configure
chmod u+x linphone-sdk/cmake/dummy.sh
chmod u+x linphone-sdk/external/libvpx/build/make/*

创建编译脚本并运行

touch build.sh
vim build.sh
# 黏贴下面的脚本内容
chmod u+x build.sh
./build.sh

编译脚本,自行创建在linphone-sdk工程根路径下

mkdir -p build && cd build
# cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DLINPHONESDK_PLATFORM=Android ..
# cmake --build .
cmake .. -DLINPHONESDK_PLATFORM=Android -DLINPHONESDK_ANDROID_ARCHS=arm64
make -j8

你可能感兴趣的:(Windows Linux子系统下编译LinPhone SDK)