编译环境

ubuntu 16.04麒麟amd64,移植目标为三星6818的板子。

编译过程

1、按照我的习惯做一个make.sh,用来编译,内容如下:./configure --host=arm-linux --prefix=/usr/local/dbus-1.0.2-arm CC=~/9dx6818/x6818_linux_160719/buildroot/output/host/usr/bin/arm-cortex_a9-linux-gnueabi-gcc --cache-file=arm-linux.cache --without-x

make

上面的编译选项是网上流行的,但是--host这个选项编译的时候会出现警告,所以这个配置是否完全正确其实还有值得思考的地方,但是我也是拿来主要者,编译过了就再冇精力研究;--prefix这个选项只能配置为绝对路径,执行make install后会将编译成功都拷贝到这个目录;CC选择用于指定交叉编译公交链。

2、执行make.sh编译出错:checking abstract socket namespace... configure: error: cannot run test program while cross compiling

安装和配置pkgconfig:$ sudo apt-get install pkgcon

$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig

$ echo ac_cv_have_abstract_sockets=yes>arm-linux.cache

重新执行make.sh编译。

3、又出现错误:n file included from dbus-sysdeps-unix.c:41:0:

/home/codbo/9dx6818/x6818_linux_160719/buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/sys/socket.h:219:12: note: expected 'socklen_t * __restrict__' but argument is of type 'int *'

dbus-sysdeps-unix.c:996:18: warning: unused variable 'cr' [-Wunused-variable]

dbus-sysdeps-unix.c: In function 'split_paths_and_append':

dbus-sysdeps-unix.c:2550:4: warning: passing argument 1 of '_dbus_string_init_const' discards 'const' qualifier from pointer target type [enabled by default]

In file included from dbus-sysdeps-unix.c:31:0:

dbus-string.h:66:15: note: expected 'struct DBusString *' but argument is of type 'const struct DBusString *'

dbus-sysdeps-unix.c: In function '_dbus_get_standard_session_servicedirs':

dbus-sysdeps-unix.c:2719:7: warning: passing argument 1 of '_dbus_string_init_const' discards 'const' qualifier from pointer target type [enabled by default]

In file included from dbus-sysdeps-unix.c:31:0:

dbus-string.h:66:15: note: expected 'struct DBusString *' but argument is of type 'const struct DBusString *'

Makefile:632: recipe for target 'dbus-sysdeps-unix.lo' failed

make[3]: *** [dbus-sysdeps-unix.lo] Error 1

make[3]: Leaving directory '/home/codbo/9dx6818/x6818_linux_160719/dbus-1.0.2/dbus'

Makefile:468: recipe for target 'all' failed

make[2]: *** [all] Error 2

make[2]: Leaving directory '/home/codbo/9dx6818/x6818_linux_160719/dbus-1.0.2/dbus'

Makefile:397: recipe for target 'all-recursive' failed

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory '/home/codbo/9dx6818/x6818_linux_160719/dbus-1.0.2'

Makefile:293: recipe for target 'all' failed

打开dbus/dbus-sysdeps-unix.c,添加下面代码:#if 1 // make note:fix error

struct ucred

{

pid_t pid; /* PID of sending process. */

uid_t uid; /* UID of sending process. */

gid_t gid; /* GID of sending process. */

};

#endif

5、重新执行make.sh编译,没再遇到其他错误,看网友接下来有遇到libxml错误的,但是我的交叉编译环境其实已经有这个库了,所以不会有此问题。执行下面命令并安装库$ make install

附:

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐