本文记录linphone-andoroid在mac上的编译过程,在这里做下记录,希望对大家有所帮助,如有疑问发评论即可:
环境搭建:
- 代码下载:git clone git://git.linphone.org/linphone-android.git --recursive
- 代码同步更新:git submodule sync && git submodule update --init --recursive
- 下载ndk:curl -O https://dl.google.com/android/repository/android-ndk-r14b-darwin-x86_64.zip
- mac的环境变量:~/.bash_profile
JAVA_HOME=$(/usr/libexec/java_home)
ANDROID_HOME=/Users/mydocument/Library/Android/sdk
ANDROID_NDK=/Users/mydocument/Library/Android/android-ndk-r14b
PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK
export JAVA_HOME ANDROID_HOME ANDROID_NDK
编译过程中碰到的问题:
1. 找不到 R.raw.rootca:
报错信息:
/Users/mydocument/Documents/xing/AndroidStudioProjects/linphone-android/src/android/org/linphone/LinphoneManager.java:908: 错误: 找不到符号
copyFromPackage(R.raw.rootca, new File(mLinphoneRootCaFile).getName());
问题处理:由于rootca是通过网络下载的,所以造成报错的原因是未编译完成,即未走到下载流程,检查网络是否正常和其他报错信息即可;
2. Could not find the pkg-config program:
报错信息:
-- Using configuration file '/Users/mydocument/Documents/xing/AndroidStudioProjects/linphone-android/submodules/cmake-builder/configs/config-android.cmake'
-- Found PythonInterp: /usr/bin/python (found version "2.7.10")
CMake Error at cmake/CheckBuildTools.cmake:147 (message):
Could not find the pkg-config program.
Call Stack (most recent call first):
builders/CMakeLists.txt:72 (include)
configs/config-android.cmake:71 (include)
CMakeLists.txt:64 (include)`
问题处理:安装:pkg-config:brew install pkg-config
3. Cannot determine link language for target "opus".
报错信息:
CMake Error at CMakeLists.txt:638 (add_library):
Cannot find source file:
celt/bands.c
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
CMake Error: Cannot determine link language for target "opus".
CMake Error: CMake can not determine linker language for target: opus
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
ENABLE_SHARED
-- Build files have been written to: /Users/mydocument/Documents/xing/AndroidStudioProjects/linphone-android/WORK/android-arm64/Build/opus
make[3]: *** [/Users/mydocument/Documents/xing/AndroidStudioProjects/linphone-android/WORK/android-arm64/Stamp/EP_opus/EP_opus-configure] Error 1
make[2]: *** [CMakeFiles/EP_opus.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [arm64-build] Error 2
问题处理:删除目录->submodules/externals/opus,同步代码:git submodule sync && git submodule update --init --recursive
4. Cannot determine link language for target "opencore-amrwb".
报错信息:
CMake Error at CMakeLists.txt:309 (add_library):
Cannot find source file:
amrwb/wrapper.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
CMake Error at CMakeLists.txt:217 (add_library):
Cannot find source file:
amrnb/wrapper.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
CMake Error: Cannot determine link language for target "opencore-amrwb".
CMake Error: CMake can not determine linker language for target: opencore-amrwb
CMake Error: Cannot determine link language for target "opencore-amrnb".
CMake Error: CMake can not determine linker language for target: opencore-amrnb
-- Generating done
-- Build files have been written to: /Users/mydocument/Documents/xing/AndroidStudioProjects/linphone-android/WORK/android-arm64/Build/opencoreamr
make[3]: *** [/Users/mydocument/Documents/xing/AndroidStudioProjects/linphone-android/WORK/android-arm64/Stamp/EP_opencoreamr/EP_opencoreamr-configure] Error 1
make[2]: *** [CMakeFiles/EP_opencoreamr.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [arm64-build] Error 2
问题处理:同问题3一样,删除目录->submodules/externals/opencore-amr,同步代码:git submodule sync && git submodule update --init --recursive
5. /bin/sh: yasm: command not found
报错信息:
/bin/sh: yasm: command not found
make[5]: *** [vpx_ports/emms.asm.o] Error 127
make[4]: *** [.DEFAULT] Error 2
make[3]: *** [/Users/mydocument/Documents/xing/AndroidStudioProjects/linphone-android/WORK/android-x86/Stamp/EP_vpx/EP_vpx-build] Error 2
make[2]: *** [CMakeFiles/EP_vpx.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [x86-build] Error 2
问题处理:安装yasm:brew install yasm
6. cpuid.asm:196: error: symbol `XGETBV' redefined
../../../..//submodules/externals/openh264/codec/common/x86/cpuid.asm:196: error: symbol `XGETBV' redefined
make[4]: *** [codec/common/x86/cpuid.o] Error 1
make[3]: *** [/Users/mydocument/Documents/xing/AndroidStudioProjects/linphone-android/WORK/android-x86/Stamp/EP_openh264/EP_openh264-build] Error 2
make[2]: *** [CMakeFiles/EP_openh264.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [x86-build] Error 2
问题处理:安装nasm: brew install nasm
网友评论