为ARM编译Glib

一些有用的参考:

http://gtk-doc-cn.googlecode.com/svn/docs/glib/glib-cross-compiling.html

http://blog.sina.com.cn/s/blog_630dcb970100fxtv.html

glib下载:http://ftp.gnome.org/pub/gnome/sources/glib/2.32/

一、解压,进入源代码目录,新建一个文本文件arm.cache

向文件里写入如下配置:

glib_cv_long_long_format=yes
glib_cv_stack_grows=no
glib_cv_working_bcopy=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_nonposix_getpwuid_r=no
ac_cv_func_posix_getgrgid_r=no

二、配置

cody@debian:~/arm210/glib-2.22.5$ ./configure --cache-file=arm.cache --host=arm-linux

三、编译

make

到目前没出现错误

四、安装

sudo make install

错误1:

/home/cody/arm210/glib-2.22.5/libtool: line 7847: arm-linux-gcc: command not found
libtool: install: error: relink `libgmodule-2.0.la' with the above command before installing it

解决:使用su切换到root再make,发现还是提示

arm-linux-gcc: command not found

在命令行输入arm-linux-gcc试试看,恩,提示没找到命令,看来是root没有把工具链的变量包括起来,

先export工具链的路径:

export PATH=/opt/FriendlyARM/toolschain/4.5.1/bin/:$PATH

再make,没问题

再make install,没问题

悲剧了,安装在/usr/local/bin里去了,这不是我想要的,先 make uninstall。

再configure一次:

./configure --cache-file=arm.cache --host=arm-linux --prefix=/opt/glib-2.22.5

再make,出现错误,删掉所有源文件,重新从压缩包里解压再来一次,OK了

原文地址:https://www.cnblogs.com/openusb/p/3434212.html