@@ -380,7 +380,89 @@ For the packaged builds of CBMC on our release page we currently build CBMC
380
380
with the MiniSat2 SAT solver statically linked at compile time. However it is
381
381
also possible to build CBMC using alternative SAT solvers.
382
382
383
- ### Compiling with Riss
383
+ ### Compiling CBMC Using Solver Native Interfaces
384
+
385
+ The following solvers are supported by CBMC using custom interfaces and can
386
+ by downloaded and compiled by the build process: MiniSAT2, CaDiCaL, and Glucose.
387
+
388
+ For `make` alternatives to the default (i.e. not MiniSAT) can be built with the
389
+ following commands for CaDiCaL:
390
+ ```
391
+ make -C src cadical-download
392
+ make -C src CADICAL=../../cadical
393
+ ```
394
+ and for glucose
395
+ ```
396
+ make -C src glucose-download
397
+ make -C src GLUCOSE=../../glucose-syrup
398
+ ```
399
+
400
+ For `cmake` the alternatives can be built with the following arguments to `cmake`
401
+ for CaDiCaL `-Dsat_impl=cadical` and for glucose `-Dsat_impl=glucose`.
402
+
403
+
404
+ ### Compiling with IPASIR Interface
405
+
406
+ The below compiling instructions allow linking of an arbitrary IPASIR
407
+ compatible SAT solver when compiling CBMC.
408
+
409
+ The general command using `make` is to compile with
410
+ ```
411
+ make -C src LIBS="$PWD/SATOBJ SATLINKFLAGS" IPASIR=$PWD/SATPATH
412
+ ```
413
+ Where `SATOBJ` is the pre-compiled IPASIR compatible SAT binary,
414
+ `SATLINKFLAGS` are any flags required by the SAT object file, and
415
+ `SATPATH` is the path to the SAT interface.
416
+
417
+ The rest of this section provides detailed instructions for some example
418
+ SAT solvers.
419
+
420
+ #### Compiling with CaDiCaL via IPASIR
421
+
422
+ Note that CaDiCaL can also be built using CBMC's CaDiCaL native interface
423
+ as described above. This section is to use CaDiCaL with the IPASIR
424
+ interface in CBMC.
425
+
426
+ The [CaDiCaL](https://github.com/arminbiere/cadical) solver supports the
427
+ [IPASIR](https://github.com/biotomas/ipasir) C interface to incremental SAT
428
+ solvers, which is also supported by CBMC. So the process for producing a CBMC
429
+ with CaDiCaL build is to build CaDiCaL as a static library then compile CBMC
430
+ with the IPASIR build options and link to the CaDiCaL static library.
431
+
432
+ Note that at the time of writing this has been tested to work with the CaDiCaL
433
+ 1.4.0 on Ubuntu 18.04 & 20.04 and MacOS.
434
+
435
+ 1. Download CaDiCaL:
436
+ ```
437
+ git clone --branch rel-1.4.0 https://github.com/arminbiere/cadical.git
438
+ ```
439
+ This will clone the CaDiCaL repository into a `cadical` subdirectory and
440
+ checkout release 1.4.0, which has been checked for compatibility with CBMC at
441
+ the time these instructions were written.
442
+
443
+ 2. Build CaDiCaL:
444
+ ```
445
+ cd cadical
446
+ ./configure
447
+ make cadical
448
+ cd ..
449
+ ```
450
+ This will create a build directory called `build` inside the clone of the
451
+ CaDiCaL repository. The `cadical` make target is specified in this example in
452
+ order to avoid building targets which are not required by CBMC. The built
453
+ static library will be placed in `cadical/build/libcadical.a`.
454
+
455
+ 3. Build CBMC:
456
+ ```
457
+ make -C src LIBS="$PWD/cadical/build/libcadical.a" IPASIR=$PWD/cadical/src
458
+ ```
459
+ This links the CaDiCaL library as part of the build. Passing the IPASIR
460
+ parameter tells the build system to build for the IPASIR interface. The
461
+ argument for the IPASIR parameter gives the build system the location for
462
+ the IPASIR headers, which is needed for the cbmc includes of `ipasir.h`. The
463
+ compiled binary will be placed in `cbmc/src/cbmc/cbmc`.
464
+
465
+ #### Compiling with Riss via IPASIR
384
466
385
467
The [Riss](https://github.com/conp-solutions/riss) solver supports the
386
468
[IPASIR](https://github.com/biotomas/ipasir) C interface to incremental SAT
0 commit comments