1. 准备Linux VM
2.1 安装Oracle Virtual Box,
2.2 安装ubuntu
2. 获取源码
android git 路径:git clone git://git.linphone.org/linphone-android.git --recursive
注意:下载之前,需要设置git,执行如下命令:
git config --global core.autocrlf
false
否则在下载的文件中有0D 0A,导致在linux上编译时报错。
建议在ubuntu上下载source code,这样避免不可预见的错误。
下载完源码后,认真阅读readme,里面会介绍build前的准备工作。包括:
2.1. 下载SDK
2.2. 下载NDK
2.3.
install yasm, nasm, curl, ant, rsync, autoconf, automake, aclocal, libtool, pkgconfig, bc, perl-LWP-Protocol-https, patch, vim-common
On 64 bits linux systems you'll need the ia32-libs package
With the latest Debian (multiarch), you need this:
dpkg --add-architecture i386
aptitude update
aptitude install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386
2.4. 具体怎么在linux上安装上述软件,可以参考如下链接:
ia32-libs:
http://stackoverflow.com/questions/23182765/how-to-install-ia32-libs-in-ubuntu-14-04-lts-trusty-tahr
perl-LWP-Protocol-https
http://packages.ubuntu.com/precise/liblwp-protocol-https-perl;
http://packages.ubuntu.com/precise/all/liblwp-protocol-https-perl/download
apt-get 各种使用方法:
http://blog.youkuaiyun.com/shangzwz/article/details/17686933
3. 编译
在source code根目中执行make。
如果提示有错误,请确认上如必须安装的软件已经安装全。或者直接到失败的目录下运行make命令。
4. 获取编译结果,并在Android studio上导入编译
如何在Windows host和Linux VM之间共享文件
step1:在windows上新建一个文件夹,共享给everyone.
step2: 在VM settings share folder下面,新建一个permanent共享。
setp3: 在linux 里面,新建一个目录。然后按如下命令mount:
mount -t vboxsf <step2中设置的目录名> <step3中新建的目录路径>
这样,就可以从linux中拷贝文件到该目录中,windows中就可以取出了。
5. 测试
坑:
1. 如果缺少java包,那么编译失败,core下的文件,都是通过编译生成的。
2. 不要直接到linphone官网上下载lib库,因为和source code不匹配,可能运行stop.