arm下交叉编译glib-2.28.8

来源:互联网 发布:js的杀破狼 编辑:程序博客网 时间:2024/05/17 07:14
 

废话不多, 直接上配置:
CC=arm-none-linux-gcc  ./configure --build=i686-linux --host=arm-none-linux \
        glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes \
        ac_cv_func_posix_getgrgid_r=yes ac_cv_lib_rt_clock_gettime=no glib_cv_monotonic_clock=yes
 
 注意如下几点:      
 1. 在configure的时候, 会出现找不到glib-compile-schemas错误,
 解决办法很简单, 就是先用host编译glib-2.28.8, 也就是直接:
 ./configure --prefix=<your glib2 install path>; make; make install
 编译好以后, 设置环境变量PATH=<your glib2 install path>/bin:$PATH即可, 就可以找到glib-compile-schemas了。
 
  2. 在Make的如果还会出现如下错误:
gsimpleaction.c: In function 'g_simple_action_class_init':
gsimpleaction.c:329: error: 'g_cclosure_marshal_VOID__VARIANT' undeclared (first use in this function)
gsimpleaction.c:329: error: (Each undeclared identifier is reported only once

这个错误原因是因为glib-genmarshal版本过老引起的, 可以从gobject目录下安装该文件到:<your glib2 install path>/bin即可解决,
一般如果做了第一步, 这步就不会出错了,因为第一步安装的时候会把这个文件安装好了。

3. 如果在编译gio/tests的时候出现如下错误:
/usr/bin/msgfmt -o test.mo ./de.po; \
        /bin/mkdir -p de/LC_MESSAGES; \
        cp -f test.mo de/LC_MESSAGES
./de.po:15: keyword "msgctxt" unknown
./de.po:15:8: parse error
/usr/bin/msgfmt: found 2 fatal errors
cp: cannot stat `test.mo': No such file or directory

这个问题就是因为/usr/bin/msgfmt版本过老引起的, 请下载的gettext-0.17或者更新版本, 在host下编译安装后,
设置环境变量 PATH=<your gettext install path>/bin:$PATH, 同时还要在configure的时候指定ac_cv_path_MSGFMT=msgfmt,
否则设置了环境变量也没用, 编译的时候还是会强制使用/usr/bin/msgfmt

做了以上3点以后, glib-2.28.8就能大功编成了。