Compile bluez-5.25 run through Linux environment

Source: Internet
Author: User
Tags xml parser

This compilation is BlueZ 5 version above, the previous version does not support Bluetooth 4.0, only 5 version and above support 4.0. My Linux host is the Ubuntu14.04 version

This compilation reference http://wiki.beyondlogic.org/index.php?title=Cross_Compiling_BlueZ_Bluetooth_tools_for_ARMhttp:// Wiki.beyondlogic.org/index.php?title=cross_compiling_bluez_bluetooth_tools_for_arm

On this basis also made a few minor changes, to avoid some errors. Good to start recording steps, more cumbersome, O (∩_∩) O. Here are some explanations of the original text.

zlib-1.2.8

Zlib compilation does not need to specify--host, but after the configuration is complete, the makefile file needs to be modified for cross-compilation.

Source: wget http://zlib.net/zlib-1.2.8.tar.gz

Configuration:./configure--prefix=/wsh_space/my_install/bluez5

Modify Makefile:

cc=arm-cortex_a9-linux-gnueabi-gcc
Ldshared=arm-cortex_a9-linux-gnueabi-gcc-shared-wl,-soname,libz.so.1,--Version-script,zlib.map
Cpp=arm-cortex_a9-linux-gnueabi-gcc-e
Ar=arm-cortex_a9-linux-gnueabi-ar
Ranlib=arm-cortex_a9-linux-gnueabi-ranlib

Compile:

Make

Make install


libffi-3.0.13

Source: wget ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz

Configuration:./configure--host=arm-cortex_a9-linux-gnueabi--prefix=/wsh_space/my_install/bluez5

Compile:

Make

Make install


glib-2.40.0

Compile glib dependent zlib, Libffi and glibc >= 2.18, host if UBUNTU14.04,GLIBC version is 2.19, here is satisfied. Also very likely to be missing Glib-genmarshal, I compile when is missing, this good solution, execute command

sudo apt-get install Libglib2.0-dev
Installation can be done. Here are the specific steps:

Source: wget Http://ftp.gnome.org/pub/gnome/sources/glib/2.40/glib-2.40.0.tar.xz

Configuration:./configure--host=arm-cortex_a9-linux-gnueabi--prefix=/wsh_space/my_install/bluez5 PKG_CONFIG_PATH=/wsh_ Space/my_install/bluez5/lib/pkgconfig glib_cv_stack_grows=no glib_cv_uscore=yes Ac_cv_func_posix_getpwuid_r=yes AC _cv_func_posix_getgrgid_r=yes

Compile:

Make

Make install


D-bus

D-bus Daemon will need to expat the XML Parser Library, so we need to compile the expat library first. If you do not install, you receive the following error:

Checking for xml_parsercreate_mm In-lexpat ... noconfigure:error:Explicitly requested expat but expat not found

Steps are as follows

expat-2.1.0

Source: wget http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz

Configuration:./configure--host=arm-cortex_a9-linux-gnueabi--prefix=/wsh_space/my_install/bluez5

Compile:

Make

Make install


d-bus1.9.4

When using the configuration in the original, the compilation will error, as follows:

Corrupt.c:29:18:fatal error:glib.h: No file or directory
/wsh_space/my_install/bluez5/include/glib-2.0/glib.h:30:26:fatal error:glib/galloca.h: No file or directory
Fatal error:glibconfig.h: No file or directory

After viewing, the file referenced by the. h file in the test directory is incorrect and can be modified in one way, but rather cumbersome.

My approach is to block test and increase the--disable-tests option.

Source: wget http://dbus.freedesktop.org/releases/dbus/dbus-1.9.4.tar.gz

Configuration:./configure--host=arm-cortex_a9-linux-gnueabi--prefix=/wsh_space/my_install/bluez5--disable-tests

Compile:

Make

Make install


libical-1.0

BlueZ compilation needs libical support, compile libical need cmake and g++, so the system needs these two tools, you can run the following two commands to install, need to keep the network unblocked.

sudo apt-get install CMake
sudo apt-get install G++-arm-linux-gnueabi

Then it can be compiled and installed.

Source: wget http://downloads.sourceforge.net/freeassociation/libical-1.0.tar.gz

Configuration: export CC=ARM-CORTEX_A9-LINUX-GNUEABI-GCC
Export cxx=arm-linux-gnueabi-g++
Cmake-dcmake_install_prefix=/wsh_space/my_install/bluez5

Note that the command here is executed directly at the command line.

Compile:

Make

Make install


Readline

Compile ReadLine is required ncurses support, if there is no ncurses, compile will report the following error.

/usr/arm-linux-gnueabi/lib/libreadline.so:undefined reference to ' PC '/usr/arm-linux-gnueabi/lib/libreadline.so: Undefined reference to ' Tgetflag '/usr/arm-linux-gnueabi/lib/libreadline.so:undefined reference to ' tgetent '/usr/ arm-linux-gnueabi/lib/libreadline.so:undefined reference to ' up '/usr/arm-linux-gnueabi/lib/libreadline.so: Undefined reference to ' tputs '/usr/arm-linux-gnueabi/lib/libreadline.so:undefined reference to ' Tgoto '/usr/ arm-linux-gnueabi/lib/libreadline.so:undefined reference to ' Tgetnum '/usr/arm-linux-gnueabi/lib/libreadline.so: Undefined reference to ' BC '/usr/arm-linux-gnueabi/lib/libreadline.so:undefined reference to ' Tgetstr '
The way to reference ncurses is to add the shlib_libs=-lncurses option when make


ncurses-5.9

Source: wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz

Configuration:./configure--host=arm-cortex_a9-linux-gnueabi--prefix=/wsh_space/my_install/bluez5 CXX= "arm-linux-gnueabi-g+ +"

Compile:

Make

Make install


Readline6.3

You need to add the Bash_cv_wcwidth_broken=yes option when configuring to avoid the following error:

Checking for wcwidth broken with Unicode combining characters ... configure:error:in '/.../readline-6.3 ': configure:error : Cannot run test program while cross compiling

Source: wget ftp://ftp.cwru.edu/pub/bash/readline-6.3.tar.gz

Configuration:./configure--host=arm-cortex_a9-linux-gnueabi--prefix=/wsh_space/my_install/bluez5 bash_cv_wcwidth_broken= Yes

Compile:

Make Shlib_libs=-lncurses

Make install


Building BlueZ

BlueZ contains the basic tools needed for Bluetooth, such as Hciattach, Hciconfig, Hcitool and Rfcomm.

BlueZ 5.25 need at least GLib >= 2.28, D-bus >= 1.6 and Libudev >= 143, because Linudev is a rather troublesome thing, for this in compiling BlueZ, it is to be shielded.

Source: wget Http://www.kernel.org/pub/linux/bluetooth/bluez-5.25.tar.xz

Configuration:./configure--host=arm-cortex_a9-linux-gnueabi--prefix=/wsh_space/my_install/bluez5 PKG_CONFIG_PATH=/wsh_ Space/my_install/bluez5/lib/pkgconfig cc= "arm-cortex_a9-linux-gnueabi-gcc-l/wsh_space/my_install/bluez5/lib-i/ Wsh_space/my_install/bluez5/include "--disable-systemd--disable-udev--disable-cups--disable-obex-- Enable-library

Compile:

Make

Make install DESTDIR=/WSH_SPACE/MY_INSTALL/BLUEZ5

Note that the installation here will generate a special file as shown in:


When using Dbus-daemon, this file is required and the structure of this file is as follows:


You also need to copy the Var folder under the installation directory to the WSH_SPACE/MY_INSTALL/BLUEZ5 directory, such as:


When using the development Board, you need to copy the Wsh_space folder to the root of the system.

Some library files are also required, and I copy the entire installation directory directly to the/usr/local/bluetooth of the Development Board.

To this, complete, other tests can refer to the original text.



Compile bluez-5.25 run through Linux environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.