您的位置:首页 > 编程语言 > PHP开发

交叉编译ortp、osip2、eXosip2、mediastreamer2及其附带的库实现SIP软电话

2014-07-11 08:31 1786 查看
经过两周的交叉编译,编写源码,终于实现了在ARM开发板上的软电话。下面记录各个库的交叉编译过程,有可能还会有漏掉一些库,也有可能有些库不需要。由于编译完成几周之后才想起有做一些记录,难免有些不准确以及不全。这交叉编译的这两周中,在网上找了好多资料,现在回头看看好像也都没有记录。罪过!!。也有好多东西是参考网上的资料。其实交叉pulseaudio这个库大概花了我差不多一周时间。在这个博客http://www.cnblogs.com/wanzaiyimeng/p/3277530.html中找到了很有用的资料。
1、交叉编译ortp

下载源码:http://savannah.c3sl.ufpr.br/linphone/ortp/sources/?C=S;O=A

我使用0.18.0版本

[html]
view plaincopy





#!/bin/sh  
if [ ! -d ortp-0.18.0 ] ; then  
    tar xzvf ortp-0.18.0.tar.gz  
fi  
  
if [ ! -d linux-build-arm ] ; then  
    mkdir linux-build-arm  
fi  
  
cd linux-build-arm  
../ortp-0.18.0/configure \  
CC=arm-linux-gcc \  
--host=arm-linux \  
--target=arm-linux \  
--prefix=/home/protocol_stack/install/  
make   
make install  

2、交叉编译osip2
下载源码:http://ftp.gnu.org/gnu/osip/

我使用的版本是3.6.0

[html]
view plaincopy





#!/bin/sh  
if [ ! -d libosip2-3.6.0 ] ; then  
    tar xzvf libosip2-3.6.0.tar.gz  
fi  
  
if [ ! -d linux-build-arm ] ; then  
    mkdir linux-build-arm  
fi  
  
cd linux-build-arm  
../libosip2-3.6.0/configure \  
--host=arm-linux \  
--target=arm-linux \  
--prefix=/home/protocol_stack/install/  
make   
make install  

3、交叉编译eXosip2
下载源码:http://ftp.gnu.org/gnu/osip/

我使用的版本是3.6.0

[html]
view plaincopy





#!/bin/sh  
if [ ! -d libeXosip2-3.6.0 ] ; then  
    tar xzvf libeXosip2-3.6.0.tar.gz  
fi  
  
if [ ! -d linux-build-arm ] ; then  
    mkdir linux-build-arm  
fi  
  
cd linux-build-arm  
../libeXosip2-3.6.0/configure \  
--host=arm-linux \  
--target=arm-linux \  
--prefix=/home/protocol_stack/install/ \  
PKG_CONFIG_PATH=/home/protocol_stack/install/lib/pkgconfig  
make   
make install  

接下来可以编译mediastreamer2了,不过ms2,依赖好多库:ogg、speex、pulseaudio。而pulseaudio又依赖许多库:alsa、json、libtool。
4、交叉编译ogg

下载源码:http://xiph.org/downloads/

我使用1.3.1版本

[html]
view plaincopy





#!/bin/sh  
if [ ! -d libogg-1.3.1 ] ; then  
    tar xzvf libogg-1.3.1.tar.gz   
fi  
  
if [ ! -d linux-build-arm ] ; then  
    mkdir linux-build-arm  
fi  
  
cd linux-build-arm  
../libogg-1.3.1/configure \  
CC=arm-linux-gcc \  
--prefix=/home/protocol_stack/install/ \  
--host=arm-linux  
make   
make install  

5、交叉编译speex
下载源码:http://www.speex.org/downloads/

我使用1.2rc1版本

[html]
view plaincopy





#!/bin/sh  
if [ ! -d speex-1.2rc1 ] ; then  
    tar xzvf speex-1.2rc1.tar.gz   
fi  
  
if [ ! -d linux-build-arm ] ; then  
    mkdir linux-build-arm  
fi  
  
cd linux-build-arm  
../speex-1.2rc1/configure \  
CC=arm-linux-gcc \  
--prefix=/home/protocol_stack/install/ \  
--with-ogg=/home/protocol_stack/install/ \  
--enable-fixed-point \  
--disable-float-api \  
--host=arm-linux  
make   
make install  

6、交叉编译pulseaudio
下载源码:http://freedesktop.org/software/pulseaudio/releases/

我使用1.0版本

[html]
view plaincopy





#!/bin/sh  
if [ ! -d pulseaudio-1.0 ] ; then  
    tar xzvf pulseaudio-1.0.tar.gz  
fi  
  
if [ ! -d linux-build-arm ] ; then  
    mkdir linux-build-arm  
fi  
  
cd linux-build-arm  
../pulseaudio-1.0/configure \  
CC=arm-linux-gcc \  
CXX=arm-linux-g++ \  
--prefix=/home/protocol_stack/install \  
--host=arm-linux \  
--disable-rpath \  
--disable-nls \  
--disable-dbus \  
--disable-bluez \  
--disable-samplerate \  
--disable-solaris \  
--disable-gconf \  
--disable-avahi \  
--disable-jack \  
--disable-lirc \  
--disable-glib2 \  
--disable-gtk2 \  
--disable-openssl \  
--disable-ipv6 \  
--disable-asyncns \  
--disable-per-user-esound-socket \  
--disable-oss-output \  
--disable-oss-wrapper \  
--disable-x11 \  
--enable-neon-opt=no \  
--with-database=simple \  
PKG_CONFIG_PATH=/home/protocol_stack/install/lib/pkgconfig \  
CPPFLAGS=-I/home/protocol_stack/install/include \  
LDFLAGS=-L/home/protocol_stack/install/lib \  
CFLAGS=-I/home/protocol_stack/install/include   
make && make install  

交叉编译pulseaudio可能会出现从错误:
错误1:

checking for ltdl.h... no

configure: error: Unable to find libltdl version 2. Makes sure you have libtool 2.4 or later installed.

make: *** No targets specified and no makefile found.  Stop.

这时需要交叉编译libtool

下载源码:ftp://ftp.gnu.org/gnu/libtool/

我使用2.4.2版本

[html]
view plaincopy





./configure --host=linux-arm \  
--prefix =/home/protocol_stack/install/  
make && make install  

错误2:
checking for LIBCHECK... no

checking for LIBJSON... no

configure: error: Package requirements ( json >= 0.9 ) were not met:

No package 'json' found

解决方法就是交叉编译json

下载源码:http://ftp.debian.org/debian/pool/main/j/json-c/

我使用0.9版本

[html]
view plaincopy





./configure --host=linux-arm \  
--prefix =/home/protocol_stack/install/  
make && make install  

后面使用到json可能会出现下面的错误:
/home/protocol_stack/install/lib/libjson.so: undefined reference to `rpl_malloc'

/home/protocol_stack/install/lib/libjson.so: undefined reference to `rpl_realloc'

collect2: ld returned 1 exit status

解决方法:

修改json-c源码中的config.h文件的最后几行把#define malloc rpl_malloc 和 #define realloc rpl_realloc屏蔽掉

交叉编译alsa:

http://www.alsa-project.org/main/index.php/Main_Page

这个库的版本需要根据你嵌入式Linux内核中alsa的版本而定,可以使用命令查看内核中alsa的版本:

[root@AT91SAM9 /lte]# cat /proc/asound/version 

Advanced Linux Sound Architecture Driver Version 1.0.24.

可以到内核中alsa驱动版本是1.0.24,所以我选1.0.24版本

[html]
view plaincopy





./configure --host=linux-arm \  
--prefix =/home/protocol_stack/install/  
make && make install  

此时重新编译pulseaudio应该能编译通过,不过根据configure的选项不一致有可能还得交叉编译flac、sndfile等库。

7、最后编译mediastreamer2

下载源码:http://ftp.twaren.net/Unix/NonGNU//linphone/mediastreamer/

我使用2.8版本

[html]
view plaincopy





#!/bin/sh  
if [ ! -d mediastreamer-2.8.0 ] ; then  
    tar xzvf mediastreamer-2.8.0.tar.gz  
fi  
  
if [ ! -d linux-build-arm ] ; then  
    mkdir linux-build-arm  
fi  
  
cd linux-build-arm  
../mediastreamer-2.8.0/configure \  
CC=arm-linux-gcc \  
--prefix=/home/protocol_stack/install/ \  
PKG_CONFIG_PATH=/home/protocol_stack/install/lib/pkgconfig \  
--disable-gsm \  
--enable-video=no \  
--enable-macsnd=no \  
--disable-static \  
--disable-sdl \  
--disable-x11 \  
--disable-ffmpeg \  
--host=arm-linux \  
--target=arm-linux  
make   
make install  

上面的configure选项没有屏蔽v4l1和v4l2,所以还得交叉编译v4l
编译v4l

下载源码:http://pkgs.fedoraproject.org/repo/pkgs/libv4l/

我使用0.6.4版本

[html]
view plaincopy





#!/bin/sh  
if [ ! -d libv4l-0.6.4 ] ; then  
    tar xzvf libv4l-0.6.4.tar.gz  
fi  
  
cd libv4l-0.6.4  
make clean  
make CC=arm-linux-gcc  
make install PREFIX=/home/protocol_stack/install 

原文地址:http://blog.csdn.net/jecan123/article/details/18000529
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息