现在的位置: 首页 > 综合 > 正文

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

2013年03月31日 ⁄ 综合 ⁄ 共 4334字 ⁄ 字号 评论关闭
arm-linux-gcc 4.3.3
==========================================

我用到的几个库:

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 <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=yes ac_cv_type_long_long=yes glib_cv_stack_grows=no glib_cv_uscore=no ac_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.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

====================================================

 ./configure --prefix=/opt/bluez-utils --host=arm-linux --target=arm-linux     CC="arm-linux-gcc -I/opt/libs/include -L/opt/libs/lib" --disable-audio


这样Bluez协议栈就编译好了。

抱歉!评论已关闭.