移植前搞清楚linphone依赖库的关系,这个一般是移植工作的关键所在,还有一个关键是目标平台的交叉编译器。
linphone-3.1.0依赖的库如下:
speex(又依赖libogg)
libosip2-3.1.0
libeXosip2-3.1.0
readline(optional)
搭建好交叉编译环境。在/home/cjx 目录下新建目录libs,将下载的源码包解压在该目录下。
find ./ -name '*.tar.gz' -exec tar zxvf {} \;//一次解压所有源文件
cd /home/cjx/libs
cd ncurses-5.7/
./configure --prefix=/install --host=arm-linux --with-gnu-ld --with-shared
make
make install DESTDIR=/home/cjx/source/linphone-arm/build/
cd ..
cd readline-6.1/
./configure --prefix=/install --host=arm-linux --with-gnu-ld --disable-static
make
make install DESTDIR=/home/fzu/source/linphone-arm/build/
cd ..
cd libosip2-3.3.0/
./configure --host=arm-linux --prefix=/install --with-gnu-ld --disable-static
make
make install DESTDIR=/home/cjx/source/linphone-arm/build/
cd ..
cd libogg-1.2.0/
./configure --host=arm-linux --prefix=/install --with-gnu-ld
make
make install DESTDIR=/home/cjx/source/linphone-arm/build/
cd ..
cd speex-1.2rc1/
./configure --prefix=/install --host=arm-linux --with-gnu-ld --disable-static --enable-fixed-point --enable-arm-asm --with-ogg-libraries=/home/cjx/source/linphone-arm/build/install/lib/ --with-ogg-includes=/home/cjx/source/linphone-arm/build/install/include/
make
make install DESTDIR=/home/cjx/source/linphone-arm/build/
cd ..
cd libeXosip2-3.1.0/
./configure OSIP_CFLAGS=-I/home/cjx/source/linphone-arm/build/install/include/ OSIP_LIBS="-L/home/cjx/source/linphone-arm/build/install/lib -losip2 -losipparser2" --prefix=/install --host=arm-linux
cp ../libosip2-3.3.0/src/osipparser2/.libs/libosipparser2.la /home/fzu/source/linphone-arm/build/install/lib/
make
make -k install DESTDIR=/home/fzu/source/linphone-arm/build/
cd ..
cd linphone-3.3.2/
export ARM_INSTALL_TREE=/home/cjx/source/linphone-arm/build/
./configure --host=arm-linux --prefix=/install --with-gnu-ld --disable-static --disable-glib --with-osip=/home/cjx/source/linphone-arm/build/install/ --with-readline=$ARM_INSTALL_TREE/install SPEEX_CFLAGS="-I$ARM_INSTALL_TREE/install/include" SPEEX_LIBS="-L$ARM_INSTALL_TREE/install/lib -lspeex -lspeexdsp" OSIP_CFLAGS="-I$ARM_INSTALL_TREE/install/include" OSIP_LIBS="-L$ARM_INSTALL_TREE/install/lib -losip2 -leXosip2 -losipparser2" --disable-video --disable-gtk_ui
make
make -k install DESTDIR=/home/cjx/source/linphone-arm/build/
若编译时出错时应先检查各输入是不是有误。我曾经在编译linphone时将一个链接库lspeex写成lspeek,出错提示如下:
collect2: ld returned 1 exit status
make[5]: *** [libmediastreamer.la] Error 1
make[5]: Leaving directory `/home/fzu/linux/linphone/libs/linphone-3.3.2/
mediastreamer2/src'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/home/fzu/linux/linphone/libs/linphone-3.3.2/
mediastreamer2/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/fzu/linux/linphone/libs/linphone-3.3.2/
mediastreamer2'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/fzu/linux/linphone/libs/linphone-3.3.2/
mediastreamer2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/fzu/linux/linphone/libs/linphone-3.3.2'
make: *** [all] Error 2
结果可想而知,我为了我这次的粗心付出了惨重的代价,花了别人几十倍(好几天)的时间才将这个错误找出。
至于其他可能出现的错误,也许是有些库没安装好(在x86平台上,可能会提示你安装g++(一个c++编译器)、intltool等),这些根据错误提示可以很轻松的找出原因,解决的方法也很简单,安装提示的库就可以了。还有一个就是在编译libeXosip和linphone时会可能出错,这个不用管它,对我们移植没有影响(在安装时指定-k就是忽略错误,这个可以在configure语法中查到)。如编译libeXosip2-3.1.0时会出现如下错误:
/bin/sed: can't read /install/lib/libosipparser2.la: No such file or directory
libtool: link: `/install/lib/libosipparser2.la' is not a valid libtool archive
make[2]: *** [libeXosip2.la] Error 1
make[2]: Leaving directory `/home/fzu/linux/linphone/libs/libeXosip2-3.1.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/fzu/linux/linphone/libs/libeXosip2-3.1.0'
make: *** [all] Error 2
另外,./confiugre --prefix=/install ....是以make install 中指定的目录为根目录安装的。在本次编译中,所有编译好的库及可执行文件等都放在/home/cjx/source/linphone-arm/build/install 目录下。
编译完成后,将其下载到开发板上。