现在将编译中遇到的错误贴出来:
1. 编译bluez-libs-3.36
[mystic@moolenaar]$ ./configure --host=arm-linux
make编译通过。把make后生成的bluez.pc文件拷贝到/usr/lib/pkgconfig目录但要做好pc版本的bluez.pc的备份。下以便交叉编译完bluez后恢复。这个bluez.pc要使用
copy bluez.pc to usr/lib/pkgconfig
2. 编译bluez-utils-3.36,缺少D-Bus
[mystic@moolenaar]$ ./configure --host=arm-linux
checking pkg-config is at least version 0.9.0... yes
checking for BLUEZ... yes
checking for GLIB... no
checking for GMODULE... no
checking for dlopen in -ldl... yes
checking for DBUS... no
configure: error: D-Bus library is required
bluez-utils需要d-bus包的支持,下载d-bus的源代码编译安装。bluez-utils需要的其他一些源码包将在最后贴出。(包括使用的版本号)
3.
[mystic@moolenaar]$ ./configure --host=arm-linux --prefix=/bluez/dbus
checking for getpeereid... no
checking abstract socket namespace... configure: error: cannot run test program while cross compiling
See `config.log' for more details.
执行./configure时要在宿主系统中运行一些测试程序,因为是交叉编译所以这个测试是一定通不过的。不过没问题,我们可以在configure时指定cache-file文件来屏障掉测试程序,在下面编译glib包时会遇到同样的问题。
处理方法:
在源码包根目录下执行
[mystic@moolenaar]$ echo ac_cv_have_abstract_sockets=yes > arm-linux.cache
[mystic@moolenaar]$ ./configure --host=arm-linux --prefix=/bluez/dbus
./configure通过后,执行make,出现如下错误:
make[2]: *** [config-loader-libxml.o]
make[2]: Leaving directory `/3.3.2/dbus-1.0.2/bus'
make[1]: *** [all-recursive] error
make[1]: Leaving directory `/3.3.2/dbus-1.0.2'
make: *** [all]
缺少xml库,下载编译安装后,copy
4. 编译dbus,cannot find -lX11
[mystic@moolenaar]$ make
arm-linux/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
make[2]: *** [dbus-launch]
make[2]: Leaving directory `/3.3.2/dbus-1.0.2/tools'
make[1]: *** [all-recursive]
make[1]: Leaving directory `/3.3.2/dbus-1.0.2'
make: *** [all]
在开发板上不需要X Server. configure直接屏蔽掉。
[mystic@moolenaar]$ ./configure --host=arm-linux --prefix=/bluez/dbus
bridge.c:82: error: `SIOCBRADDBR' undeclared (first use in this function)
bridge.c:82: error: (Each undeclared identifier is reported only once
bridge.c:82: error: for each function it appears in.)
bridge.c: In function `bridge_remove':
bridge.c:100: error: `SIOCBRDELBR' undeclared (first use in this function)
bridge.c: In function `bridge_add_interface':
bridge.c:126: error: `SIOCBRADDIF' undeclared (first use in this function)
make[2]: *** [bridge.lo]
make[2]: Leaving directory `/3.3.2/bluez-utils-3.36/network'
make[1]: *** [all-recursive]
make[1]: Leaving directory `/3.3.2/bluez-utils-3.36'
make: *** [all]
在bluez-utils-3.36/network/bridge.h中添加如下宏定义:
#define SIOCBRADDBR
#define SIOCBRDELBR
#define SIOCBRADDIF
#define SIOCBRDELIF
6. 编译bluez-utils
[mystic@moolenaar]$ make
storage.c
storage.c: In function `encrypt_link':
storage.c:286: error: `ENOKEY' undeclared (first use in this function)
storage.c:286: error: (Each undeclared identifier is reported only once
storage.c:286: error: for each function it appears in.)
make[2]: *** [storage.lo]
make[2]: Leaving directory `/3.3.2/bluez-utils-3.36/input'
make[1]: *** [all-recursive]
make[1]: Leaving directory `/3.3.2/bluez-utils-3.36'
make: *** [all]
在bluez-utils-3.36/input/storage.c加入宏定义
#define ENOKEY EACCES
还会遇到缺少audio模块的错误,我的蓝牙中没有使用audio,所以在./configure时也直接--disable-audio。
bluez-utils-3.36依赖的其他源码包:
[glib必须使用2.14以后版本。编译utils包时,g_timeout_add_seconds函数在此版本以后定义]
dbus-1.0.2
glib-2.14.4
libxml2-2.6.11
libsndfile-1.0.17
libusb-0.1.12