交叉编译D-Bus之备忘录

荒凉一梦 提交于 2019-12-06 08:42:32
安装包命令:
./configure CC=arm-unknown-linux-gnu-gcc --prefix=/home/qudc/nfs --host=arm-linux --cache-file=arm-linux.cache
指定交叉编译工具                         指定安装路径            指定目标平台
make
make install
 
1. 把"export PATH=$PATH:/home/qudc/gcc-4.0.2-glibc-2.3.5/arm-unknown-linux-gnu/bin (不要加/)" 加入/home/qudc/.bashrc
 export交叉编译工具链接路径.
 
2. 用root apt-get install gcc
 
3. 解压交叉编译工具和linux kernel 使kernel 中make menuconfig 成功. 会遇到头文件报错问题: 安装libc6-dev 和 libncurses5-dev 这两个包. make menuconfig 成功.
 
4. 安装pkg-config (只能是0.9版, 系统debian4是0.21版, 不然dbus编译不过) 为glib做准备. apt-get install pkg-config
 
5. 解决安装glib的编译错误
 stack pointer 问题:
 echo ac_cv_type_long_long=yes>arm-linux.cache
 echo glib_cv_stack_grows=no>>arm-linux.cache
 echo glib_cv_uscore=no>>arm-linux.cache
 echo ac_cv_func_posix_getpwuid_r=yes>>arm-linux.cache 
 configure: error: Could not find a glib-genmarshal in your PATH
 解压glib2-devel-2.4.7-1.tar.gz, 将文件复制到/usr/local下面
 
6. 安装expat-2.0.0.tar.gz
 
7. 安装libxml.tar.bz2
 
8. install dbus-1.0.2.tar.gz
 checking abstract socket namespace... configure: error: cannot run test program while cross compiling
 #echo ac_cv_have_abstract_sockets=yes>arm-linux.cache
 
 PKG_CONFIG_PATH 问题:
 在.bashrc里 export PKG_CONFIG_PATH
 export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/home/qudc/nfs/lib/pkgconfig
 configure成功
 
9. Install dbus-glib-0.74.tar.gz
 checking for posix getpwnam_r... configure: error: cannot run test program while cross compiling
 checking abstract socket namespace... configure: error: cannot run test program while cross compiling
 在arm-linux.cache文件里加两行
 ac_cv_func_posix_getpwnam_r=yes
 ac_cv_have_abstract_sockets=yes
 
 ./configure: line 26052: ./po/POTFILES.in: No such file or directory (这行有人说可以忽略)
 checking for XML_ParserCreate_MM in -lexpat... (cached) no
 configure: error: expat library not found, check config.log for failed attempts
 解决: #./configure CC=arm-unknown-linux-gnu-gcc CPPFLAGS=-I/home/qudc/nfs/include LDFLAGS=-L/home/qudc/nfs/lib --prefix=/home/qudc/nfs --host=arm-linux --cache-file=arm-linux.cache
 
 make 出错信息:
 Making all in examples
 make[4]: Entering directory `/home/qudc/dbus-glib-0.74/dbus/examples'
 /bin/sh ../../libtool --mode=execute ../../dbus/dbus-binding-tool --prefix=some_object --mode=glib-server --output=example-service-glue.h ./example-service.xml
 /home/qudc/dbus-glib-0.74/dbus/examples/../../dbus/dbus-binding-tool: line 105: /home/qudc/dbus-glib-0.74/dbus/.libs/lt-dbus-binding-tool: cannot execute binary file
 /home/qudc/dbus-glib-0.74/dbus/examples/../../dbus/dbus-binding-tool: line 105: /home/qudc/dbus-glib-0.74/dbus/.libs/lt-dbus-binding-tool: Success
 make[4]: *** [example-service-glue.h] Error 1
 make[4]: Leaving directory `/home/qudc/dbus-glib-0.74/dbus/examples'
 make[3]: *** [all-recursive] Error 1
 make[3]: Leaving directory `/home/qudc/dbus-glib-0.74/dbus'
 make[2]: *** [all] Error 2
 make[2]: Leaving directory `/home/qudc/dbus-glib-0.74/dbus'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory `/home/qudc/dbus-glib-0.74'
 make: *** [all] Error 2
 解决:修改./dbus/Makefile.
  SUBDIRS = . examples => SUBDIRS = . #example
 
 make再次出错信息:
 Making all in tools
 make[2]: Entering directory `/home/qudc/dbus-glib-0.74/tools'
 DBUS_TOP_BUILDDIR=.. dbus-daemon --introspect > dbus-bus-introspect.xml.tmp && mv dbus-bus-introspect.xml.tmp dbus-bus-introspect.xml
 ../dbus/dbus-binding-tool --mode=glib-client --prefix=dbus_bus --output=dbus-glib-bindings.h dbus-bus-introspect.xml
 ../dbus/dbus-binding-tool: line 105: /home/qudc/dbus-glib-0.74/dbus/.libs/lt-dbus-binding-tool: cannot execute binary file
 ../dbus/dbus-binding-tool: line 105: /home/qudc/dbus-glib-0.74/dbus/.libs/lt-dbus-binding-tool: Success
 make[2]: *** [dbus-glib-bindings.h] Error 1
 make[2]: Leaving directory `/home/qudc/dbus-glib-0.74/tools'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory `/home/qudc/dbus-glib-0.74'
 make: *** [all] Error 2
 解决: 修改./dbus/Makefile.
  SUBDIRS = . examples => SUBDIRS = . #example
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!