Installation and first run¶
Supported environment¶
| Item | Requirement |
|---|---|
| Platform | Linux x86-64 (linux-64), Linux ARM64 (linux-aarch64), or macOS 15+ Apple Silicon (osx-arm64); see platform validation |
| Compiler | Mojo 1.2.0 in the checkout, pinned through Pixi |
| Exact numbers | APN Mojo 1.0.2 from modular-community, pinned through Pixi |
| Solver | cvc5 1.4.1, the matching official shared build: included in the package, and downloaded and checked against its sha256 in a checkout |
| Tools | Pixi, which installs Mojo, and in a checkout also Python and a C compiler |
The Mojo 1.2 upgrade is source release 1.4.1.1. Use a checkout until its channel package is published. The existing channel package below still uses Mojo 1.1.0.
Install the package¶
Version 1.4.1.0, for Mojo 1.1.0, is published in the modular-community channel. Create a consumer project with the release platforms and all three channels, then install the bindings and the tested compiler:
pixi init solver-project --platform linux-64 --platform linux-aarch64 \
--platform osx-arm64 -c https://conda.modular.com/max \
-c https://repo.prefix.dev/modular-community -c conda-forge
cd solver-project
pixi add "mojo==1.1.0" "cvc5_mojo==1.4.1.0"
linux-64 means Intel/AMD x86-64; linux-aarch64 means 64-bit ARM on
Linux. osx-arm64 means Apple Silicon Macs running macOS 15 or later,
following Mojo’s macOS requirements.
Intel Macs and 32-bit ARM are not included. Pixi selects the build for the
current machine. For a project targeting only one platform, include only
that platform.
The package includes cvc5's native solver and parser libraries and depends
on apn_mojo 1.0.1. Save the first-query example
as main.mojo, then run it from the consumer project:
pixi run --locked mojo run main.mojo
Installed-package imports need no -I src or CVC5_MOJO_LIBRARY override.
Pixi activates the environment used by the library loader. See the
release notes for the first release's scope and
packaging for how the package is built.
Work from a checkout¶
After installing Pixi, clone the repository and set it up:
git clone https://github.com/Spellbound-Mojo/cvc5_mojo.git
cd cvc5_mojo
pixi install --locked
pixi run --locked generate # downloads cvc5 1.4.1 into third_party/ and regenerates
Run the commands in this documentation from the repository root. --locked
keeps every dependency at the version in pixi.lock, as CI does.
pixi run --locked generate downloads the pinned cvc5 release and its
source archive and checks both against the sha256 values in
cvc5-version.toml. It then regenerates every generated file. These cvc5
downloads go to third_party/, which Git ignores. Pixi installs
APN Mojo from the locked channel package.
Import from source¶
To run a program against the sources, pass -I src for the bindings.
Mojo finds the installed apn_mojo package through the Pixi environment:
pixi run --locked mojo run -I src docs/examples/quickstart.mojo
Follow your first solver query for an explanation of the program, then continue through the learning path. For an application outside this checkout, use the external consumer guide.
Import a precompiled package¶
You can also precompile the bindings once and import the result:
pixi run --locked package # writes build/cvc5_mojo.mojoc
pixi run --locked mojo run -I build docs/examples/quickstart.mojo
Big numbers: apn_mojo¶
Python's cvc5 returns and accepts an int of any size and a Fraction. In
Mojo, these are Integer and Rational from apn_mojo, an arbitrary-precision
number library for Mojo. For example, term.getIntegerValue() == 2**70
compares exactly. Import the types with from apn_mojo import Integer,
Rational.
APN Mojo 1.0.2 is published on modular-community for all three supported
platforms and requires Mojo 1.2. The checkout pins apn_mojo==1.0.2 in
pixi.toml; pixi.lock records each platform's package and checksum.
Install it with the other dependencies:
pixi install --locked
No extra APN import path is needed. Remove old -I third_party/apn_mojo
overrides so they cannot shadow the installed package. Test reports record
the installed conda build and hash the precompiled artifact.
See the APN Mojo documentation
for the number types themselves.
Where the library is found¶
The bindings load libcvc5.so and libcvc5parser.so on Linux, or
libcvc5.dylib and libcvc5parser.dylib on macOS. They select the main
library in this order and require the matching parser beside it:
$CVC5_MOJO_LIBRARY, the full path of the main library, including its platform suffix. The parser is taken from the same directory.$CONDA_PREFIX/lib/cvc5_mojo/lib/, where the conda package installs them.third_party/cvc5/lib/, relative to the working directory, where a checkout keeps them.
A program using checkout libraries outside the repository root needs
CVC5_MOJO_LIBRARY; an installed conda package uses the active environment
instead. The libraries are loaded once per process, when the
first TermManager is created, so set the variable before then. See
troubleshooting if a library is not found.
Initialization rejects a reported cvc5 version that differs from the pin.
Documentation site¶
pixi run --locked -e docs docs-serve
This serves the site locally and reloads it when a page changes. See maintaining the docs.