got error while download gattlib via pip3

11.1k views Asked by At

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

6

There are 6 answers

0
TRicks43 On

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"

0
Steve On

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.

2
Benjamin Tamasi On
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 .
0
James Parker On

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 .
0
user12657834 On

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
0
Mike666 On

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 .