2

I installed Bluez version 5.47 onto a Pi-3 running Raspbian version 9 (Stretch). files were copied into /home/pi/bluez-5.47 directory and successfully executed the dependencies, compile, make and install scripts. The "bluetoothctl" tool seems to work correctly, however I am having difficulties programming the interface in c. The include libraries were located and copied to eliminate the “bluetooth/bluetooth.h” not found error. I copied the bluetooth,h file from the bluez-5.47/android directory to the /usr/include/bluetooth directory.

Now when I compile with the following command

gcc simplescan.c -lbluetooth -o scan

I get the following error msg,

/usr/bin/ld: cannot find -lbluetooth

A search for the bluetooth.so file finds it at the following location

/usr/lib/arm-lunux-gnueabohf/lxpanel/plugins

I copied the bluetooth.so file to the /usr/bin directory and still get the same error.

3

I am answering my own question. As it turns out there are many tutorials on compiling and installing the bluez bluetooth package but they are out of date. By default the latest version of the bluez Makefile no longer installs the Bluetooth library. To install the library you must invoke the ./configure command with the --enable-library option as follows:

./configure –enable-library

This solved my problem.

  • Did the trick for me with bluez 5.50. For completeness, one should search when this option has become available or disabled by default and add that to your answer. I would recommend accepting your own answer too. – Loufylouf Nov 30 '18 at 3:51
2

Unless the Raspbian repositories aren't providing the features or a specific version you need, it's best to install via apt.

sudo apt install libbluetooth-dev

That bluetooth.so which you found is a plugin for LXPanel. It's not the same as libbluetooth.so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.