13

I use Ubuntu 16.04 64bit OS
when I run

$ sudo pip3 install gattlib

I got this error message

/usr/bin/ld: cannot find -lboost_python-py34
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

I tried googling how to solve this but nothing works for me
I want to use gatttool at python, so I need to install this
How can I solve this?

PS. I already downloaded libboost-dev

seok hyun Ko
  • 131
  • 1
  • 1
  • 5

6 Answers6

21
pip3 download gattlib
tar xvzf ./gattlib-0.20150805.tar.gz
cd gattlib-0.20150805/
sed -ie 's/boost_python-py34/boost_python-py35/' setup.py
pip3 install .
Benjamin Tamasi
  • 662
  • 7
  • 18
  • 4
    I would suggest people check their python version and then adjust the number `35` to what they needd (if it exists??) – Angry 84 Dec 06 '18 at 03:58
  • 1
    No need to adjust the specific version, just adding `boost_python3` works for me: ["The bug can be solved easily by replacing boost_python_py34 with boost_python3"](https://bitbucket.org/OscarAcena/pygattlib/issues/41/ld-cannot-find-lboost_python-py34) – Blo Aug 29 '19 at 22:33
5

And for python 3.7 you should do:

pip3 download gattlib
tar xvzf ./gattlib-0.20150805.tar.gz
cd gattlib-0.20150805/
sed -ie 's/boost_python-py34/boost_python37/' setup.py
pip3 install .
Mike666
  • 459
  • 5
  • 12
2

If Benjamin's solution does not work, try changing 35 to 36. i.e. try the code below.

pip3 download gattlib
tar xvzf ./gattlib-0.20150805.tar.gz
cd gattlib-0.20150805/
sed -ie 's/boost_python-py34/boost_python-py36/' setup.py
pip3 install .
James Parker
  • 457
  • 4
  • 19
1

I was running in to the following error on RPI-3B:
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ src/gattservices.cpp:6:33: fatal error: bluetooth/bluetooth.h: No such file or directory #include ^ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

[1] Running the following command helped me to resolve:

sudo apt-get install libbluetooth-dev

[2] Also deleting the folder 'gattlib-0.20150805' and recreating it using 'tar xvzf ...' again, helped cleaning the previous compilation left over files.

Steve
  • 325
  • 3
  • 6
0

This works with Raspberry 2, Rasbian Buster and Python 3. Note that Python 3 libraries seems to have different naming “The bug can be solved easily by replacing boost_python_py34 with boost_python3 when specifying the boost libraries in setup.py.“

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

Libraries:

/usr/lib/arm-linux-gnueabihf/libboost_python3.a
/usr/lib/arm-linux-gnueabihf/libboost_python3-py37.a
/usr/lib/arm-linux-gnueabihf/libboost_python3-py37.so
/usr/lib/arm-linux-gnueabihf/libboost_python3.so
Jawad
  • 11,028
  • 3
  • 24
  • 37
0

Following PyGattlib DEPENDS all dependencies include pkg-config to "manage compile and link flags for libraries". This solved

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

I updated my package install dependencies and it works !

RUN install_packages \
  python3-dev \
  libbluetooth-dev \
  libboost-python-dev \
  libboost-thread-dev \
  libglib2.0-dev \
  pkg-config

RUN python3 -m pip install pygattlib

Docker Balena.io Ubuntu "bionic beaver"

TRicks43
  • 121
  • 1
  • 5