Skip to content

Commit a870eea

Browse files
authored
Merge pull request #6031 from thomasspriggs/tas/document_riss_build
Document building CBMC with IPASIR and Riss
2 parents 35ac0ef + 9305563 commit a870eea

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

COMPILING.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,50 @@ compilation flag:
373373
cmake -S . -Bbuild -DCMAKE_CXX_FLAGS="-DBDD_GUARDS"
374374
```
375375
and then `cmake --build build`
376+
377+
## Compiling with alternative SAT solvers
378+
379+
For the packaged builds of CBMC on our release page we currently build CBMC
380+
with the MiniSat2 SAT solver statically linked at compile time. However it is
381+
also possible to build CBMC using alternative SAT solvers.
382+
383+
### Compiling with Riss
384+
385+
The [Riss](https://github.com/conp-solutions/riss) solver supports the
386+
[IPASIR](https://github.com/biotomas/ipasir) C interface to incremental SAT
387+
solvers, which is also supported by CBMC. So the process for producing a CBMC
388+
with Riss build is to build Riss as a static library then compile CBMC with the
389+
IPASIR build options and link to the Riss static library. The following
390+
instructions have been confirmed to work on Ubuntu 20 at the time of writing.
391+
They can also be made to work on Ubuntu 18, by using a debug build of Riss. Riss
392+
uses Linux specific functionality / API calls. Therefore it can't be compiled
393+
successfully on Windows or macOS.
394+
395+
1. Download Riss:
396+
```
397+
git clone https://github.com/conp-solutions/riss riss
398+
```
399+
This will clone the Riss repository into a `riss` subdirectory.
400+
401+
2. Build Riss:
402+
```
403+
cd riss
404+
cmake -H. -Brelease -DCMAKE_BUILD_TYPE=Release
405+
cd release
406+
make riss-coprocessor-lib-static
407+
cd ../..
408+
```
409+
This will create a build directory called `release` inside the clone of the
410+
Riss repository and build the static library in
411+
`riss/release/lib/libriss-coprocessor.a`.
412+
413+
3. Build CBMC:
414+
```
415+
make -C src LIBS="$PWD/riss/release/lib/libriss-coprocessor.a -lpthread" IPASIR=$PWD/riss/riss
416+
```
417+
This links the Riss library and the pthreads library. The pthreads library is
418+
needed because the Riss library uses it for multithreading. Passing the
419+
IPASIR parameter tells the build system to build for the IPASIR interface.
420+
The argument for the IPASIR parameter gives the build system the location for
421+
the IPASIR headers, which is needed for the cbmc includes of `ipasir.h`. The
422+
compiled binary will be placed in `cbmc/src/cbmc/cbmc`.

0 commit comments

Comments
 (0)