
cvc5 from source on a Debian-based linux distribution, with Java bindings. Integration of cvc5 with a maven project. Workarounds for outdated maven artifact and Linux package. Ideally, one would install the latest cvc5 libraries and binaries using their operating system's package manager. They would then add the latest cvc5 Java API maven artifact from Maven Central as a dependency in their pom.xml. However the latest Linux packages and the latest maven artifact currently lag significantly behind. A less ideal manual process can bridge the gap.
I get errors when I try to build cvc5 with the latest version of Java. Probably worth trying again after time has passed, but meanwhile install an older version of Java and temporarily point $JAVA_HOME at it. Then follow the official build instructions.
# Install some build tools sudo apt install cmake m4 # Install an old JDK compatible with cmake or cvc5 or whatever sudo apt install openjdk-8-jdk # Use this JDK for the cvc5 build process export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 # Navigate to a parent directory into which to clone the repo # Mostly doing this for clarity later on cd /home/bob # Clone the cvc5 repo from github git clone https://github.com/cvc5/cvc5 cd cvc5 # Switch to latest stable branch # Replace the version number if needed git checkout cvc5-1.1.2 # Build the project and java bindings ./configure.sh production --java-bindings --auto-download --prefix=build/install cd build make make install
Assuming the existence of a maven project where the package goal is working, the next step is to create a local maven repository inside the project. If the project is a git repository, the local maven repository and the cvc5 Java API jar it will contain will live alongside the project's source code in the git repository.
Create the very precise directory structure the local maven repository requires to house the jar. Adjust the version number of the directory if necessary to match that of the jar. Copy the Java API deep inside the local repository. Add a pom.xml file alongside it. Paste into the pom.xml file the contents of the Maven POM File for cvc5 from Maven Central.
# Navigate to the maven project's directory cd /home/bob/mvnprj # Create directory structure to house jar in local repo # Replace the version number if needed mkdir -p libs/io/github/p-org/solvers/cvc5/1.1.2 # Copy the jar to the local repo # Replace the version number if needed cp /home/bob/cvc5/build/install/share/java/cvc5/cvc5-1.1.2.jar /home/bob/mvnprj/libs/io/github/p-org/solvers/cvc5/1.1.2 # Paste content from Maven Central into this file vim ~/mvnprj/libs/io/github/p-org/solvers/cvc5/1.1.2/pom.xml
The remaining work happens in the pom.xml file of the project. Tell maven about the new local repository by adding a repository block. Only include the enclosing repositories block if the project does not already contain one.
<repositories>
<repository>
<id>ProjectRepo</id>
<name>ProjectRepo</name>
<url>file://${project.basedir}/libs</url>
</repository>
</repositories> Add the new artifact to the project's dependencies by adding a dependency block. Only include the enclosing dependencies block of the project does not already contain one.
<dependencies>
<dependency>
<groupId>io.github.p-org.solvers</groupId>
<artifactId>cvc5</artifactId>
<version>1.1.2</version>
</dependency>
</dependencies> At this point, the project should build. If it does, try pasting one of the cvc5 examples into the main program and building again.
The challenge around running the project is that the cvc5 build process leaves the libraries that the Java API needs to link to in a place where Java can't see them. Those libraries currently live in /home/bob/cvc5/build/install/lib. Two options here:
/usr/lib and run the project as usual. I have not tried this approach.# If the libraries have been moved to a standard location java -jar target/MyProject-1.0-SNAPSHOT-jar-with-dependencies.jar # If the libraries have not been moved java -Djava.library.path="/home/bob/src/cvc5/build/install/lib" -jar target/MyProject-1.0-SNAPSHOT-jar-with-dependencies.jar
Be sure to replace the path to the project jar appropriately. The java.library.path must be an absolute path.
cvc5 is and does. Includes links to documentation, installation instructions, and the official website. cvc5 package for a major Linux distribution, currently quite outdated. cvc5 on the Maven Central Repository. The artifact currently lags behind the latest release unfortunately.