編譯linphone-android遇到不少問題,記錄下來,備用。
1.下載代碼,我是通過git下載的,
http://www.linphone.org/eng/download/git.html
git clone git://git.linphone.org/linphone-android.git --recursive
這個只是主工程,下面有好幾個子工程,即submodule,如果下載順利,會自動把子工程一起下載。
代碼較大,下載後加上.git約500M,建議下載時找個網速較好的電腦。
但如果出錯,或者中間斷掉,有可能下載不全,會帶來N多問題,建議重新下載。
2.下載安裝jdk(略)。
3.下載安裝android開發工具,下載最新的adt-bundle和ndk的linux版本
http://developer.android.com/sdk/index.html
我下載的是:
adt-bundle-linux-x86_64-20130219.zip
android-ndk-r8e-linux-x86_64.tar.bz2
下載下來解壓即可。
4.安裝ant:
apt-get install ant
5.按照linphone-android/README,安裝相關的工具:
LINPHONE for ANDROID****************************To build liblinphone for Android, you must:0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path.1) download the Android ndk (>=r8b) from google and add it to your path.2) install the autotools: autoconf, automake, aclocal, libtoolize, pkgconfig2bis) on some 64 bits systems you'll need the ia32-libs package3) run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project.$ make4) To install the generated apk into a plugged device, run$ make installTo run the tutorials:1) open the res/values/non_localizable_custom.xml file and change the value of the show_tutorials_instead_of_app to true.2) compile again using make && make install.3) /!\ don't forget to put it back to false to run the linphone application normally. /!\To create an apk with a different package name, you need to edit the custom_rules.xml file:1) look for the property named "linphone.package.name" and change it value accordingly2) run again the Makefile script by calling "make"Some options can be passed to make, like "make SOME_OPTION=SOME_VALUE".Option Name | Possible values | Default value -------------------------------------------------------------------------------------------------------------------------------------------------------BUILD_X264 0 (don't build x264) or 1 (build x264) | 0BUILD_AMRNB 0 (don't build amrnb codec), light (try to use amrnb codec from android), full (build your own amrnb codec) | fullBUILD_AMRWB 0 (don't build amrwb codec), 1 (build your own amrwb codec) | 0BUILD_GPLV3_ZRTP 0 (don't support ZRTP), 1 (support ZRTP and make the whole program GPLv3) | 0BUILD_SILK 0 (don't build silk plugin), 1 (build silk) [silk is Skype nonfree patented audio codec] | 1BUILD_G729 0 (don't build g729 plugin), 1 (build g729) [g729 is nonfree patented audio codec, contact Sipro lab for more details] | 0BUILD_TUNNEL 0 (don't build tunnel), 1 (build tunnel) [requires a tunnel implementation in submodules/linphone/tunnel] | 0BUILD_WEBRTC_AECM 0 (don't build echo canceler), 1 (build echo canceler) | 1USE_JAVAH 0 (don't generate header), 1 (generate header for linphone_core_jni) [used to check errors at liblinphone compilation] | 1BUILD_FOR_X86 0 (don't generate liblinphone libraries for x86 architecture), 1 (build liblinphone libraries for x86 architecture) | 1
apt-get install autoconf automake
aclocal安裝不上,先不管它。
其中libtoolize、pkgconfig不能直接安裝不上的,如下處理:
apt-get install libtool
apt-get install pkg-config
我用的ubuntu是64位的,需要安裝ia32-libs:
apt-get install ia32-libs
這裡安裝的東西很多,需要較長時間。
6.配置ndk和sdk tools環境:
export PATH=$(./path.sh)
path.sh:這裡是ndk和sdk中tools、platform-tools的路徑,需要根據實際路徑修改
#!/bin/bashexport PATH=~/wifi-player/android-dev/adt-bundle-linux-x86_64-20130219/sdk/tools:~/wifi-player/android-dev/adt-bundle-linux-x86_64-20130219/sdk/platform-tools:~/wifi-player/android-dev/android-ndk-r8e:$PATHecho $PATH
7.編譯:
make
編譯時間,會自動下載一個壓縮包,並解壓:
submodules/mssilk/sdk/SILK_SDK_SRC_v1.0.8.zip
這個也可以自己用先下載好,放到對應目錄即可。
如果順利,會產生bin/Linphone-debug.apk
出現的問題:
1.下面是我下載的代碼,在最後的提交中,有一個錯誤。
commit d7024542041ea43b5241d8880bfe8c7e94c6c71bAuthor: Sylvain Berfini <sylvain.berfini@linphone.org>Date: Fri Mar 22 17:42:13 2013 +0100 CpuUtils moved to mediastreamer
CpuUtils.java被移到
submodules/linphone/mediastreamer2/java/src/org/linphone/mediastream/CpuUtils.java
但在submodules/linphone/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java中引用卻沒有修改,這裡需要自己修改下:
import org.linphone.mediastream.CpuUtils;
2.第一次編譯通過後,再次make,會重新下面的錯誤:
Archive: ./SILK_SDK_SRC_v1.0.8.zipreplace SILK_SDK_SRC_v1.0.8/SILK_SDK_SRC_ARM_v1.0.8/Makefile? [y]es, [n]o, [A]ll, [N]one, [r]ename: A inflating: SILK_SDK_SRC_v1.0.8/SILK_SDK_SRC_ARM_v1.0.8/Makefile ...caution: filename not matched: SILK_SDK_SRC_v1.0.8/SILK_SDK_SRC_ARM_v1.0.8/test_vectorsmake[1]: *** [SILK_SDK_SRC_v1.0.8] Error 11make[1]: Leaving directory `/mnt/wifi-player/wifi-audio/linphone-android/submodules/mssilk/sdk'SILK audio plugin prepare state failed.
這是因為make時,會解壓zip檔案,提示是否覆蓋,但是無論怎麼選擇,都會報錯。
所以直接修改submodules/mssilk/sdk/Makefile,把解壓zip的命令去掉即可:
$(silk_src_dir): #$(silk_extracted_directory) cp $(srcdir)/patch_pic.diff $(silk_src_dir) cd $(silk_src_dir) && $(PATCH) -p0 < patch_pic.diff