Skip to content

librat

Nodes in the Minot network that share data are called Rats (here is why). The functionality is shipped as a Rust and C library.

Ubuntu

Our PPA provides .deb files for a system-wide installation.

UOS PPA
curl -fsSL "https://uos-robotics.codeberg.page/ppa/ubuntu/key.gpg" | gpg --dearmor \
  | sudo tee /usr/share/keyrings/uos-archive-keyring.gpg >/dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/uos-archive-keyring.gpg] https://uos-robotics.codeberg.page/ppa/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" \
  | sudo tee /etc/apt/sources.list.d/uos.list
sudo apt update

After the setup, you can simply run apt.

sudo apt install librat-dev

Debian-based Distros

The PPA mentioned above is specific to Ubuntu the package itself does not require any system dependencies. Therefore it can be installed manually on all debian-based distros.

Manual .deb Installation
curl -s https://api.github.com/repos/uos/minot/releases/latest \
| grep "browser_download_url" \
| grep ".deb" \
| grep "$(dpkg --print-architecture)" \
| cut -d '"' -f 4 \
| xargs curl -L -O

sudo dpkg -i ./librat-dev_*.deb

The package also installs a pkg-config file, which allows the following usage in CMake.

Example CMake
find_package(PkgConfig REQUIRED)
pkg_check_modules(RAT REQUIRED librat)

add_executable(my_app main.c)
target_include_directories(my_app PRIVATE ${RAT_INCLUDE_DIRS})
target_link_libraries(myfind_package(PkgConfig REQUIRED)
pkg_check_modules(RAT REQUIRED librat)

add_executable(my_app main.c)
target_include_directories(my_app PRIVATE ${RAT_INCLUDE_DIRS})
target_link_libraries(my_app PRIVATE ${RAT_LIBRARIES})

From Source

Building from source generates a static and shared library in the ./target/release/ folder. You will need to clone the repository first.

Build librat from source
git clone https://github.com/uos/minot
cd minot
cargo build --package mt_rat --release

A typical system-wide installation is done by copying the libraries to your linker path. Alternatively, you may change the link path and include search paths in your build system.

sudo cp ./target/release/librat.* /usr/local/lib/
sudo mkdir -p /usr/local/include/rat/
sudo cp ./mt_rat/rat.h /usr/local/include/rat/

Then you can use the library in your C/C++ code.

#include <rat/rat.h>

And link with -lrat.


For using the Rust library, just add this to your dependencies in Cargo.toml.

Cargo.toml
[dependencies]
mt_rat = "0.7.0"