Skip to main content
GNSS Documentation
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Installation

Dependencies

Install build tools and libraries:

sudo apt-get install build-essential cmake libgpiod-dev

For Python bindings you also need:

sudo apt-get install python3-dev

Build & Install

git clone https://github.com/jimmypaputto/GnssHat.git
cd GnssHat
mkdir -p build && cd build
cmake .. -DBUILD_PYTHON=ON -DBUILD_EXAMPLES=ON
make
sudo make install
sudo ldconfig

CMake Flags

Flag Description
BUILD_PYTHON Build and install the Python CPython extension module
BUILD_EXAMPLES Build all C and C++ examples. Binaries are symlinked into examples/BinariesSymlinks/ for convenience

Both flags are optional — omit them if you only need the C++ / C shared library.

Python Module Standalone Build

The Python module can also be built separately (requires the C++ library installed first):

cd GnssHat/python
mkdir -p build && cd build
cmake .. && make -j$(nproc)
sudo make install

Installs to ~/.local/lib/pythonX.Y/site-packages/jimmypaputto/.

libgpiod Version

The library requires libgpiod. If you get a compilation error like:

error: 'gpiod_edge_event_buffer_free' was not declared in this scope

Set the correct libgpiod version in CMakeLists.txt:

set(LIBGPIOD_VERSION 1)
# or
set(LIBGPIOD_VERSION 2)
Note
Most recent Raspberry Pi OS images ship with libgpiod version 2. Older images use version 1.

UART Configuration

If you see:

[UART] Failed to open UART device: No such file or directory
[UART] Cannot init epoll - UART not initialized

Enable UART via raspi-config:

sudo raspi-config

Navigate to Interface Options → Serial Port and enable the serial hardware interface. A reboot is required.

Note
Only the L1/L5 TIME HAT (NEO-F10T) and the UART channel of the L1/L5 RTK HAT (NEO-F9P) require UART. The L1 GNSS HAT (NEO-M9N) uses SPI only.