1、需要安装java环境
这里就不介绍了
2、下载linphone-3.9.1版
http://download.savannah.gnu.org/releases/linphone/3.9.x/sources/
下载下来的linphone-3.9.1版本里面看有没有oRTP和mediastreamer2两个子目录,如果没有再分别下载ortp-0.25.0.tar.gz、mediastreamer-2.12.0.tar.gz,并放到linphone-3.9.1目录下,名称改为oRTP,mediastreamer2
http://download.savannah.gnu.org/releases/linphone/ortp/sources/
http://download.savannah.gnu.org/releases/linphone/mediastreamer/
进入到linphone-3.9.1目录下
./configure --prefix=/mipsbuild --host=mipsel-openwrt-linux-uclibc --disable-static --disable-glib --enable-gnome_ui=no --disable-manual --enable-ipv6 --enable-alsa --enable-gtk_ui=no --enable-video=no --enable-strict=no --enable-artsc=no --enable-libv4l1=no --enable-libv4l2=no --enable-libv4lconvert=no CFLAGS="-I/home/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include -L/home/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib" PKG_CONFIG_PATH=/home/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/pkgconfig
会提示少了哪些库和头文件,按照提示顺藤摸瓜,缺什么装什么就是了。
make
make install
最后会在/mipsbuild 目录下生成
bin include lib share
在bin目录下会有linphonec,这就是linphone运行的主要app。
这样就可以把相关的库和linphone运行文件下载到开发板上运行了,如果不想下载那么多的库到开发板上去或者开发板上的rom不足,可以利用nfs来挂载,方法如下
a、首先在ubuntu上搭建好nfs,参考http://blog.chinaunix.net/uid-25885064-id-3177969.html
b、选中openwrt里面的nfs,参考http://blog.csdn.net/walker0411/article/details/51944096
搭建好之后,开发板上输入 mount -t nfs 192.168.8.7:/home /mnt -o nolock 然后进入到/mnt目录下就可以看到ubuntu目录下的文件了,直接运行./linphonec这个文件发现还是找不到相关的库文件,这时候就需要设置环境变量LD_LIBRARY_PATH了。可以设置如下:
export LD_LIBRARY_PATH=/mnt/linphonebuild/lib:/mnt/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib:$LD_LIBRARY_PATH
这样就可以跑linphone程序了。
3、下载相关依赖工具,按照下面的方法步骤执行
./configure --prefix=/xxx --host=mipsel-openwrt-linux-uclibc --其他
make
make install
有些工具库是利用cmake来生成makefile的,可以利用下面的方法来做
cmake -DCMAKE_TOOLCHAIN_FILE=/home/toolchain-mips-opnwrt.cmake 来指定编译工具链,toolchain-mips-opnwrt.cmake的内容如下
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER /home/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc)
SET(CMAKE_CXX_COMPILER /home/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /home/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
如果想生成动态库,可以这样做
cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On //生成动态库 MBEDTLS表示libmbedtls这个库
修改cmake_install.cmake,增加 set(CMAKE_INSTALL_PREFIX "/home/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2") 可以改变库的安装路径。
make
make install
make install (有时候需要执行两次)
还有些工具库既没有configure,也没有cmake,可以利用下面的方法来做
针对zlib的交叉编译必须要这样做
cd zlib-1.2.3/
export CC=mipsel-openwrt-linux-uclibc-gcc //它的configure不支持,用CC变量来指定交叉工具链
./configure --prefix=$PWD/_install //最后生成的库、头文件和man文件都在当前目录的_install目录下
make && make install