最近花了一个多月将Linphone移植到ARM9上,粗略实现音视频通话功能,难度主要如下几点:
实现截图如下:
与电脑端通信
进入正题:
编译过程如下:
下面的过程最好按照顺序进行!有一些库也是依赖关系。
export PREFIX=/usr/local
export HOSTTPL=arm-none-linux-gnueabi
export INSTALLDIR=/home/linux/linphone/install
tslib
$ sudo apt-get install libtool automake autoconf
$ ./autogen.sh
$ echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --cache-file=arm-linux.cache
$ make
$ make install DESTDIR=$INSTALLDIR
libiconv
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld
$ make
$ make install DESTDIR=$INSTALLDIR
SDL
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --build=i386 --with-gnu-ld --disable-video-nanox --disable-video-qtopia --disable-pulseaudio --disable-video-photon
$ make
$ make install DESTDIR=$INSTALLDIR
$ sudo apt-get install intltool
ncurses
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-shared --with-gnu-ld
$ make
$ make install DESTDIR=$INSTALLDIR
readline
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --disable-static
$ make
$ make install DESTDIR=$INSTALLDIR
libosip2
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld --disable-static
$ make
$ make install DESTDIR=$INSTALLDIR
libogg
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld
$ make
$ make install DESTDIR=$INSTALLDIR
rm $INSTALLDIR$PREFIX/lib/*.la
对于la文件和intltool的关系请自行查阅相关资料。
libeXosip2
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld --disable-static OSIP_CFLAGS="-I$INSTALLDIR/usr/local/include" OSIP_LIBS="-L$INSTALLDIR/usr/local/lib -losip2 -losipparser2"
$ make
$ make install DESTDIR=$INSTALLDIR
speex
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld --disable-static --enable-fixed-point --enable-arm-asm --with-ogg="$INSTALLDIR/usr/local"
$ make
$ make install DESTDIR=$INSTALLDIR
libav
$ ./configure --prefix=$PREFIX --enable-cross-compile --cross-prefix=arm-none-linux-gnueabi- --arch=armv4 --target-os=linux
$ make
$ make install DESTDIR=$INSTALLDIR
libvorbis
$ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld --with-ogg="$INSTALLDIR/usr/local"
$ make
$ make install DESTDIR=$INSTALLDIR
zlib
$ ./configure --prefix=$PREFIX
修改Makefile
CC=gcc =〉
CC=arm-none-linux-gnueabi-gcc
LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-
LDSHARED=arm-none-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
CPP=gcc -E =〉
CPP=arm-none-linux-gnueabi-gcc -E
AR=ar rc =〉
AR=arm-none-linux-gnueabi-ar rc
$ make
$ make install DESTDIR=$INSTALLDIR
libv4l
修改Makefile,
$ vi libv4l1/Makefile
$ vi libv4l2/Makefile
$ vi libv4lconvert/Makefile
在文件起始处增加以下两行:
CC=arm-none-linux-gnueabi-gcc
AR=arm-none-linux-gnueabi-ar
$ make
$ make install DESTDIR=$INSTALLDIR
rm $INSTALLDIR$PREFIX/lib/*.la
linphone
$ cd mediastreamer2/src
$ patch < mediastreamer-2.7.3-ms_sws_fix.patch
$ ./configure --prefix=$PREFIX --host=$HOSTTPL \
--disable-static --disable-glib --enable-gtk_ui=no --disable-xv
--enable-video --enable-ffmpeg
--with-gnu-ld \
--with-ffmpeg=$INSTALLDIR/usr/local \
--with-libiconv-prefix=$INSTALLDIR/usr/local \
--with-osip=$INSTALLDIR/usr/local \
--with-readline=$INSTALLDIR/usr/local \
SPEEX_CFLAGS="-I$INSTALLDIR/usr/local/include" \
SPEEX_LIBS="-L$INSTALLDIR/usr/local/lib -lspeex" \
FFMPEG_CFLAGS="-I$INSTALLDIR/usr/local/include" \
FFMPEG_LIBS="-L$INSTALLDIR/usr/local/lib -lavcodec" \
SWSCALE_CFLAGS="-I$INSTALLDIR/usr/local/include" \
SWSCALE_LIBS="-L$INSTALLDIR/usr/local/lib -lswscale" \
SDL_CFLAGS="-I$INSTALLDIR/usr/local/include" \
SDL_LIBS="-L$INSTALLDIR/usr/local/lib -lSDL" \
OSIP_CFLAGS="-I$INSTALLDIR/usr/local/include" \
OSIP_LIBS="-L$INSTALLDIR/usr/local/lib -losip2 -losipparser2 -leXosip2" \
SPEEX_CFLAGS="-I$INSTALLDIR/usr/local/include" \
SPEEX_LIBS="-L$INSTALLDIR/usr/local/lib -lspeex -lspeexdsp"
SPEEXDSP_CFLAGS="-I$INSTALLDIR/usr/local/include" \
SPEEXDSP_LIBS="-L$INSTALLDIR/usr/local/lib -lspeex -lspeexdsp" \
LIBV4L2_CFLAGS="-I$INSTALLDIR/usr/local/include" \
LIBV4L2_LIBS="-L$INSTALLDIR/usr/local/lib -lv4l2" \
LIBV4L1_CFLAGS="-I$INSTALLDIR/usr/local/include" \
LIBV4L1_LIBS="-L$INSTALLDIR/usr/local/lib -lv4l1"
配置完configure后修改Makefile如下:
mediastreamer2/tests/Makefile
LIBS =
coreapi/Makefile
LIBS =
coreapi/help/Makefile
LIBS =
helloworld_LDADD = $(top_builddir)/coreapi/liblinphone.la \
console/Makefile
LIBS =
linphonecsh_LDADD = $(ORTP_LIBS) -L/home/linux/linphone/install/usr/local/lib
#此处路径为交叉编译库安装的位置
mediastreamer2/src/videoout.c
This file contains some obsolete function calls such as ms_sws_freeContext, ms_sws_getContext and, so on. So it won't compile unless we fix them (replace them with correct function calls). Details are here:
http://blog.youkuaiyun.com/yufeng1108/article/details/8737062
Finally, we are ready to build linphone. What you need is a good luck now.
$ make
$ make install DESTDIR=$INSTALLDIR
至此成功编译了Linphone,但是需要在ARM9上成功运行请接着看下一篇博文(由于字数限制):