SyntaxDot has the following base requirements:
- A Rust Toolchain
- A C++ compiler
- libtorch
- cmake
- OpenSSL
- pkg-config
Additionally, compiling a SyntaxDot with training functionality requires:
- CUDA
Install cmake
, for instance through Homebrew:
brew install cmake
Most of the dependencies can be installed in Fedora using the following command:
$ sudo dnf install -y cmake gcc-c++ openssl-devel pkg-config
Follow the RPM Fusion instructions for installing CUDA. Besides these dependencies, you also need a Rust toolchain and libtorch (see below).
Install the following dependencies through APT:
$ apt-get install -y build-essential cmake libssl-dev pkg-config
For installing CUDA, please refer to your distribution's instructions. Besides these dependencies, you also need a Rust toolchain and libtorch (see below).
A Rust stable toolchain can be installed through rustup:
$ rustup default stable
Download libtorch with the CXX11 ABI. A CUDA build is necessary for training, otherwise the CPU build can be used. After unpacking the libtorch archive, you should set the following environment variables:
$ export LIBTORCH=/path/to/libtorch
# Linux:
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${LIBTORCH}/lib
# macOS
$ export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+$DYLD_LIBRARY_PATH:}${LIBTORCH}/lib
There are currently no libtorch releases available for macOS ARM64. However,
you can use libtorch from the torch
Python package:
$ pip install torch
$ export LIBTORCH=$(python -c 'import torch; from pathlib import Path; print(Path(torch.__file__).parent)')
$ export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+$DYLD_LIBRARY_PATH:}${LIBTORCH}/lib
You can build SyntaxDot with support for training enabled using:
$ cargo install syntaxdot-cli
To build SyntaxDot without training features, use:
$ cargo install --no-default-features syntaxdot-cli
The SyntaxDot binary will then be available in: ~/.cargo/bin/syntaxdot