cvc5-sys
Low-level FFI bindings for the cvc5 SMT solver, generated
via bindgen from the cvc5 C API header (cvc5/c/cvc5.h).
For a safe, idiomatic Rust API, see the higher-level cvc5-rs crate.
Prerequisites
This crate wraps cvc5 1.3.1 (the expected version is declared in Cargo.toml under
[package.metadata.cvc5]). If cvc5 has not been compiled yet, the build script runs
configure.sh --static --auto-download and make automatically. You need:
- A C/C++ compiler (GCC or Clang)
- CMake ≥ 3.16
- libclang (required by bindgen)
- Git (for automatic source download when installed from crates.io)
Source Acquisition
The build script locates the cvc5 source in the following order:
CVC5_DIRenvironment variable — set to the cvc5 source root containinginclude/andbuild/directories.cvc5/subdirectory inside thecvc5-syscrate — the default when using the git submodule.- Sibling
cvc5/directory — a built cvc5 checkout next to thecvc5-syscrate (workspace layout). - Automatic clone — if none of the above are found, the build script clones the matching cvc5 release tag from GitHub.
# Option 1: explicit path
CVC5_DIR=/path/to/cvc5
# Option 2: submodule (no env var needed)
&&
# Option 3: from crates.io (auto-clones cvc5)
An application can set CVC5_DIR in its .cargo/config.toml to point to a local cvc5 checkout:
[]
= { = "cvc5", = true }
Linking Against a Prebuilt cvc5
If you already have cvc5 built, you can skip the automatic build by setting CVC5_LIB_DIR to the
directory containing the static libraries (libcvc5.a, etc.):
CVC5_LIB_DIR=/path/to/cvc5/build/lib
Headers are expected at $CVC5_LIB_DIR/../include by default. To override, set CVC5_INCLUDE_DIR:
CVC5_LIB_DIR=/path/to/libs CVC5_INCLUDE_DIR=/path/to/include
Features
| Feature | Description |
|---|---|
parser |
Also generate and link bindings for cvc5parser. |
Enable with:
Usage
All symbols mirror the C API directly. Every call is unsafe.
use *;
unsafe
Linked Libraries
The build script statically links:
libcvc5(andlibcvc5parserwith theparserfeature)- Bundled dependencies when present:
cadical,picpoly,picpolyxx,gmp - The platform C++ standard library (
libc++on macOS,libstdc++on Linux)
License
BSD-3-Clause — see LICENSE.