当前位置:文档之家› bluez 交叉编译--测试通过(参考了网上的教程,并做了修改)

bluez 交叉编译--测试通过(参考了网上的教程,并做了修改)

bluez 交叉编译--测试通过(参考了网上的教程,并做了修改)arm-linux-gcc 4.3.3==========================================我用到的几个库:bluez-lib-3.36.tar.gzexpat-2.0.1.tar.gzdbus-1.2.16.tar.gzglib-2.22.4.tar.bz2libusb-0.1.12.tar.gzbluez-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 install2,编译安装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 install3,编译安装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-linuxCC="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>>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 compilingSee `config.log' for more details.#echo ac_cv_func_posix_getwuid_r=yeschecking for gmtime_r... (cached) yeschecking for posix getpwuid_r... (cached) yeschecking for posix getgrgid_r... configure: error: in `/home/yan/glib-2.22.4': configure: error: cannot run test program while cross compilingSee `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 <bits/posix1_lim.h>#make install如果出现找不到的东西将安装好的lib/pkconfig/下面的文件拷贝到/usr/lib/pkconfig下正确配置的./configure --prefix=/opt/glib --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I/opt/libs/include -L/opt/libs/lib"--cache-file=arm-linux.cache ac_cv_have_abstract_sockets=yesac_cv_type_long_long=yes glib_cv_stack_grows=no glib_cv_uscore=noac_cv_func_posix_getpwuid_r=yes ac_cv_func_posix_getgrgid_r=yes===================================================================== ===================编译安装bluez-utils-3.36.tar.gz#tar zxvf bluez-utils-3.36.tar.gzCC="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-a ngstrom-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-a ngstrom-linux-gnueabi/include/bits/stdlib.h:70:3: error: #error "Assumed value of MB_LEN_MAX wrong"make[2]: *** [glib-helper.o] Error 1make[2]: Leaving directory `/home/yan/bluez-utils-3.36/common'make[1]: *** [all-recursive] Error 1make[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====================================================./configure --prefix=/opt/bluez-utils --host=arm-linux --target=arm-linuxCC="arm-linux-gcc -I/opt/libs/include -L/opt/libs/lib" --disable-audio这样Bluez协议栈就编译好了。

相关主题