Setting up an iBeacon scanner using the GATT Protocol for Bluetooth LE

This guide should help you to setup an iBeacon scanner using a Python script as external service. I have used the following "stuff":

  • A RPi3B+
  • SD-card, complete fresh Raspbian Buster with desktop and recommended software
  • a Python script written to handle the actual scanning
  • latest Node-RED
  • the RPi3B+ built-in BLE device

First of all, see to that you start with a fresh Buster setup as above. Other combinations including older versions of raspbian, other rpi models is possible to use but you might run into a situation where more dependencies needs to be resolved. Nothing impossible but,,,more time consuming

Check also that Bluetooth is turned on !!!

Assuming you have reached the state that the newly installed Buster image is properly updated and configured according to the initial startup, we can go ahead right away (I simply named my host "gattscanner"). Open up a cmd prompt, LXTerminal, and assuming we are now in /home/pi:

Check the installed version of Python3 (I have 3.7.3, thats fine)

pi@gattscanner:~ $ python3 --version
Python 3.7.3

Check the installed version of Bluez:

pi@gattscanner:~ $ bluetoothctl -v
bluetoothctl: 5.50

Check the installed version of PIP3:

pi@gattscanner:~ $ pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

So far it looks good and we are ready to install a number of needed libraries

sudo apt-get install libbluetooth-dev bluez bluez-hcidump libboost-python-dev libboost-thread-dev libglib2.0-dev libboost-all-dev

Now is time to download and install gattlib

pip3 download gattlib
tar xvzf ./gattlib-0.20150805.tar.gz
cd gattlib-0.20150805/

Since the gattlib setup is prepared to be installed under Python 3.4, we need to correct this to the version we are using
sed -ie 's/boost_python-py34/boost_python-py37/' setup.py

We can finally install gattlib (don't forget the dot at the end of the command):
pi@gattscanner:~/gattlib-0.20150805 $ sudo pip3 install .

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/pi/gattlib-0.20150805
Building wheels for collected packages: gattlib
Running setup.py bdist_wheel for gattlib ... done
Stored in directory: /root/.cache/pip/wheels/2b/2d/d2/d62bdc868bb470d7b7e2fa672805652c9e57ff271d2ba6a8ea
Successfully built gattlib
Installing collected packages: gattlib
Successfully installed gattlib-0.20150805

Next we change back to /home/pi
cd ..

Install the following Python modules:

sudo pip3 install setproctitle
sudo pip3 install paho-mqtt
sudo apt install -y mosquitto

Copy this Python script to /home/pi (rename/change extension from .txt to .py)
gatt_ibeacon_scan.txt (2.1 KB)

Install/Update Node-RED
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

Configure Node-RED service to start automatically at boot

sudo systemctl enable nodered.service
sudo systemctl start nodered.service

Import this flow and deploy
image

[{"id":"f1e1879c.db20c8","type":"tab","label":"BLE Gatt Scanner","disabled":false,"info":""},{"id":"15ee910e.06391f","type":"mqtt in","z":"f1e1879c.db20c8","name":"","topic":"found","qos":"0","datatype":"auto","broker":"18e7c688.018489","x":150,"y":360,"wires":[["de6816a8.875538","f0f36562.6daab8","b83fe5a5.6c36b8"]]},{"id":"9fb41c04.1bebd","type":"debug","z":"f1e1879c.db20c8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":420,"wires":[]},{"id":"de6816a8.875538","type":"switch","z":"f1e1879c.db20c8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"name: MiniBeacon_10754, address: D9:77:B9:4C:B8:5B","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":360,"wires":[["3c60c68c.05deba","9fb41c04.1bebd"]]},{"id":"f0f36562.6daab8","type":"debug","z":"f1e1879c.db20c8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":350,"y":420,"wires":[]},{"id":"8df2f747.4534f8","type":"exec","z":"f1e1879c.db20c8","command":"export DISPLAY=:0 && lxterminal -e sudo python3 /home/pi/gatt_ibeacon_scan.py","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":1020,"y":100,"wires":[[],[],[]]},{"id":"d8a34f4b.6d244","type":"trigger","z":"f1e1879c.db20c8","op1":"","op2":"1","op1type":"nul","op2type":"str","duration":"10","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":570,"y":100,"wires":[["8df2f747.4534f8"]]},{"id":"9e332f97.2746d","type":"inject","z":"f1e1879c.db20c8","name":"Init","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":"","x":330,"y":100,"wires":[["d8a34f4b.6d244","bbd896e2.aee998","dce570b.a37ce9"]]},{"id":"47b75403.06780c","type":"comment","z":"f1e1879c.db20c8","name":"Starting BLE scanning service","info":"","x":220,"y":60,"wires":[]},{"id":"8d5ac6aa.304908","type":"mqtt out","z":"f1e1879c.db20c8","name":"","topic":"commands","qos":"0","retain":"","broker":"18e7c688.018489","x":800,"y":160,"wires":[]},{"id":"bbd896e2.aee998","type":"change","z":"f1e1879c.db20c8","name":"abort","rules":[{"t":"set","p":"payload","pt":"msg","to":"abort","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":160,"wires":[["8d5ac6aa.304908"]]},{"id":"334e200c.65883","type":"inject","z":"f1e1879c.db20c8","name":"abort","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":330,"y":220,"wires":[["bbd896e2.aee998","dce570b.a37ce9"]]},{"id":"dce570b.a37ce9","type":"delay","z":"f1e1879c.db20c8","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":560,"y":220,"wires":[["6763bcb4.604624"]]},{"id":"6763bcb4.604624","type":"exec","z":"f1e1879c.db20c8","command":"sudo pkill -f gatt_ble_scanner","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":860,"y":220,"wires":[[],[],[]]},{"id":"b83fe5a5.6c36b8","type":"trigger","z":"f1e1879c.db20c8","op1":"","op2":"true","op1type":"nul","op2type":"bool","duration":"30","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":350,"y":300,"wires":[["dce570b.a37ce9","bbd896e2.aee998","d8a34f4b.6d244"]]},{"id":"3c60c68c.05deba","type":"trigger","z":"f1e1879c.db20c8","op1":"MiniBeacon_10754 enter GATT 239","op2":"MiniBeacon_10754 leave GATT 239","op1type":"str","op2type":"str","duration":"90","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":570,"y":360,"wires":[["2547b4a5.f9292c"]]},{"id":"2547b4a5.f9292c","type":"debug","z":"f1e1879c.db20c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":800,"y":360,"wires":[]},{"id":"18e7c688.018489","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

In a few seconds you should see the scanner running in a window on the desktop. Use the debug nodes to view incoming scan results
image
The script will scan your environment looking for iBeacons. The result is published to the MQTT broker. If you want to terminate the script, use the "abort" button in Node-RED.
Setup filtering, watching the iBeacons you are interested in. The events are there, use them for any cool purposes

image

4 Likes

What is supposed to happen after you run sed -ie 's/boost_python-py34/boost_python-py37/’ setup.py
My Pi just displays a > and then does nothing. Is there something I should do before i can run pi@raspberrypi:~/gattlib-0.20150805 $ pip3 download gattlib .

Thanks

Peter

I have actually seen this once myself when I installed it in one of my Pi's, I then just pressed ctrl-c and issued the command again, then it worked, I don't know why it behaved like that

Gattlib seems to be developed already 2015 and then targeting Python3 version 3.4. The only thing that command is supposed to do is to update the setup.py file, part of the downloaded gattlib source, to be updated to reflect the version of Python3 that you have installed. With Buster, it is version 3.7.3

Without modifying the setup.py file to reflect your python version, it will not build & install correctly. You can see where it should be modified if you open the /home/pi/gattlib-0.20150805/setup.py in an editor, line 22

Here it is better described as example, when other users had problems installing the same

Nice that you are installing this, in my tests it is still running fine without a glitch since the first day

Ooops, I see now the problem

There is a wrong char at the end of that line...

The char ’ should be '

Not a big but important difference

The line should be

sed -ie 's/boost_python-py34/boost_python-py37/' setup.py

Thank you, this fixed that problem now I get;

pi@raspberrypi:~/gattlib-0.20150805 $ sudo pip3 install .
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/pi/gattlib-0.20150805
Building wheels for collected packages: gattlib
Running setup.py bdist_wheel for gattlib ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-req-build-c0fhqv8f/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/pip-wheel-txrynh5u --python-tag cp37:
running bdist_wheel
running build
running build_ext
building 'gattlib' extension
creating build
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/src
creating build/temp.linux-armv7l-3.7/src/bluez
creating build/temp.linux-armv7l-3.7/src/bluez/lib
creating build/temp.linux-armv7l-3.7/src/bluez/attrib
creating build/temp.linux-armv7l-3.7/src/bluez/src
creating build/temp.linux-armv7l-3.7/src/bluez/src/shared
creating build/temp.linux-armv7l-3.7/src/bluez/btio
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/gattservices.cpp -o build/temp.linux-armv7l-3.7/src/gattservices.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/beacon.cpp -o build/temp.linux-armv7l-3.7/src/beacon.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bindings.cpp -o build/temp.linux-armv7l-3.7/src/bindings.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/gattlib.cpp -o build/temp.linux-armv7l-3.7/src/gattlib.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/lib/uuid.c -o build/temp.linux-armv7l-3.7/src/bluez/lib/uuid.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/attrib/gatt.c -o build/temp.linux-armv7l-3.7/src/bluez/attrib/gatt.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/attrib/gattrib.c -o build/temp.linux-armv7l-3.7/src/bluez/attrib/gattrib.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/attrib/utils.c -o build/temp.linux-armv7l-3.7/src/bluez/attrib/utils.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/attrib/att.c -o build/temp.linux-armv7l-3.7/src/bluez/attrib/att.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/src/shared/crypto.c -o build/temp.linux-armv7l-3.7/src/bluez/src/shared/crypto.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/src/log.c -o build/temp.linux-armv7l-3.7/src/bluez/src/log.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/btio/btio.c -o build/temp.linux-armv7l-3.7/src/bluez/btio/btio.o
creating build/lib.linux-armv7l-3.7
arm-linux-gnueabihf-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.7/src/gattservices.o build/temp.linux-armv7l-3.7/src/beacon.o build/temp.linux-armv7l-3.7/src/bindings.o build/temp.linux-armv7l-3.7/src/gattlib.o build/temp.linux-armv7l-3.7/src/bluez/lib/uuid.o build/temp.linux-armv7l-3.7/src/bluez/attrib/gatt.o build/temp.linux-armv7l-3.7/src/bluez/attrib/gattrib.o build/temp.linux-armv7l-3.7/src/bluez/attrib/utils.o build/temp.linux-armv7l-3.7/src/bluez/attrib/att.o build/temp.linux-armv7l-3.7/src/bluez/src/shared/crypto.o build/temp.linux-armv7l-3.7/src/bluez/src/log.o build/temp.linux-armv7l-3.7/src/bluez/btio/btio.o -lglib-2.0 -lboost_python-py37 -lboost_thread -lbluetooth -o build/lib.linux-armv7l-3.7/gattlib.cpython-37m-arm-linux-gnueabihf.so
/usr/bin/ld: cannot find -lboost_python-py37
collect2: error: ld returned 1 exit status
error: command 'arm-linux-gnueabihf-g++' failed with exit status 1


Failed building wheel for gattlib
Running setup.py clean for gattlib
Failed to build gattlib
Installing collected packages: gattlib
Running setup.py install for gattlib ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-req-build-c0fhqv8f/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-7k00br_b/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'gattlib' extension
creating build
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/src
creating build/temp.linux-armv7l-3.7/src/bluez
creating build/temp.linux-armv7l-3.7/src/bluez/lib
creating build/temp.linux-armv7l-3.7/src/bluez/attrib
creating build/temp.linux-armv7l-3.7/src/bluez/src
creating build/temp.linux-armv7l-3.7/src/bluez/src/shared
creating build/temp.linux-armv7l-3.7/src/bluez/btio
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/gattservices.cpp -o build/temp.linux-armv7l-3.7/src/gattservices.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/beacon.cpp -o build/temp.linux-armv7l-3.7/src/beacon.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bindings.cpp -o build/temp.linux-armv7l-3.7/src/bindings.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/gattlib.cpp -o build/temp.linux-armv7l-3.7/src/gattlib.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/lib/uuid.c -o build/temp.linux-armv7l-3.7/src/bluez/lib/uuid.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/attrib/gatt.c -o build/temp.linux-armv7l-3.7/src/bluez/attrib/gatt.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/attrib/gattrib.c -o build/temp.linux-armv7l-3.7/src/bluez/attrib/gattrib.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/attrib/utils.c -o build/temp.linux-armv7l-3.7/src/bluez/attrib/utils.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/attrib/att.c -o build/temp.linux-armv7l-3.7/src/bluez/attrib/att.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/src/shared/crypto.c -o build/temp.linux-armv7l-3.7/src/bluez/src/shared/crypto.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/src/log.c -o build/temp.linux-armv7l-3.7/src/bluez/src/log.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Isrc/bluez -I/usr/include/python3.7m -c src/bluez/btio/btio.c -o build/temp.linux-armv7l-3.7/src/bluez/btio/btio.o
creating build/lib.linux-armv7l-3.7
arm-linux-gnueabihf-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.7/src/gattservices.o build/temp.linux-armv7l-3.7/src/beacon.o build/temp.linux-armv7l-3.7/src/bindings.o build/temp.linux-armv7l-3.7/src/gattlib.o build/temp.linux-armv7l-3.7/src/bluez/lib/uuid.o build/temp.linux-armv7l-3.7/src/bluez/attrib/gatt.o build/temp.linux-armv7l-3.7/src/bluez/attrib/gattrib.o build/temp.linux-armv7l-3.7/src/bluez/attrib/utils.o build/temp.linux-armv7l-3.7/src/bluez/attrib/att.o build/temp.linux-armv7l-3.7/src/bluez/src/shared/crypto.o build/temp.linux-armv7l-3.7/src/bluez/src/log.o build/temp.linux-armv7l-3.7/src/bluez/btio/btio.o -lglib-2.0 -lboost_python-py37 -lboost_thread -lbluetooth -o build/lib.linux-armv7l-3.7/gattlib.cpython-37m-arm-linux-gnueabihf.so
/usr/bin/ld: cannot find -lboost_python-py37
collect2: error: ld returned 1 exit status
error: command 'arm-linux-gnueabihf-g++' failed with exit status 1

----------------------------------------

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-req-build-c0fhqv8f/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-7k00br_b/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-req-build-c0fhqv8f/

Any ideas :frowning:

/usr/bin/ld: cannot find -lboost_python-py37

This is the problem

Did you install everything accordingly before running the gattlib setup? The long line of required libraries?
What did the version checks report for python3, bluetoothctl?
Do you have Buster?

Yes I loaded Buster with desktop and recommended software, I have Python 3.7.3 and bluetoothctl 5.50 and yes I loaded sudo apt-get install libbluetooth-dev bluez bluez-hcidump libboost-python-dev libboost-thread-dev libglib2.0-dev libboost-all-dev

Thanks

Peter

Strange,,,

Could you try to install this again from your home directory (/home/pi)? Just to be sure it was installed
sudo apt-get --reinstall install libboost-all-dev

There was another person having problems installing gattlib and this was the missing part


Hi I ran pi@raspberrypi:~ $ sudo apt-get --reinstall install libboost-all-dev

  • but unfortunately I still have the same problem.

Peter

Some dependency is missing, we have to find it

Can you, just to verify, run each, one by one of this and check the result?
They should be installed but, well

sudo apt-get install libbluetooth-dev
sudo apt-get install bluez bluez-hcidump
sudo apt-get install libboost-python-dev 
sudo apt-get install libboost-thread-dev
sudo apt-get install libglib2.0-dev
sudo apt-get install libboost-all-dev

Also, check that you have this:
/usr/lib/arm-linux-gnueabihf/libboost_python37.so

Hi, I have run the commands you have suggested - thanks and checked that libboost_python37.so is in the correct folder and it is. I have completed a fresh load (format SD card etc.run apt-get update & upgrade) and still I get the same problem.......this is driving me crazy.

I have also checked that the hardware is a 3B+ the only difference is I am running a POE HAT in the pi.

Peter

I fully understand, I installed in the same as you in 2 RPi3B+ and it works so good for me here,
The key thing is that gattlib refuses to install

What is the result if you run the following command (there should be a pretty long response)
ld -lboost_python37 --verbose

If it is found, you should see lines like below (and a lot of others with "failed")

I'm in Sweden so "lyckades" means success

attempt to open //usr/lib/arm-linux-gnueabihf/libboost_python37.so lyckades
-lboost_python37 (//usr/lib/arm-linux-gnueabihf/libboost_python37.so)

This is just a wild attempt, similar problems for this user

I never run the sudo apt install pkg-config

It doesn't hurt to try if this helps because I suspect there is a problem with the compiler options

Maybe try:

sudo apt install pkg-config libboost-python-dev libboost-thread-dev libbluetooth-dev libglib2.0-dev python-dev

This is what I get when I run the verbose command;

pi@raspberrypi:~ $ ld -lboost_python37 --verbose
GNU ld (GNU Binutils for Raspbian) 2.31.1
Supported emulations:
armelf_linux_eabi
armelfb_linux_eabi
using internal linker script:

/* Script for -z combreloc: combine and sort reloc sections /
/
Copyright (C) 2014-2018 Free Software Foundation, Inc.
Copying and distribution of this script, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. /
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
"elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SEARCH_DIR("=/usr/local/lib/arm-linux-gnueabihf"); SEARCH_DIR("=/lib/arm-linux-gnueabihf"); SEARCH_DIR("=/usr/lib/arm-linux-gnueabihf"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); SEARCH_DIR("=/usr/arm-linux-gnueabihf/lib");
SECTIONS
{
/
Read-only sections, merged into text segment: /
PROVIDE (_executable_start = SEGMENT_START("text-segment", 0x00010000)); . = SEGMENT_START("text-segment", 0x00010000) + SIZEOF_HEADERS;
.interp : { *(.interp) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { (.dynstr) }
.gnu.version : { (.gnu.version) }
.gnu.version_d : { (.gnu.version_d) }
.gnu.version_r : { (.gnu.version_r) }
.rel.dyn :
{
(.rel.init)
(.rel.text .rel.text. .rel.gnu.linkonce.t.
)
(.rel.fini)
(.rel.rodata .rel.rodata. .rel.gnu.linkonce.r.
)
(.rel.data.rel.ro .rel.data.rel.ro. .rel.gnu.linkonce.d.rel.ro.
)
(.rel.data .rel.data. .rel.gnu.linkonce.d.
)
(.rel.tdata .rel.tdata. .rel.gnu.linkonce.td.
)
(.rel.tbss .rel.tbss. .rel.gnu.linkonce.tb.
)
(.rel.ctors)
(.rel.dtors)
(.rel.got)
(.rel.bss .rel.bss. .rel.gnu.linkonce.b.
)
PROVIDE_HIDDEN (__rel_iplt_start = .);
(.rel.iplt)
PROVIDE_HIDDEN (__rel_iplt_end = .);
}
.rela.dyn :
{
(.rela.init)
(.rela.text .rela.text. .rela.gnu.linkonce.t.
)
(.rela.fini)
(.rela.rodata .rela.rodata. .rela.gnu.linkonce.r.
)
(.rela.data .rela.data. .rela.gnu.linkonce.d.
)
(.rela.tdata .rela.tdata. .rela.gnu.linkonce.td.
)
(.rela.tbss .rela.tbss. .rela.gnu.linkonce.tb.
)
(.rela.ctors)
(.rela.dtors)
(.rela.got)
(.rela.bss .rela.bss. .rela.gnu.linkonce.b.
)
PROVIDE_HIDDEN (__rela_iplt_start = .);
(.rela.iplt)
PROVIDE_HIDDEN (__rela_iplt_end = .);
}
.rel.plt :
{
(.rel.plt)
}
.rela.plt :
{
(.rela.plt)
}
.init :
{
KEEP (
(SORT_NONE(.init)))
}
.plt : { (.plt) }
.iplt : { (.iplt) }
.text :
{
(.text.unlikely .text._unlikely .text.unlikely.
)
(.text.exit .text.exit.)
(.text.startup .text.startup.)
(.text.hot .text.hot.)
(.text .stub .text. .gnu.linkonce.t.
)
/
.gnu.warning sections are handled specially by elf32.em. /
(.gnu.warning)
(.glue_7t) (.glue_7) (.vfp11_veneer) (.v4_bx)
}
.fini :
{
KEEP (
(SORT_NONE(.fini)))
}
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { (.rodata .rodata. .gnu.linkonce.r.
) }
.rodata1 : { (.rodata1) }
.ARM.extab : { (.ARM.extab .gnu.linkonce.armextab.
) }
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx : { (.ARM.exidx .gnu.linkonce.armexidx.
) }
PROVIDE_HIDDEN (__exidx_end = .);
.eh_frame_hdr : { (.eh_frame_hdr) (.eh_frame_entry .eh_frame_entry.) }
.eh_frame : ONLY_IF_RO { KEEP (
(.eh_frame)) (.eh_frame.) }
.gcc_except_table : ONLY_IF_RO { (.gcc_except_table
.gcc_except_table.
) }
.gnu_extab : ONLY_IF_RO { (.gnu_extab) }
/
These sections are generated by the Sun/Oracle C++ compiler. /
.exception_ranges : ONLY_IF_RO { (.exception_ranges
.exception_ranges
) }
/
Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. /
. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
/
Exception handling /
.eh_frame : ONLY_IF_RW { KEEP (
(.eh_frame)) (.eh_frame.) }
.gnu_extab : ONLY_IF_RW { (.gnu_extab) }
.gcc_except_table : ONLY_IF_RW { (.gcc_except_table .gcc_except_table.) }
.exception_ranges : ONLY_IF_RW { (.exception_ranges .exception_ranges) }
/
Thread Local Storage sections /
.tdata :
{
PROVIDE_HIDDEN (__tdata_start = .);
(.tdata .tdata. .gnu.linkonce.td.
)
}
.tbss : { (.tbss .tbss. .gnu.linkonce.tb.
) (.tcommon) }
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (
(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
}
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (
(SORT_BY_INIT_PRIORITY(.init_array.
) SORT_BY_INIT_PRIORITY(.ctors.
)))
KEEP (
(.init_array EXCLUDE_FILE (crtbegin.o crtbegin?.o crtend.o crtend?.o ) .ctors))
PROVIDE_HIDDEN (__init_array_end = .);
}
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (
(SORT_BY_INIT_PRIORITY(.fini_array.
) SORT_BY_INIT_PRIORITY(.dtors.
)))
KEEP (
(.fini_array EXCLUDE_FILE (*crtbegin.o crtbegin?.o crtend.o crtend?.o ) .dtors))
PROVIDE_HIDDEN (__fini_array_end = .);
}
.ctors :
{
/
gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. /
KEEP (crtbegin.o(.ctors))
KEEP (crtbegin?.o(.ctors))
/
We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last /
KEEP (
(EXCLUDE_FILE (crtend.o crtend?.o ) .ctors))
KEEP (
(SORT(.ctors.
)))
KEEP (
(.ctors))
}
.dtors :
{
KEEP (crtbegin.o(.dtors))
KEEP (crtbegin?.o(.dtors))
KEEP (
(EXCLUDE_FILE (crtend.o crtend?.o ) .dtors))
KEEP (
(SORT(.dtors.
)))
KEEP (
(.dtors))
}
.jcr : { KEEP (
(.jcr)) }
.data.rel.ro : { (.data.rel.ro.local .gnu.linkonce.d.rel.ro.local.
) (.data.rel.ro .data.rel.ro. .gnu.linkonce.d.rel.ro.
) }
.dynamic : { *(.dynamic) }
. = DATA_SEGMENT_RELRO_END (0, .);
.got : { *(.got.plt) *(.igot.plt) *(.got) (.igot) }
.data :
{
PROVIDE (__data_start = .);
(.data .data. .gnu.linkonce.d.
)
SORT(CONSTRUCTORS)
}
.data1 : { (.data1) }
_edata = .; PROVIDE (edata = .);
. = .;
__bss_start = .;
bss_start = .;
.bss :
{
(.dynbss)
(.bss .bss. .gnu.linkonce.b.
)
(COMMON)
/
Align here to ensure that the .bss section occupies space up to
end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
FIXME: Why do we need it? When there is no .bss section, we don't
pad the .data section. */
. = ALIGN(. != 0 ? 32 / 8 : 1);
}
bss_end
= .; bss_end = .;
. = ALIGN(32 / 8);
. = SEGMENT_START("ldata-segment", .);
. = ALIGN(32 / 8);
end = .;
_end = .; PROVIDE (end = .);
. = DATA_SEGMENT_END (.);
/
Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { (.comment) }
/
DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. /
/
DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { (.line) }
/
GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { (.debug_sfnames) }
/
DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { (.debug_pubnames) }
/
DWARF 2 */
.debug_info 0 : { (.debug_info .gnu.linkonce.wi.) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { (.debug_line .debug_line. .debug_line_end ) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { (.debug_macinfo) }
/
SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { (.debug_varnames) }
/
DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { (.debug_ranges) }
/
DWARF Extension. */
.debug_macro 0 : { (.debug_macro) }
.debug_addr 0 : { (.debug_addr) }
.gnu.attributes 0 : { KEEP (
(.gnu.attributes)) }
.note.gnu.arm.ident 0 : { KEEP (
(.note.gnu.arm.ident)) }
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto
) }
}

==================================================
attempt to open //usr/local/lib/arm-linux-gnueabihf/libboost_python37.so failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libboost_python37.a failed
attempt to open //lib/arm-linux-gnueabihf/libboost_python37.so failed
attempt to open //lib/arm-linux-gnueabihf/libboost_python37.a failed
attempt to open //usr/lib/arm-linux-gnueabihf/libboost_python37.so succeeded
-lboost_python37 (//usr/lib/arm-linux-gnueabihf/libboost_python37.so)
librt.so.1 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/librt.so.1 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/librt.so.1 failed
found librt.so.1 at //lib/arm-linux-gnueabihf/librt.so.1
libdl.so.2 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/libdl.so.2 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libdl.so.2 failed
found libdl.so.2 at //lib/arm-linux-gnueabihf/libdl.so.2
libpthread.so.0 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/libpthread.so.0 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libpthread.so.0 failed
found libpthread.so.0 at //lib/arm-linux-gnueabihf/libpthread.so.0
libutil.so.1 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/libutil.so.1 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libutil.so.1 failed
found libutil.so.1 at //lib/arm-linux-gnueabihf/libutil.so.1
libstdc++.so.6 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/libstdc++.so.6 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libstdc++.so.6 failed
attempt to open //lib/arm-linux-gnueabihf/libstdc++.so.6 failed
found libstdc++.so.6 at //usr/lib/arm-linux-gnueabihf/libstdc++.so.6
libm.so.6 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/libm.so.6 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libm.so.6 failed
found libm.so.6 at //lib/arm-linux-gnueabihf/libm.so.6
libgcc_s.so.1 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/libgcc_s.so.1 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libgcc_s.so.1 failed
found libgcc_s.so.1 at //lib/arm-linux-gnueabihf/libgcc_s.so.1
libc.so.6 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/libc.so.6 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libc.so.6 failed
attempt to open //usr/lib/arm-linux-gnueabihf/libc.so.6 failed
attempt to open //usr/lib/arm-linux-gnueabihf/libfakeroot/libc.so.6 failed
attempt to open //usr/local/lib/libc.so.6 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libc.so.6 failed
attempt to open //usr/lib/arm-linux-gnueabihf/libc.so.6 failed
attempt to open //usr/local/lib/libc.so.6 failed
attempt to open //lib/libc.so.6 failed
attempt to open //usr/lib/libc.so.6 failed
attempt to open //usr/arm-linux-gnueabihf/lib/libc.so.6 failed
attempt to open //opt/vc/lib/libc.so.6 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/libc.so.6 failed
found libc.so.6 at //lib/arm-linux-gnueabihf/libc.so.6
ld-linux-armhf.so.3 needed by //usr/lib/arm-linux-gnueabihf/libboost_python37.so
attempt to open //opt/vc/lib/ld-linux-armhf.so.3 failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 failed
found ld-linux-armhf.so.3 at //lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
ld: warning: cannot find entry symbol _start; defaulting to 00010160
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyExc_ValueError' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyLong_AsLong'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_InPlaceFloorDivide' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyBool_Type'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_GetAttr' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_GetItemString'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_Call' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyNumber_And'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyExc_IndexError' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyEval_GetGlobals'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyTuple_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyNumber_InPlaceSubtract'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyList_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyObject_GetAttrString'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyModule_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyMem_Free'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyType_IsSubtype' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyStaticMethod_Type'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyErr_WarnEx' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyUnicode_InternFromString'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyTuple_New' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyObject_SetAttr'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_IsInstance' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyErr_NoMemory'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to _Py_NoneStruct' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyExc_AttributeError'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_Add' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyUnicode_FromFormat'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyList_Append' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyType_Type'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyExc_ReferenceError' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyArg_ParseTupleAndKeywords'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyStaticMethod_New' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyNumber_InPlaceMultiply'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyTuple_Size' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyErr_SetObject'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to _PyObject_New' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_Keys'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyType_GenericAlloc' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyErr_Format'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_CallFunction' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyList_Reverse'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyCFunction_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyExc_OverflowError'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyMem_Malloc' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyErr_ExceptionMatches'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyComplex_ImagAsDouble' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyCFunction_NewEx'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyList_New' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyImport_ImportModule'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyProperty_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyUnicode_FromString'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_InPlaceOr' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyBytes_Size'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyUnicode_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyObject_DelItem'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_FloorDivide' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyErr_Clear'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyRun_StringFlags' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_GetItem'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyWeakref_NewRef' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyNumber_Multiply'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_Lshift' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_New'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyErr_SetString' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_Update'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PySlice_New' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyRun_FileExFlags'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_SetItem' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyUnicode_AsUTF8'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_SetAttrString' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyUnicode_FromEncodedObject'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyLong_AsUnsignedLongLong' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyExc_RuntimeError'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_Xor' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyBytes_AsString'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to _Py_NotImplementedStruct' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyNumber_Rshift'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyBaseObject_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyExc_StopIteration'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_GetItem' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyExc_TypeError'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyDict_Values' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to_Py_fopen'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyType_Ready' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyObject_Size'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyMethod_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyMethod_New'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_ClearWeakRefs' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyLong_AsSsize_t'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyLong_AsLongLong' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyEval_CallFunction'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_Remainder' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyLong_FromLong'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyErr_NewException' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyObject_CallMethod'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_Or' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyObject_IsTrue'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyList_Sort' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyModule_Create2'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyUnicode_AsWideChar' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyLong_AsUnsignedLong'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_InPlaceRemainder' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_Type'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyErr_Occurred' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_Copy'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyLong_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyNumber_InPlaceAnd'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_InPlaceXor' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to_PyType_Lookup'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyDict_Size' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyNumber_InPlaceRshift'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyFloat_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyIter_Next'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyCallable_Check' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyComplex_RealAsDouble'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyLong_FromUnsignedLong' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyList_Insert'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyObject_RichCompare' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_Items'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyTuple_GetItem' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyNumber_Subtract'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyComplex_Type' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyUnicode_AsUTF8String'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyUnicode_FromStringAndSize' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyDict_Clear'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to PyNumber_InPlaceLshift' ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference toPyBool_FromLong'
ld: //usr/lib/arm-linux-gnueabihf/libboost_python37.so: undefined reference to `PyNumber_InPlaceAdd'

and this is what I get when I tried you last suggestion;

pi@raspberrypi:~ sudo apt install pkg-config libboost-python-dev libboost-thread-dev libbluetooth-dev libglib2.0-dev python-dev Reading package lists... Done Building dependency tree Reading state information... Done libboost-python-dev is already the newest version (1.67.0.1+b1). libboost-thread-dev is already the newest version (1.67.0.1+b1). libglib2.0-dev is already the newest version (2.58.3-2+deb10u1). pkg-config is already the newest version (0.29-6). python-dev is already the newest version (2.7.16-1). python-dev set to manually installed. libbluetooth-dev is already the newest version (5.50-1+rpt1). The following package was automatically installed and is no longer required: rpi.gpio-common Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded. pi@raspberrypi:~

Well, the same as I get, it is found, this is a mystery. Right now I am lost...

There was a "hint" here:

Could you try to edit the setup.py file in /home/pi/gattlib-0.20150805

Change in line 22

if sys.version_info.major == 3:
    boost_libs = ["boost_python3"]

I did this change and it worked fine when I reinstalled

If this should not work either, try to install to Python2. It worked here without problem, see below. The other things are easy to fix for Python2, just use pip instead of pip3. The script works also unchanged, just modify the call in the exec node in the flow

pi@gattscanner:~ $ cd gattlib-0.20150805/
pi@gattscanner:~/gattlib-0.20150805 $ sudo pip install .
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/pi/gattlib-0.20150805
Building wheels for collected packages: gattlib
  Running setup.py bdist_wheel for gattlib ... done
  Stored in directory: /root/.cache/pip/wheels/2b/2d/d2/d62bdc868bb470d7b7e2fa672805652c9e57ff271d2ba6a8ea
Successfully built gattlib
Installing collected packages: gattlib
Successfully installed gattlib-0.20150805
pi@gattscanner:~/gattlib-0.20150805 $ cd ..
pi@gattscanner:~ $ python
Python 2.7.16 (default, Apr  6 2019, 01:42:57)
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gattlib
>>>