手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Ubuntu下linphone交叉编译与移植

[日期:2010-10-13] 来源:Linux社区  作者:秦古梦 [字体: ]

移植前搞清楚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/
若编译时出错时应先检查各输入是不是有误。www.linuxidc.com我曾经在编译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 目录下。

编译完成后,将其下载到开发板上。

linux
相关资讯       Ubuntu教程 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* ssss 发表于 2011/2/17 14:54:58
找一个XP下编译linphone成功的朋友请教一下,QQ 258787773