交叉编译 glib

首先创建文件 arm-linux.cache,内容如下:

$ cat arm-linux.cache 
ac_cv_type_long_long=yes
glib_cv_stack_grows=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=yes

然后去掉 write属性:

chmod a-w arm-linux.cache

之后,执行 configure:

./configure --host=arm-linux-gnueabi     --prefix=/home/charles/code/build_systemd/_install --cache-file=arm-linux.cache CFLAGS=-I/home/charles/code/build_systemd/_install/include LDFLAGS=-L/home/charles/code/build_systemd/_install/lib

参考:

http://blog.csdn.net/absurd/article/details/646993


为了解决对于 libffi的依赖,在配置的时候,需要加上

LIBFFI_CFLAGS="-I/home/charles/code/build_systemd/_install/lib/libffi-3.2.1/include" LIBFFI_LIBS="-I/home/charles/code/build_systemd/_install/lib -lffi"

最后 link的时候报错:

/toolchain/armv7-gcc-6.3/bin/../lib/gcc/arm-linux-gnueabi/6.3.0/../../../../arm-linux-gnueabi/bin/ld: warning: libgmodule-2.0.so.0, needed by ./.libs/libgio-2.0.so, not found (try using -rpath or -rpath-link)
./.libs/libgio-2.0.so: undefined reference to `g_module_close'
./.libs/libgio-2.0.so: undefined reference to `g_module_symbol'
./.libs/libgio-2.0.so: undefined reference to `g_module_supported'
./.libs/libgio-2.0.so: undefined reference to `g_module_open'
./.libs/libgio-2.0.so: undefined reference to `g_module_error'

解决方法是,在 gio/Makefile 里找到 LDFLAGS, 在最后加 -lgmodule-2.0


但之后还有这样的错误:

  GEN      glib-compile-schemas.1
Error: no ID for constraint linkend: "GSettings".
Error: no ID for constraint linkend: "GSettings".
  GEN      glib-compile-resources.1
Error: no ID for constraint linkend: "GResource".
Error: no ID for constraint linkend: "GResource".
Error: no ID for constraint linkend: "G-GNUC-INTERNAL:CAPS".

还没搞懂这个是什么意思。。

你可能感兴趣的:(Linux)