glib 交叉编译步骤
2017-06-06 15:03
169 查看
借鉴文章网址为wiki.beyondlogic.org/index.php?title=Cross_Compiling_BlueZ_Bluetooth_tools_for_ARM 编译glib需要zlib libffi两个库文件我使用的库版本为 glib-2.45.3.tar.xz libffi-3.2.1.tar.gz zlib-1.2.8.tar.gz下载库推荐网址 点击打开链接 http://www.filewatcher.com/直接输入 zlib-1.2.8.tar.gz 就可以找到所有的ftp下载内容的连接zlib ./configure --prefix=$(pwd)/installEdit the makefile and prefix the build tools with arm-linux-gnueabi-.
CC=arm-linux-gnueabi-gcc LDSHARED=arm-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map CPP=arm-linux-gnueabi-gcc -E AR=arm-linux-gnueabi-ar RANLIB=arm-linux-gnueabi-ranlibMake and install:makemake install
libffi
libffi is the Portable Foreign Function Interface Library and is a prerequisite for building GLib. It is an interface that allows code written in one language to call code written in another language.Download, build and install:wget ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz tar -xzf libffi-3.0.13.tar.gzcd libffi-3.0.13/./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabimakemake install在编译glib的时候最好编译的就是这两个了基本上按照步骤不会出错,我分别在Ubuntu16.04 以及Ubuntu14.04上测试过
下面的这个是推荐网址中给出的原话编译glib的
GLib
GLib is part of the GTK+ ProjectGLib requires zlib, libffi and glibc >= 2.18 to successfully build. If you are building on ubuntu 14.04, the arm-linux-gnueabi should come installed with glibc 2.19 hence we don't rebuild it.GLib requires the glib-genmarshal tool installed on your build system otherwise the following error is likey to result:checking for glib-genmarshal... noconfigure: error: Could not find a glib-genmarshal in your PATHAn easy way to resolve this is to install libglib2.0-dev:sudo apt-get install libglib2.0-devTo build Glib, download, build and install:wget http://ftp.gnome.org/pub/gnome/sources/glib/2.40/glib-2.40.0.tar.xz tar -xJf glib-2.40.0.tar.xzcd glib-2.40.0./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig glib_cv_stack_grows=noglib_cv_uscore=yesac_cv_func_posix_getpwuid_r=yesac_cv_func_posix_getgrgid_r=yesmakemake install但是根据上面的操作会导致找不到libffi库在config的时候,并且编译的时候回提示找不到zlib.h头文件
我使用的是一下配置
./configure --prefix=/home/lz/work/hi3536/arm_install --host=arm-hisiv400-linux-gnueabi PKG_CONFIG_PATH=/home/lz/work/hi3536/arm_install LIBFFI_CFLAGS='-I/home/lz/work/hi3536/arm_install/lib/libffi-3.2.1/include'LIBFFI_LIBS='-lffi -L=/home/lz/work/hi3536/arm_install/lib' ZLIB_CFLAGS='-I/home/lz/work/hi3536/zlib-1.2.8/install/include' ZLIB_LIBS='-lz -L/home/lz/work/hi3536/zlib-1.2.8/install/lib' glib_cv_stack_grows=noglib_cv_uscore=yesac_cv_func_posix_getpwuid_r=yesac_cv_func_posix_getgrgid_r=yes
--prefix=/home/lz/work/hi3536/arm_install 是我的安装目录可以修改成--prefix=$(pwd)/install 习惯用这个
--host=arm-hisiv400-linux-gnueabi 我的编译器,可以通过增加临时变量例如
export PATH=/opt/hisi-linux-nptl/arm-hisiv400-linux/bin:$PATHsource /etc/profile
使得
arm-hisiv400-linux-gnueabi-gcc 可以正常使用并且不需要手动修改Makefile以及config防止出错编译成gcc版本
PKG_CONFIG_PATH=/home/lz/work/hi3536/arm_install 是我根据这篇文章来设定的目录,我将zlib以及libffi install到这个目录不知道有没有用,贴出来只是给一个参考
LIBFFI_CFLAGS='-I/home/lz/work/hi3536/arm_install/lib/libffi-3.2.1/include'
LIBFFI_LIBS='-lffi -L=/home/lz/work/hi3536/arm_install/lib'
这句是我指定libffi的头文件以及库文件位置
ZLIB_CFLAGS='-I/home/lz/work/hi3536/zlib-1.2.8/install/include'
ZLIB_LIBS='-lz -L/home/lz/work/hi3536/zlib-1.2.8/install/lib'
同样指定zlib的安装目录这个目录是我以前交叉编译安装的目录
glib_cv_stack_grows=no
glib_cv_uscore=yes
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes
这些是glib的编译选项我理解是的
然后make
make install 就可以成功了
相关文章推荐
- 嵌入式交叉编译开发环境的搭建步骤(arm-linux)
- dbus-glib-0.108 arm交叉编译
- php5在arm-linux下的交叉编译步骤
- glib交叉编译过程
- alsa-lib,alsa-utils交叉编译步骤
- Linux下搭建ARM交叉编译环境的步骤
- glib 交叉编译
- 【ARM】交叉编译 bluez-4.95 步骤及使用方法
- Ubuntu12.04下交叉编译Qt4.8.2步骤
- arm下交叉编译glib-2.28.8
- 交叉编译场景分析(arm-linux)(八)--编译glib
- 交叉编译场景分析(arm-linux)(八)--编译glib
- Glib在arm-linux下的交叉编译
- sqlite3数据库交叉编译并移植到嵌入式开发环境步骤
- 交叉编译场景分析(arm-linux)(八)--编译glib
- 交叉编译场景分析(arm-linux)(八)--编译glib
- 学习笔记:MIPS 交叉编译GLIB
- Glib在arm-linux下的交叉编译
- 交叉编译场景分析(arm-linux)(八)--编译glib
- glib交叉编译