交叉编译libnice 需要先交叉编译glib。 所有先讲glib的交叉编译
glib 需要 libffi 和 zlib。
我新建了一个目录,用于编译/home/share/build
libffi
- 下载
libffi-3.2.1.tar.gz
http://ftp.gnome.org/pub/gnome/sources/glib - 解压
- 进入
libffi-3.2.1
目录 - 执行confiure
./configure --prefix=/home/share/build/libffi-3.2.1/install/arm/ \
CC=/opt/hisi-linux/x86-arm/arm-hisiv400-linux/target/bin/arm-hisiv400-linux-gcc \
--host=arm-hisiv400-linux \
--enable-static=yes \
--enable-shared=no
cc 指向的目录我的交叉编译gcc,这里我都只编译静态库
- make, make install
Zlib
- 下载
zlib-1.2.8.tar.gz
http://www.zlib.net/fossils/ - 解压
- 进入
zlib-1.2.8
目录 - 执行configure
export CC=/opt/hisi-linux/x86-arm/arm-hisiv400-linux/target/bin/arm-hisiv400-linux-gcc
./configure --prefix=/home/share/build/zlib-1.2.8/install/arm --static
zlib 的configrue 没有cc的配置,只能通过export
- make,make install
glib
- 下载
glib-2.45.3.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.45/ - 解压
- 进入
glib-2.45.3
目录 - 新建文件
vim glib.cache
glib_cv_long_long_format=ll
glib_cv_stack_grows=no
glib_cv_have_strlcpy=no
glib_cv_have_qsort_r=yes
glib_cv_va_val_copy=yes
glib_cv_uscore=no
glib_cv_rtldglobal_broken=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes
然后保存
5.执行configure
./configure --prefix=/home/share/build/glib-2.45.3/install/arm \
CC=/opt/hisi-linux/x86-arm/arm-hisiv400-linux/target/bin/arm-hisiv400-linux-gcc \
--host=arm-hisiv400-linux \
--disable-selinux \
--disable-xattr \
--disable-libelf \
--enable-static=yes \
--enable-shared=no \
LIBFFI_CFLAGS="-I/home/share/build/libffi-3.2.1/install/arm/lib/libffi-3.2.1/include" \
LIBFFI_LIBS="-lffi -L/home/share/build/libffi-3.2.1/install/arm/lib" \
ZLIB_CFLAGS="-I/home/share/build/zlib-1.2.8/install/arm/include" \
ZLIB_LIBS="-lz -L/home/share/build/zlib-1.2.8/install/arm/lib" \
--cache-file=glib.cache
- make,make install
libnice
- 下载源代码
git clone -b 01.13 https://github.com/libnice/libnice.git
- 进入目录 libnice
- 执行
./autogen.sh
如果出现错误,看是否 gtk-doc-tools 没装,
sudo apt-get install gtk-doc-tools
- 执行configure
./configure --prefix=/home/share/libnice/target \
--enable-static=yes \
--enable-shared=no \
--host=arm-hisiv400-linux \
LDFLAGS='-L/home/share/build/glib-2.45.3/install/arm/lib -L/home/share/build/libffi-3.2.1/install/arm/lib -L/home/share/build/zlib-1.2.8/install/arm/lib -L/home/share/Hi3531A_SDK_V2.0.2.0_wuhan/mpp/T800x/lib/libSipClass/libnice/lib/' \
LIBS='-lssl -lcrypto -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lgthread-2.0 -lz -lffi'
/home/share/Hi3531A_SDK_V2.0.2.0_wuhan/mpp/T800x/lib/libSipClass/libnice/lib/
目录里面里面有我已经交叉编译好的ssl,crypto库,不做说明。
- make, make install