BLE Examples build wilc stretch

From Technologic Systems Manuals

At the time of writing this, version 5.61 is the latest BlueZ release. The following examples will download, build, and install BlueZ directly on the target device. Compilation directly on the device will be far slower but does not have the prerequisite of a properly set up cross build system. Cross compilation of BlueZ is possible, but is beyond the scope of this document.

First, since most of our products ship with BlueZ pre-installed from the distribution package manager, this will need to be removed:

apt-get purge "bluez*"

Ensure all build requirements are met (note that some examples use Python 2 while others use Python 3):

apt-get update && apt-get install -y git libglib2.0-dev libglib2.0-0 libdbus-1-dev libdbus-1-3 libudev-dev libudev1 libical-dev libreadline-dev python3-dbus python3-pip python-dbus docutils-common

Next, download the sources for BlueZ 5.61:

tar xvf bluez-5.61.tar.xz

Configure, build, and install BlueZ:

cd bluez-5.61
./configure --enable-library --enable-test --enable-deprecated && make install
systemctl enable bluetooth
systemctl start bluetooth

From here, the example tools will be installed to /usr/local/lib/bluez/test/. We will be using this later.