2

I read all the other Q&A about the stray error, but I couldn't find anything similar to my issue...

So: I need to add BLE support to pybluez on Raspberry Pi 3 Model B (running on Raspbian Jessie Lite kernel v.4.4) and, when it comes to build gattlib, I got a huge list of these errors (here's an extended copy-paste of console output: https://pastebin.com/KjRB5rB7):

/usr/include/boost/python.hpp:5:1: error: stray ‘\2’ in program
/usr/include/boost/python.hpp:5:1: error: stray ‘\264’ in program
/usr/include/boost/python.hpp:5:1: error: stray ‘\334’ in program
/usr/include/boost/python.hpp:5:1: error: stray ‘\354’ in program
/usr/include/boost/python.hpp:5:1: error: stray ‘\377’ in program
/usr/include/boost/python.hpp:5:1: error: stray ‘\3’ in program

I know it's a problem of character encoding, but it looks very strange to me that this happens on downloaded code.

Is there a way to fix this and proceed with installation?

I'm connected in SSH through a MacBook Pro running on Mac OS X v10.10.5 (Yosemite) and the charset of the hpp file is binary.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
lbrutti
  • 1,181
  • 13
  • 19

2 Answers2

8

Install gattlib on Raspberry Pi

I have had some difficulty in determining that gattlib was missing and then more difficulty getting it installed.

The project relates to installing a Bluetooth low energy (BLE) thingy on a Raspberry Pi using Python.

from gattlib import *

gives

... ImportError: No module named gattlib

Or finding ble in Bluetooth, since ble is a simple wrapper for gattlib.

gattlib should be in the /usr/local/lib/python2.7/dist-packages directory, along with Bluetooth thingy.

There are some dependencies you need to install first.

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

​sudo pip install gattlib

It failed in my case, because there was only 100 MB in the swapfile. Mine worked when I made it 800, but it failed at 500. In my (limited) experience, a failure will occur with an error message. The compiling and so on takes a very long time.​

sudo nano /etc/dphys-swapfile

​It's easy to see what needs to be changed here! Then stop and start it.​

sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start

sudo free -m

​This last one shows you how much free space you have.

​sudo pip install gattlib

eventually (15? minutes later), it finishes.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user462990
  • 5,472
  • 3
  • 33
  • 35
1

I solved it simply by giving up trying to install pybluez and installed bluepy instead.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
lbrutti
  • 1,181
  • 13
  • 19