An asynchronous, cross-platform C API which wraps the poktroll
client packages (via cgo wrapper functions).
- Installation
- Getting started (development environment)
- Linux
- MacOS
- Cross-compiling from (arch) linux
You can EITHER download or build an OS/architecture-specific installer or shared library.
Downloads are available via the releases page.
Installers are preferred as they only need to be run, whereas shared libraries need to be renamed and saved to one of the OS's library search paths (e.g. /usr/lib/
, /usr/local/lib/
, ~/.local/lib/
, etc.).
Depending on your OS, the file extension will either be .so
, .dylib
, or .dll
for linux, macOS, and Windows, respectively.
E.g.: For v0.1.0 x86_64 linux, libpoktroll_clients-v0.1.0-amd64.so
-> /usr/local/lib/libpoktroll_clients.so
To build from source, complete the getting started section below, then run sudo make install
or see the platform-specific sections below.
As with downloaded shared libraries (see above), the steps outlined in the platform-specific sections below will produce an OS/architecture-specific shared library, which will need to be renamed and saved to one of the OS's library search paths.
E.g.: For v0.1.0 x86_64 linux, libpoktroll_clients-v0.1.0-amd64.so
-> /usr/local/lib/libpoktroll_clients.so
# Clone and cd into the repo.
git clone https://github.com/bryanchriswhite/libpoktroll-clients.git --recurse-submodules
cd libpoktroll_clients
# If you cloned but didn't pull the submodules, run:
git submodule update --init --recursive
# (optional) Update protobufs ("pull" from buf.build)
buf export buf.build/pokt-network/poktroll
# Generate protobufs
buf generate
# Make and cd to cmake build directory.
mkdir build
cd build
# Generate build files and build the library..
cmake ..
make
# Run tests (requires running poktroll localnet.
# (see: https://dev.poktroll.com/develop/developer_guide/quickstart#1-launch--inspect-localnet)
ctest --output-on-failure
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ./build/libpoktroll_clients-<version>-amd64.so -buildmode=c-shared .
cd libpoktroll_clients/build
cmake ..
# Build deb/rpm/tar install packages.
make package # ALL
## Produces:
# - build/libpoktroll_clients-<version>-<arch>-linux.deb
# - build/libpoktroll_clients-<version>-<arch>-linux.rpm
# - build/libpoktroll_clients-<version>-<arch>-linux.sh
# - build/libpoktroll_clients-<version>-<arch>-linux.tar.gz
## OR
cpack -T "DEB;RPM;STGZ;TGZ" # All
cpack -T DEB # Debian/Ubuntu
cpack -T RPM # RHEL/Fedora
cpack -T STGZ # self-extracting tar.gz
cpack -T TGZ # tar.gz
# Build arch install package (depends on TGZ from cpack).
make pkgbuild
## Produces:
# - build/PKGBUILD
# - build/pkg/*
# Install the shared library and headers.
## Arch
sudo pacman -U ./pkg/libpoktroll_clients-<version>-<arch>-Linux.pkg.tar.zst
## Debian
sudo dpkg -i ./libpoktroll_clients-<version>-<arch>-Linux.deb
## RHEL/CentOS
sudo rpm -i ./libpoktroll_clients-<version>-<arch>-Linux.rpm
# MacOS (Intel)
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o ./build/libpoktroll_clients-<version>-amd64.dylib -buildmode=c-shared .
# MacOS (ARM)
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o ./build/libpoktroll_clients-<version>-arm64.dylib -buildmode=c-shared .
cd poktroll-clients-py
mkdir ./build && cd ./build
cmake ..
# Build deb/rpm/tar install packages.
make package # ALL
## Produces:
# - build/libpoktroll_clients-<version>-<arch>-darwin.pkg
# - build/libpoktroll_clients-<version>-<arch>-darwin.sh
# - build/libpoktroll_clients-<version>-<arch>-darwin.tar.gz
## OR
cpack -T "productbuild;TGZ;STGZ" # All
cpack -T productbuild # MacOS .pkg
cpack -T STGZ # Self-extracting tar.gz
cpack -T TGZ # tar.gz
## Dependencies
sudo pacman -S mingw-w64-gcc wine wine-mono wine_gecko winetricks
yay -S llvm-mingw-w64-toolchain-ucrt-bin
## Shared library
CGO_ENABLED=1 \
CC=x86_64-w64-mingw32-gcc \
CXX=x86_64-w64-mingw32-g++ \
GOOS=windows \
GOARCH=amd64 \
go build -o ./build/libpoktroll_clients-<version>-amd64.dll -buildmode=c-shared .
## Installer
TODO: While this is possible, it's a bit involved and out of scope for the initial release.
TODO: While this is possible, it's a bit involved and out of scope for the initial release.