How to obtain an ipasir backend implementation.
There are several SAT solver libraries that implement the IPASIR interface. One source is the ipasir distribution on github, which includes a few compatible solvers. Another source is the incremental solver submissions for the 2020 SAT competition. However, in most cases the build scripts for these libraries are configured to produce a static library, and we need a shared library in order to link it into a running Lisp session.
This git repository contains wrappers for a few ipasir solvers and build scripts for creating dynamic libraries. The following sequence of commands has worked to build Glucose 4.1 on Linux and MacOS:
# Clone the repo into liveontologies-ipasir git clone https://github.com/liveontologies/ipasir.git liveontologies-ipasir cd liveontologies-ipasir # Optional: check out a known-working commit git checkout -b my-branch b183c8bf15f5c8f27246d630b2eb2c6df5ac453a # make the glucose shared library cd ipasir-glucose/src/main/native/ make library.version=4.1
This creates a shared library called libglucose-syrup.so on Linux or libglucose-syrup.dylib. To use it, set the IPASIR_SHARED_LIBRARY environment variable to that file's full path (optionally moving it to a convenient location first).
Note, the makefile used above relies upon a tarball of the Glucose sources being available for download from a personal webpage of one of the authors. If this tarball disappears, another location of the Glucose sources is this git repository.
We describe the steps below for patching the build scripts for the 2017 SAT competition version of Glucose. Unfortunately, the web pages for the 2017 and previous SAT competitions are offline. We preserve the instructions here in case they are applicable to other solvers. For glucose, the binding and build files are available in the ACL2 distribution under books/centaur/ipasir/solver-glue/glucose4/.
Instructions for building IPASIR-compatible Glucose shared library from the SAT competition 2017 distribution:
First, ensure that you have gcc and g++ version 6 or greater.
Unzip the archive and edit the file "sat/glucose4/makefile" as follows:
Or apply the following patch instead:
32,33c32,33 < CXXFLAGS= -g -std=c++11 -Wall -DNDEBUG -O3 < --- > CXXFLAGS= -g -std=c++11 -Wall -DNDEBUG -O3 -fPIC > export CXXFLAGS 70c70 < $(CXX) -g -std=c++11 $(CXXLAGS) \ --- > $(CXX) -g -std=c++11 $(CXXFLAGS) \
After fixing the makefile, run "make". This should produce files "ipasirglucoseglue.o" and "libipasirglucose4.a".
Link those two files into a shared library. For Linux, this can be done as follows:
g++ -shared -Wl,-soname,libipasirglucose4.so -o libipasirglucose4.so \ ipasirglucoseglue.o libipasirglucose4.a
(Note: Counterintuitively, it is important that the .o file is listed before the .a file.)
Finally, move the resulting shared library "libipasirglucose4.so" to a permanent location and either: