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
When the static feature is enabled, 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 builds cvc5 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)
Without the static feature, the build script does not build cvc5 from source.
Instead it expects cvc5 to be installed on the system or in a path pointed to by CVC5_LIB_DIR,
and discovers headers via CVC5_INCLUDE_DIR or by asking the C compiler.
Source acquisition (static feature)
The build script locates the cvc5 source in the following order:
CVC5_DIRenvironment variable — set to the cvc5 source root.cvc5/subdirectory inside thecvc5-syscrate — the default when using the git submodule.- Automatic clone — if none of the above are found, the build script clones the matching cvc5 release tag from
GitHub into
OUT_DIR.
# 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 and installed, you can skip the automatic build by setting
CVC5_LIB_DIR to the directory containing the libraries (libcvc5.a for static, or
libcvc5.so/libcvc5.dylib for dynamic):
CVC5_LIB_DIR=/path/to/cvc5/build/install/lib
or
CVC5_LIB_DIR=/path/to/cvc5/build/install/lib
Headers are resolved in this order:
CVC5_INCLUDE_DIRenvironment variable (if set)$CVC5_LIB_DIR/../include(the conventional install layout)- Compiler discovery — the build script asks the C compiler to locate
cvc5/c/cvc5.hon the system include path
# Override both paths explicitly
CVC5_LIB_DIR=/path/to/libs CVC5_INCLUDE_DIR=/path/to/include
Features
| Feature | Description |
|---|---|
static |
Statically link cvc5. Enables automatic source build if cvc5 is not already compiled. Otherwise, the crate employs dynamic linking to cvc5 and assume some local installation of cvc5. |
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
When the static feature is enabled, the build script statically links:
libcvc5(andlibcvc5parserwith theparserfeature)- Bundled dependencies:
cadical,picpoly,picpolyxx,gmp - The platform C++ standard library (
libc++on macOS,libstdc++on Linux) libstdc++_nonsharedon RHEL/CentOS with GCC toolsets (detected automatically)
The build script supports both lib/ and lib64/ install layouts.
License
BSD-3-Clause — see LICENSE.