LinPhone是一個IP電話工具,運行於Linux下。它能夠讓你通過internet來查詢朋友的IP,並通過IP給他打電話。下面我會介紹如何在ubuntu下編譯運行linphone。
1.前提條件:
已經在ubuntu下配置好android開發環境,詳見http://blog.csdn.net/maylian7700/article/details/7538176#,這里不再贅述
2.然后使用git下載linphone-android在命令行里面輸入git clone git://git.linphone.org/linphone-android.git --recursive (--recursive一定要有,否則可能導致下載不完全)
3.查看README文件,發現需要android api至少為16,最好為19(否則的話會編譯錯誤),而且需要安裝一些必備的插件
1 **************************** 2 * LINPHONE for ANDROID * 3 **************************** 4 5 COMPILATION INSTRUCTIONS 6 ************************ 7 8 To build liblinphone for Android, you must: 9 ------------------------------------------- 10 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. 11 1) download the Android ndk (=r10c) from google and add it to your path (no symlink !!!). 12 2) install yasm, nasm, curl, ant, rsync and the autotools: autoconf, automake, aclocal, libtoolize, pkgconfig 13 On 64 bits linux systems you'll need the ia32-libs package 14 With the latest Debian (multiarch), you need this: 15 dpkg --add-architecture i386 16 aptitude update 17 aptitude install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 18 3) run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project. 19 $ make 20 4) (Optional) To install the generated apk into a plugged device, run 21 $ make install 22 5) (Optional) To generate a liblinphone SDK zip containing a full jar and native libraries, run 23 $ make liblinphone-android-sdk 24 6) (Optional) To generate a libmediastreamer2 SDK zip containing a full jar and native libraries, run 25 $ make mediastreamer2-sdk 26 7) (Optional) To generate a signed apk to publish on the Google Play, run 27 $ make release 28 It will ask you for the version number that will be displayed in the about page of the app. 29 Make sure you filled the ant.properties values for key.store and key.alias in order to correctly 30 sign the generated apk (it will ask you the password during the process) 31 32 To run the tutorials: 33 -------------------- 34 1) open the res/values/non_localizable_custom.xml file and change the value of the show_tutorials_instead_of_app to true. 35 2) compile again using make && make install. 36 3) /!\ don't forget to put it back to false to run the linphone application normally. /!\ 37 38 To create an apk with a different package name 39 ---------------------------------------------- 40 You need to edit the custom_rules.xml file: 41 1) look for the property named "linphone.package.name" and change it value accordingly 42 2) also update the values in the AndroidManifest file where the comment <!-- Change package ! --> appears 43 3) update the path to the sounds in the linphonerc-factory files in the res folders and optionally change default sip account on linphonerc-default 44 4) run again the Makefile script by calling "make" 45 46 To run the liblinphone test suite on android 47 -------------------------------------------- 48 Simply run 49 $ make liblinphone_tester 50 This will be build everything, generate an apk, and install it on the connected device if any. 51 52 You can speed up the compilation by using ccache (compiler cache, see https://ccache.samba.org/). Simply export: 53 export NDK_CCACHE=ccache 54 55 TROUBLESHOOTING 56 *************** 57 If you encounter the following issue: 58 E/dalvikvm( 2465): dlopen("/data/app-lib/org.linphone-1/liblinphone-armeabi-v7a.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "rand" referenced by "liblinphone-armeabi-v7a.so"... 59 it's because you have installed the android-21 platform (which is chosen automatically because it's the most recent) and you deployed the apk on a android < 5 device. 60 To fix this, in the Makefile, force ANDROID_MOST_RECENT_TARGET=android-19 61 62 If you encounter troubles with the make clean target and you are using the 8e android ndk, the solution can be found here: https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/3wIbb-h3nDU 63 64 If you built the app using eclipse, ensure you ran at least once the make command (see above steps 0 to 3) ! Else you'll have this exceptions: 65 FATAL EXCEPTION: main 66 java.lang.ExceptionInInitializerError 67 ... 68 Caused by: java.lang.UnsatisfiedLinkError: Couldn't load linphone-armeabi-v7a: findLibrary returned null 69 ... 70 71 BUILD OPTIONS 72 ************* 73 74 Some options can be passed to make, like "make SOME_OPTION=SOME_VALUE". 75 76 ENABLE_GPL_THIRD_PARTIES 77 values: 0 (GPL third parties disabled) or 1 (GPL third parties enabled), default value: 1 78 GPL third parties are: X264 and G729 79 80 BUILD_VIDEO 81 values: 0 (no video) or 1 (video enabled), default value: 1 82 83 BUILD_OPENH264 84 values: 0 (don't build openH264) or 1 (build openH264), default value: 1 85 86 ENABLE_OPENH264_DECODER 87 values: 0 (disable openh264 decoder) or 1 (enable openh264 decoder), default value: 1 88 89 BUILD_X264 90 values: 0 (don't build x264) or 1 (build x264), default value: 0 91 92 BUILD_AMRNB 93 values: 0 (don't build amrnb codec), light (try to use amrnb codec from android), full (build your own amrnb codec), default value: full 94 95 BUILD_AMRWB 96 values: 0 (don't build amrwb codec), 1 (build your own amrwb codec): default value: 1 97 98 BUILD_ZRTP 99 values: 0 (don't support ZRTP), 1 (support ZRTP), default value: 1 100 101 BUILD_SILK 102 values: 0 (don't build silk plugin), 1 (build silk) [silk is Skype nonfree patented audio codec], default value: 1 103 104 BUILD_G729 105 values: 0 (don't build g729 plugin), 1 (build g729) [g729 is nonfree patented audio codec, contact Sipro lab for more details] 106 default value: 1 107 108 BUILD_TUNNEL 109 values: 0 (don't build tunnel), 1 (build tunnel) [requires a non-free tunnel implementation in submodules/linphone/tunnel] 110 default value: 0 111 112 BUILD_WEBRTC_AECM 113 values: 0 (don't build echo canceler), 1 (build echo canceler) 114 default value: 1 115 116 USE_JAVAH 117 values: 0 (don't generate header), 1 (generate header for linphone_core_jni) [used to check errors at liblinphone compilation] 118 default value: 1 119 120 BUILD_FOR_X86 121 values: 0 (don't generate liblinphone libraries for x86 architecture), 1 (build liblinphone libraries for x86 architecture) 122 default value: 1 123 124 BUILD_SQLITE 125 values: 0 (don't build sqlite3), 1 (build sqlite3) [used to store chat messages inside liblinphone] 126 default value: 1 127 128 BUILD_TLS 129 values: 0 (don't build tls), 1 (do build tls), default value: 1 130 131 BUILD_WEBRTC_ISAC 132 values: 0 (don't build isac), 1 (do build isac), default value: 1 133 134 BUILD_OPUS 135 values: 0 (don't build opus), 1 (do build opus), default value: 1 136 137 BUILD_UPNP 138 values: 0 (don't build upnp), 1 (do build upnp), default value: 1 139 140 BUILD_MATROSKA 141 values: 0 (don't build matroska and ebml), 1 (do build matroska and ebml), default value: 0 142 143 BUILD_ILBC 144 values: 0 (don't build iLBC), 1 (do build iLBC), default value: 1
4.安裝所需插件
1 sudo apt-get install yasm 2 sudo apt-get install nasm 3 sudo apt-get install curl 4 sudo apt-get install ant 5 sudo apt-get install autoconf 6 sudo apt-get install automake 7 sudo apt-get install aclocal 8 sudo apt-get install libtoolize 9 sudo apt-get install pkgconfig
然而aclocal現在已經包括到automake里了,不需要安裝;libtoolize的安裝,正確的指令卻是: sudo apt-get install libtool
pkgconfig則為sudo apt-get install pkg-config。
5.修改linphone-android目錄權限,即chmod 777 linphone-android,進入目錄后執行make命令。可能會出現以下錯誤
Can't locate LWP/UserAgent.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at hot_mover10.pl line 7. BEGIN failed--compilation aborted at hot_mover10.pl line 7.
通過終端輸入以下命令可以得以解決:
1 perl -MCPAN -eshell 2 cpan> install Bundle::LWP
6.再次make,其中過程如下
7.eclipse導入該工程,運行並真機調試,如圖所示: