全部博文(92)
分类: 嵌入式
2010-05-19 16:38:41
Bluez移植_ bluez-utils-3.36编译
本人主要工作就是依赖ARM9平台实现蓝牙通信,通过可触摸屏实现远程控制。Qtopia-4.2.4中提供了对蓝牙的支持(),需要依赖两个bluez源码包:bluez-libs-3.36和bluez-utils-3.36
我用的开发环境是
内核版本:
Linux-2.6.31
交叉编译器版本:
arm-linux-gcc 4.1.2
操作系统平台:
Linux – Red Hat 9.0
开发板平台:
Arm – TX2440
使用的工具:
Busybox-1.15.2
我用到的几个库:
bluez-lib-3.36.tar.gz
expat-2.0.1.tar.gz
dbus-1.2.16.tar.gz
glib-2.22.4.tar.bz2
libusb-0.1.12.tar.gz
bluez-utils-3.36.tar.gz
注:/opt/libs 和/opt/utils是我自己编译时用的路径,你可以随便的选取。
1,编译安装bluez-lib-3.36.tar.gz
这个库不需要什么依赖,直接解压,配置,编译然后安装即可。
#tar zxvf bluez-lib-3.36.tar.gz
#./configure --prefix=/opt/libs --host=arm-linux --target=arm-linux CC=arm-linux-gcc
#make
#make install
2,编译安装expat-2.0.1.tar.gz
这个库是后面的dbus依赖的,你也可以用libxml2来代替expat,官方网站上说dbus必须依赖于他们中的一个,我这里用的是expat-2.0.1.tar.gz。
#tar zxvf expat-2.0.1.tar.gz
#./configure --prefix=/opt/libs --host=arm-linux --target=arm-linux CC=arm-linux-gcc
#make
#make install
3,编译安装dbus-1.2.16.tar.gz
#tar zxvf dbus-1.2.16.tar.gz
#echo ac_cv_have_abstract_sockets=yes>arm-linux.cache
#./configure --prefix=/opt/libs --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I/opt/libs/include -L/opt/libs/lib" --cache-file=arm-linux.cache --with-x=no
#make
#make install
4,编译安装glib-2.22.4.tar.bz2
#tar -zxjf glib-2.22.4.tar.bz2
#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 c_cv_func_posix_getpwuid_r=yes>>arm-linux.cache
#echo ac_cv_func_posix_getgrgid_r=yes>>
#./configure --prefix=/opt/libs --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I/opt/libs/include -L/opt/libs/lib" --cache-file=arm-linux.cache
有错误:
checking for posix getpwuid_r... configure: error: in `/home/yan/glib-2.22.4':
configure: error: cannot run test program while cross compiling
See `config.log' for more details.
#echo ac_cv_func_posix_getwuid_r=yes
checking for gmtime_r... (cached) yes
checking for posix getpwuid_r... (cached) yes
checking for posix getgrgid_r... configure: error: in `/home/yan/glib-2.22.4':
configure: error: cannot run test program while cross compiling
See `config.log' for more details.
#echo ac_cv_func_posix_getgrgid_r=yes>>arm-linux.chace
我的经验是以下三种方法都可以试试:
#echo ac_cv_func_posix_getwuid_r=yes
#echo ac_cv_func_posix_getwuid_r=yes>>
#echo ac_cv_func_posix_getwuid_r=yes>>arm-linux.cache
#make
有错误:
> giounix.c: In function `g_io_unix_read':
> giounix.c:181: `SSIZE_MAX' undeclared (first use in this function)
> giounix.c:181: (Each undeclared identifier is reported only once
> giounix.c:181: for each function it appears in.)
> make[3]: *** [giounix.lo] Error 1
[root@localhost glib-2.22.4]# find ./|grep giounix
./glib/giounix.c
./glib/.deps/giounix.Plo
./glib/.libs/giounix.o
./glib/giounix.lo
在 glib/giounix.c中加入:
#include
#make install
5,编译安装libusb-0.1.12.tar.gz
这个库不需要什么依赖,直接解压,配置,编译然后安装即可。
#tar zxvf libusb-0.1.12.tar.gz
#./configure --prefix=/opt/libs --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I/opt/libs/include -L/opt/libs/lib"
#make
#make install
6,编译安装bluez-utils-3.36.tar.gz
#tar zxvf bluez-utils-3.36.tar.gz
#./configure --prefix=/opt/libs --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I/opt/libs/include -L/opt/libs/lib" --disable-audio
#make
有错误:
In file included from /opt/toolchains/arm920t-eabi/lib/gcc/arm-angstrom-linux-gnueabi/4.1.2/../../../../arm-angstrom-linux-gnueabi/include/stdlib.h:969,
from ../eglib/gmain.h:4,
from ../eglib/glib.h:1,
from glib-helper.c:41:
/opt/toolchains/arm920t-eabi/lib/gcc/arm-angstrom-linux-gnueabi/4.1.2/../../../../arm-angstrom-linux-gnueabi/include/bits/stdlib.h:70:3: error: #error "Assumed value of MB_LEN_MAX wrong"
make[2]: *** [glib-helper.o] Error 1
make[2]: Leaving directory `/home/yan/bluez-utils-3.36/common'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/yan/bluez-utils-3.36'
make: *** [all] Error 2
解决方法:
[root@localhost opt]# find ./|grep stdlib.h
./toolchains/arm920t-eabi/arm-angstrom-linux-gnueabi/include/stdlib.h
./toolchains/arm920t-eabi/arm-angstrom-linux-gnueabi/include/bits/stdlib.h
在/toolchains/arm920t-eabi/arm-angstrom-linux-gnueabi/include/bits/stdlib.h中
将
#define STDLIB_MB_LEN_MAX 16
改为
#define STDLIB_MB_LEN_MAX 1
#make install
这样Bluez协议栈就编译好了。