Compile BlueZ from source on Linux
As most of Linux users just use whatever comes installed on machine or if it is available from package managers and they are happy with that.
Here we will be doing something that most people would not do or would try but because of some errors, missing libraries or similar just quit.
BlueZ is the official Linux Bluetooth stack. It provides, in it's modular way, support for the core Bluetooth layers and protocols. Currently BlueZ consists of many separate modules: Bluetooth kernel subsystem core. ... RFCOMM, BNEP, CMTP and HIDP kernel implementations.
Latest version of BlueZ at time of writing this post is BlueZ 5.63
Whole procedure will be performed on Linux Mint[20.3] that comes with BlueZ 5.53
So lets get started and 1st thing we need to check what current version do you have installed on machine
machine@mint:~$ bluetoothctl --version
bluetoothctl: 5.53
Next is to update our package manager and download all dependencies we will need to compile BlueZ
sudo apt-get update
And after you have updated install dependencies
sudo apt-get install -y git bc libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev autoconf bison flex libssl-dev libncurses-dev glib2.0 libdbus-1-dev python-docutils cmake
Now we can compile dependency needed for BlueZ
cd ~
wget https://s3.amazonaws.com/json-c_releases/releases/json-c-0.15.tar.gz
tar xvf json-c-0.15.tar.gz
cd ~/json-c-0.15
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=OFF ..
make
sudo make install
Next is ELL(Embedded Linux Library)
cd ~
wget https://mirrors.edge.kernel.org/pub/linux/libs/ell/ell-0.9.tar.xz
tar -xvf ell-0.9.tar.xz
cd ell-0.9/
sudo ./configure --prefix=/usr
sudo make
sudo make install
Now we have all ready to compile BlueZ
cd ~
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.63.tar.xz
tar -xvf bluez-5.63.tar.xz
cd bluez-5.63/
./configure --enable-mesh --enable-testing --enable-tools --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var
sudo make
sudo make install
If you made to this step without errors you should be able to use newly compiled BlueZ.
Try to check version now in terminal
machine@mint:~$ bluetoothctl --version
bluetoothctl: 5.63
Next we need to add user to bluetooth group, check if you already have added user to the group
cat /etc/group|grep bluet
If you get something like this
machine@mint:~$ cat /etc/group|grep bluet
bluetooth:x:115:
That means that user is not added to the group, so let's add it
machine@mint:~$ sudo nano /etc/group
And add your user to the bluetooth group, after edit should look like this
machine@mint:~$ cat /etc/group|grep bluet
bluetooth:x:115:machine
I would suggest to reboot after this before start use it
After that you should be able to use bluetoothctl
machine@mint:~$ bluetoothctl
Agent registered
[CHG] Controller 00:19:86:00:3B:93 Pairable: yes
[bluetooth]#
[bluetooth]# version
Version 5.63
Hope you got working BlueZ and happy with new bugs free version with a lot of improvements. Anything that I could help more regarding this please write in comments.
Thanks a lot for reading...