在mini2440上移植Bluetooth
(2013-07-24 20:37:09)1.编译安装bluez-libs-3.36.tar.gz
sudo mkdir /opt/lib
sudo mkdir /opt/utils
这个库不需要什么依赖,直接解压,配置,编译然后安装即可。
#tar #cd bluez-libs-3.36/
#./configure
#sudo make
#sudo make
问题:../libtool: line 1311: arm-linux-gcc: command not found
解答:(参考http://blog.csdn.net/sdwuyulunbi/article/details/6152437)
sudo -s
vim /etc/profile 添加:
export PATH=$PATH:/home/hxy/FriendlyARM/wifi/opt/FriendlyARM/toolschain/4.4.3/bin
source /etc/profile
2.编译安装expat-2.0.1.tar.gz
tar xvzf expat-2.0.1.tar.gz
cd expat-2.0.1/
make
make install
或apt-get install libexpat1-dev
3.编译安装dbus-1.6.0.tar.gz
tar xvzf dbus-1.6.0.tar.gz
cd dbus-1.6.0/
#echo ac_cv_have_abstract_sockets=yes>arm-linux.cache
#./configure --prefix=/opt/lib --host=arm-linux --target=arm-linux
make
make install
4.编译安装glib-2.28.7.tar.bz2
tar xvjf glib-2.22.4.tar.bz2
cd glib-2.22.4/
vim arm-linux.cache 添加:
glib_cv_long_long_format=ll
glib_cv_stack_grows=no
glib_cv_working_bcopy=no
glib_cv_sane_realloc=yes
glib_cv_have_strlcpy=no
glib_cv_va_val_copy=yes
glib_cv_rtldglobal_broken=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_nonposix_getpwuid_r=no
ac_cv_func_posix_getgrgid_r=no
glib_cv_use_pid_surrogate=no
ac_cv_func_printf_unix98=no
ac_cv_func_vsnprintf_c99=no
ac_cv_path_GLIB_COMPILE_SCHEMAS=yes
./configure --prefix=/opt/lib --host=arm-linux --target=arm-linux
make
make install
问题:configure: error:
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
解答:(参考http://blog.csdn.net/ybdesire/article/details/7249896
http://www.cnblogs.com/soli/archive/2008/01/14/1039010.html)
去http://www.gnu.org/software/gettext/gettext.httar xvzf gettext-0.18.3.tar.gzml下载gettext-0.18.3.tar.gz
cd gettext-0.18.3/
./configure
make
make install
sudo vim /etc/ld.so.conf 添加有可能用到的库安装路径
/usr/local/lib
/opt/lib
ldconfig( 改动库文件后一定要运行一下)
问题:configure: error: Could not find a glib-genmarshal in your PATH
解答:(参考http://blog.chinaunix.net/uid-21931055-id-328766.html)
从http://rpm.pbone.net/index.php3/stat/4/idpl/2294397/dir/suse_8.x/com/glib2-devel-2.0.3-1.i386.rpm.html下载glib2-devel-2.0.3-1.i386.rpm
apt-get install rpm2cpio
rpm2cpio glib2-devel-2.0.3-1.i386.rpm | cpio -idm将在当前文件夹生成usr文件夹
cp -r usr /
问题:gsimpleaction.c: In function 'g_simple_action_class_init':
gsimpleaction.c:329: error: 'g_cclosure_marshal_VOID__VARIANT' undeclared (first use in this function)
gsimpleaction.c:329: error: (Each undeclared identifier is reported only once
gsimpleaction.c:329: error: for each function it appears in.)
解答: (参考http://www.douban.com/note/216473248/
http://www.linuxdiyf.com/viewarticle.php?id=107892)
编译glib需要libffi, pkg-config, gettext。
安装 zlib。从http://www.onlinedown.net/softdown/169854_2.htm下载 zlib-1.2.5.tar.zip
unzip zlib-1.2.5.tar.zip
tar xvjf zlib-1.2.5.tar.bz2
cd zlib-1.2.5/
./configure
make
make install
whereis zlib.*
zlib:
zlib.3:
zlib:
zlib:
zlib:
zlib.pc:
apt-get install zlib1g-dev
# whereis zlib.*
zlib: /usr/include/zlib.h /usr/share/man/man3/zlib.3.gz
zlib.3: /usr/share/man/man3/zlib.3.gz
zlib: /usr/include/zlib.h /usr/share/man/man3/zlib.3.gz
zlib: /usr/include/zlib.h /usr/share/man/man3/zlib.3.gz
zlib: /usr/include/zlib.h /usr/share/man/man3/zlib.3.gz
zlib.pc:
这次应该安装上了。
安装libffi。从http://www.mirrorservice.org/sites/sourceware.org/pub/libffi/下载libffi-3.0.11-rc2.tar.gz。
tar xvzf libffi-3.0.11-rc2.tar.gz
cd libffi-3.0.11-rc2/
./configure
make
make install
安装 pkg-config。从http://download.chinaunix.net/download/0009000/8174.shtml下载pkgconfig-0.17.2.tar.bz2。
pkg-config --version
出现0.26 ,说明已经安装上了pkg-config。
whereis pkgconfig
出现pkgconfig: /usr/lib/pkgconfig /usr/local/lib/pkgconfig /usr/share/pkgconfig,同理,说明已经安装上了。
添加环境变量#vim /etc/profile
export LIBFFI_CFLAGS=/usr/local/lib/libffi-3.0.11-rc2/
export LIBFFI_LIBS=/usr/local/lib/
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
#source /etc/profile
问题:(process:22906): GLib-Genmarshal-WARNING **: unknown type: VARIANT
(process:22906): GLib-Genmarshal-WARNING **: unknown type: VARIANT
(process:22906): GLib-Genmarshal-WARNING **: unknown type: VARIANT
(process:22906): GLib-Genmarshal-WARNING **: unknown type: VARIANT
(process:22906): GLib-Genmarshal-WARNING **: unknown type: VARIANT
(process:22906): GLib-Genmarshal-WARNING **: failed to open "--internal": No such file or directory
解答: #vim gobject/stamp-gmarshal.h 注释
//timestamp(注意这里修改完,重新编译,居然又恢复了原样。离奇!!!)
//
#vim gobject/gmarshal.c
删掉文件开头的空行。
//
//
vim tests/gobject/stamp-testmarshal.h 新建文件
什么也不输入,保存退出。
(尚未解决该问题,愁!)
改用最新的glib-2.37.4,编译make,出现如下问题:
问题:.arm-none-linux-gnueabi-gcc: /usr/include/libffi-3.0.11-rc2/: No such file or directory
解答:vim arm-linux.cache,把/usr/include/libffi-3.0.11-rc2/改成/usr/local/lib/ libffi-3.0.11-rc2/
5.编译安装libusbx-1.0.16.tar.bz2
tar xvjf libusbx-1.0.16.tar.bz2
cd libusbx-1.0.16/
./configure --prefix=/opt/lib --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I/opt/lib/include -L/opt/lib/lib"
6.编译安装bluez-5.7.tar
xz -d bluez-5.7.tar.xz
tar xvf bluez-5.7.tar
cd bluez-5.7/
./configure --prefix=/opt/lib --host=arm-linux --target=arm-linux
**************************************************************************************************
(有点做不下去了,环境变量,安装路径这些搞得一团糟,对于菜鸟级的我还是不继续这么走下去了,自己都绕晕了,改用 http://blog.sina.com.cn/s/blog_7784d04f0100vrb3.html
http://blog.csdn.net/songjinshi/article/details/6520699的方式,做下来,挺顺畅的。)
首先将下载的所有包都放在bluetooth文件夹下。并在该文件夹下建立bluetooth-build文件夹,并将其输出到环境变量。
#cd
#mkdir
#blue=$PWD/bluetooth-build
#export blue
#exportdeclare -x blue="/home/hxy/FriendlyARM/bluetooth/bluetooth-build"
(#sudo -s //进入超级终端后面编译才不会出错
注意:千万别进入超级终端编译安装,很容易破坏系统的根文件。!!!)
1 、编译alsa-lib库
#tar
#cd alsa-lib-1.0.27.2
#./configure --prefix=$blue CC=arm-linux-gcc --host=arm-linux --disable-python
#make
#make install
2、编译expat
#tar –zxvf expat-2.0.1.tar.gz
#cd expat-2.0.1
#./configure --prefix=$blue CC="arm-linux-gcc -I$blue/include -L$blue/lib " --host=arm-linux
#make
#make install
3、编译D-Bus
#tar
#cd
#echo ac_cv_have_abstract_sockets=yes>arm-linux.cache
#./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib"
#make
#make install
4、编译gettext
tar xvzf gettext-0.18.3.tar.gz
cd gettext-0.18.3/
./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib"
make
make install
5、安装zlib。
unzip zlib-1.2.5.tar.zip
tar xvjf zlib-1.2.5.tar.bz2
cd zlib-1.2.5/
(cp win32/Makefile.gcc Makefile
./configure --prefix=$blue
make
make install
6、编译libffi
tar xvzf libffi-3.0.11-rc2.tar.gz
./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib"
make
make install
7、编译bluez-libs
tar xvzf bluez-libs-3.36.tar.gz
cd bluez-libs-3.36/
./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib"
make
make install
8、编译glib
tar xvjf glib-2.28.6.tar.bz2
cd glib-2.28.6/
#vim arm-linux.cache 输入
(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
或:)
glib_cv_long_long_format=ll
glib_cv_stack_grows=no
glib_cv_working_bcopy=no
glib_cv_sane_realloc=yes
glib_cv_have_strlcpy=no
glib_cv_va_val_copy=yes
glib_cv_rtldglobal_broken=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_nonposix_getpwuid_r=no
ac_cv_func_posix_getgrgid_r=no
glib_cv_use_pid_surrogate=no
ac_cv_func_printf_unix98=no
ac_cv_func_vsnprintf_c99=no
ac_cv_path_GLIB_COMPILE_SCHEMAS=yes
./configure --prefix=$blue CC="arm-linux-gcc -I$blue/include -L$blue/lib " --host=arm-linux --cache-file=arm-linux.cache
问题:configure: error: *** You must have either have gettext support in your C library, or use the*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
解答:sudo apt-get install gettext(发现前面第四个步骤没用,估计还是安装路径的问题。)
问题:configure: error: Could not find a glib-genmarshal in your PATH
解答:apt-get install libglib2.0-dev
make
make install
9、编译libusb
从http://www.findthatzip-file.com/search-43797089-hZIP/winrar-winzip-download-libusb-1-0-8-tar-bz2.htm下载。
tar xvjf libusb-1.0.8.tar.bz2
cd libusb-1.0.8/
./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib"
makemake install
10、编译byacc
从http://invisible-island.net/byacc/byacc.html#download下载。
tar xvzf byacc.tar.gz
cd byacc-20130304/
./configure --prefix=$blue CC="arm-linux-gcc -I$blue/include -L$blue/lib " --host=arm-linux
make
make install
或apt-get install byacc。
11、编译Flex
从http://linux.softpedia.com/progDownload/Flex-Download-23296.html下载。
tar xvjf flex-2.5.37.tar.bz2
cd flex-2.5.37/
./configure --prefix=$blue CC="arm-linux-gcc -I$blue/include -L$blue/lib " --host=arm-linux
make
make install
或apt-get
12、bluez-utils
从http://pkgs.fedoraproject.org/repo/pkgs/bluez-utils/bluez-utils-3.36.tar.gz/4fc292b635ba7b442c7aaf56tar xvzf bluez-utils-3.36.tar.gz
cd bluez-utils-3.36/
./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib" --disable-audio
问题:configure: error: Bluetooth library is required
解答:apt-get install libbluetooth-dev
(参考:http://blog.csdn.net/do2jiang/article/details/4594716)
问题变成了:configure: error: D-Bus library is required
解答:apt-get install libdbus-1-dev libdbus-glib-1-dev
(参考http://www.360doc.com/content/12/1205/16/10388890_252294030.shtml)
make
问题:test -f lexer.c || /bin/bash ../ylwrap lexer.l .c lexer.c -- /bin/bash /home/hxy/FriendlyARM/bluetooth/bluez-utils-3.36/missing --run flex
make[3]: *** [lexer.c] 错误 1
解答: --disable-audio
(参考http://mikewei.blog.51cto.com/1571146/312658)
问题:libhciserver.a(device.o): In function `get_properties':
device.c:(.text+0x146c): undefined reference to `g_malloc0_n'
libhciserver.a(device.o): In function `browse_cb':
device.c:(.text+0x1bbc): undefined reference to `g_malloc0_n'
libhciserver.a(dbus-service.o): In function `list_trusted':
dbus-service.c:(.text+0x400): undefined reference to `g_malloc_n'
libhciserver.a(dbus-service.o): In function `register_service':
dbus-service.c:(.text+0xab0): undefined reference to `g_malloc0_n'
libhciserver.a(dbus-sdp.o): In function `remote_svc_identifiers_completed_cb':
dbus-sdp.c:(.text+0x9c4): undefined reference to `g_malloc_n'
libhciserver.a(adapter.o): In function `adapter_list_trusts':
adapter.c:(.text+0x444): undefined reference to `g_malloc_n'
/home/hxy/FriendlyARM/my_build/opt/FriendlyARM/toolschain/4.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.3/../../../../arm-none-linux-gnueabi/bin/ld: warning: creating a DT_TEXTREL in object.
collect2: ld returned 1 exit status
make[3]: *** [hcid] 错误 1
make[3]:正在离开目录 `/home/hxy/FriendlyARM/bluetooth/bluez-utils-3.36/hcid'
make[2]: *** [all] 错误 2
make[2]:正在离开目录 `/home/hxy/FriendlyARM/bluetooth/bluez-utils-3.36/hcid'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/home/hxy/FriendlyARM/bluetooth/bluez-utils-3.36'
make: *** [all] 错误 2
12*、编译bluez-4.87
./configure --prefix=$blue CC="arm-linux-gcc -I$blue/include -L$blue/lib " --host=arm-linux
问题:configure: error: D-Bus library is required
解答:sudo apt-get install libdbus-1-dev libdbus-glib-1-dev(可见前面安装dbus也一样没效果。)
make
问题:tools/hcitool.c: In function 'print_advertising_devices':
tools/hcitool.c:2306: error: 'EVT_LE_META_EVENT' undeclared (first use in this function)
tools/hcitool.c:2306: error: (Each undeclared identifier is reported only once
tools/hcitool.c:2306: error: for each function it appears in.)
tools/hcitool.c:2316: error: 'evt_le_meta_event' undeclared (first use in this function)
tools/hcitool.c:2316: error: 'meta' undeclared (first use in this function)
tools/hcitool.c:2317: error: 'le_advertising_info' undeclared (first use in this function)
tools/hcitool.c:2317: error: 'info' undeclared (first use in this function)
tools/hcitool.c:2336: error: expected expression before ')' token
tools/hcitool.c: In function 'cmd_lescan':
tools/hcitool.c:2381: warning: implicit declaration of function 'hci_le_set_scan_parameters'
tools/hcitool.c:2388: warning: implicit declaration of function 'hci_le_set_scan_enable'
tools/hcitool.c: In function 'cmd_lecc':
tools/hcitool.c:2460: warning: implicit declaration of function 'hci_le_create_conn'
13*.编译 libsndfile
从http://pkgs.fedoraproject.org/repo/pkgs/libsndfile/libsndfile-1.0.17.tar.gz/2d126c35448503f6dbe33934
tar xvzf libsndfile-1.0.17.tar.gz
cd libsndfile-1.0.17/
./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib"
make
make install
14*、 编译libxml
从http://linux.softpedia.com/progDownload/libxml2-Download-162.html下载。
tar xvzf libxml2-2.8.0.tar.gz
cd libxml2-2.8.0/
./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib" --without-zlib
make
make install
15*、 编译openobex
从http://download.chinaunix.net/download/0008000/7705.shtml下载。
tar xvzf openobex-1.2.tar.gz
cd openobex-1.2/
./configure --prefix=$blue --host=arm-linux --target=arm-linux CC="arm-linux-gcc -I$blue/include -L$blue/lib" --enable-bluetooth --disable-usb --enable-apps
make
make install
***************************************************************************************************
气死!!!
一律用
./configure
make
sudo make install(这个会覆盖系统的安装文件,万万不能操作!!!)
结果编译都通过!
参考http://blog.sina.com.cn/s/blog_533074eb01011wp0.html
***************************************************************************************************
系统第三次重装。冷静!
想想我所要的无非bluez-4.87。只是它在编译过程中需要不少其他软件包而已。
直接进入bluez-4.87,编译:
./configure
出现了问题1:configure: error: C compiler cannot create executables
解答:安装arm-linux-gcc-4.4.3-20100728.tar.gz即可。
问题2:configure: error: D-Bus library is required
解答: apt-get install libdbus-1-dev libdbus-glib-1-dev
make
问题3:/home/hxy/opt/FriendlyARM/toolschain/4.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.3/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lglib-2.0
collect2: ld returned 1 exit status
解答: sudo apt-get install gettext
安装glib-2.22.4:
./configure CC=arm-linux-gcc --host=arm-linux --cache-file=arm-linux.cache
make
make install
出现问题:/bin/bash: 行 2: /usr/local/bin/glib-genmarshal: 无法执行二进制文件
问题4:./ylwrap: 行 109: yacc: 未找到命令
解答:sudo apt-get install byacc
问题5:/home/hxy/FriendlyARM/bluetooth/bluez-4.87/missing: 行 52: flex: 未找到命令
解答:sudo apt-get install flex
用 ./configure
make
都能通过,但下载指定的文件到开发板,并不能有预期效果:
1)
#cp
#cp
#cp
#cp
2)
#cp
3)
#cp