fix incorrect 64-bit detection -- powerpc64le doesn't end in 64 but is 64-bit
[cvc5.git] / INSTALL.rst
1 Building cvc5
2 -------------
3
4 .. code:: bash
5
6 ./configure.sh
7 # use --prefix to specify an install prefix (default: /usr/local)
8 # use --name=<PATH> for custom build directory
9 # use --auto-download to download and build missing, required or
10 # enabled, dependencies
11 cd <build_dir> # default is ./build
12 make # use -jN for parallel build with N threads
13 make check # to run default set of tests
14 make install # to install into the prefix specified above
15
16 All binaries are built into ``<build_dir>/bin``, the cvc5 library is built into
17 ``<build_dir>/lib``.
18
19
20 Supported Operating Systems
21 ---------------------------
22
23 cvc5 can be built natively on Linux and macOS, cross-compilation is possible for
24 Windows using Mingw-w64. cvc5 also supports cross-compilation for ARM64 systems.
25 We generally recommend a 64-bit operating system.
26
27
28 Compilation on macOS
29 ^^^^^^^^^^^^^^^^^^^^
30
31 On macOS, we recommend using `Homebrew <https://brew.sh/>`_ to install the
32 dependencies. We also have a Homebrew Tap available at
33 https://github.com/CVC4/homebrew-cvc4 .
34 Note that linking system libraries statically is
35 `strongly discouraged <https://developer.apple.com/library/archive/qa/qa1118/_index.html>`_
36 on macOS. Using ``./configure.sh --static`` will thus produce a binary
37 that uses static versions of all our dependencies, but is still a dynamically
38 linked binary.
39
40
41 Cross-compiling for Windows
42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
43
44 Cross-compiling cvc5 with Mingw-w64 can be done as follows:
45
46 .. code:: bash
47
48 ./configure.sh --win64 --static <configure options...>
49
50 cd <build_dir> # default is ./build
51 make # use -jN for parallel build with N threads
52
53 The built binary ``cvc5.exe`` is located in ``<build_dir>/bin`` and the cvc5
54 library can be found in ``<build_dir>/lib``.
55
56
57 Build dependencies
58 ------------------
59
60 cvc5 makes uses of a number of tools and libraries. Some of these are required
61 while others are only used with certain configuration options. If
62 ``--auto-download`` is given, cvc5 can automatically download and build most
63 libraries that are not already installed on your system. If your libraries are
64 installed in a non-standard location, you can use ``--dep-path`` to define an
65 additional search path for all dependencies. Versions given are minimum
66 versions; more recent versions should be compatible.
67
68 - `GNU C and C++ (gcc and g++, >= 7) <https://gcc.gnu.org>`_
69 or `Clang (>= 5) <https://clang.llvm.org>`_
70 - `CMake >= 3.9 <https://cmake.org>`_
71 - `Python >= 3.6 <https://www.python.org>`_
72 + module `toml <https://pypi.org/project/toml/>`_
73 - `GMP v6.1 (GNU Multi-Precision arithmetic library) <https://gmplib.org>`_
74 - `ANTLR 3.4 <http://www.antlr3.org/>`_
75 - `CaDiCaL (SAT solver) <https://github.com/arminbiere/cadical>`_
76 - `Java >= 1.6 <https://www.java.com>`_
77 - `SymFPU <https://github.com/martin-cs/symfpu/tree/CVC4>`_
78
79
80 ANTLR 3.4 parser generator
81 ^^^^^^^^^^^^^^^^^^^^^^^^^^
82
83 For most systems, the package manager no longer contains pre-packaged versions
84 of ANTLR 3.4. With ``--auto-download``, cvc5 will automatically download and
85 build ANTLR 3.4.
86
87
88 CaDiCaL (SAT solver)
89 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90
91 `CaDiCaL <https://github.com/arminbiere/cadical>`_ is a SAT solver that can be
92 used for the bit-vector solver. It can be downloaded and built automatically.
93
94
95 GMP (GNU Multi-Precision arithmetic library)
96 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97
98 GMP is usually available on your distribution and should be used from there. If
99 it is not, or you want to cross-compile, or you want to build cvc5 statically
100 but the distribution does not ship static libraries, cvc5 builds GMP
101 automatically when ``--auto-download`` is given.
102
103
104 SymFPU (Support for the Theory of Floating Point Numbers)
105 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106
107 `SymFPU <https://github.com/martin-cs/symfpu/tree/CVC4>`_ is an implementation
108 of SMT-LIB/IEEE-754 floating-point operations in terms of bit-vector operations.
109 It is required for supporting the theory of floating-point numbers and can be
110 downloaded and built automatically.
111
112
113 Optional Dependencies
114 ---------------------
115
116
117 CryptoMiniSat (Optional SAT solver)
118 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119
120 `CryptoMinisat <https://github.com/msoos/cryptominisat>`_ is a SAT solver that
121 can be used for solving bit-vector problems with eager bit-blasting. This
122 dependency may improve performance. It can be downloaded and built
123 automatically. Configure cvc5 with ``configure.sh --cryptominisat`` to build
124 with this dependency.
125
126
127 Kissat (Optional SAT solver)
128 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129
130 `Kissat <https://github.com/arminbiere/kissat>`_ is a SAT solver that can be
131 used for solving bit-vector problems with eager bit-blasting. This dependency
132 may improve performance. It can be downloaded and built automatically. Configure
133 cvc5 with ``configure.sh --kissat`` to build with this dependency.
134
135
136 LibPoly (Optional polynomial library)
137 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138
139 `LibPoly <https://github.com/SRI-CSL/libpoly>`_ is required for CAD-based
140 nonlinear reasoning. It can be downloaded and built automatically. Configure
141 cvc5 with ``configure.sh --poly`` to build with this dependency.
142
143
144 CLN >= v1.3 (Class Library for Numbers)
145 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146
147 `CLN <http://www.ginac.de/CLN>`_ is an alternative multiprecision arithmetic
148 package that may offer better performance and memory footprint than GMP.
149 Configure cvc5 with ``configure.sh --cln`` to build with this dependency.
150
151 Note that CLN is covered by the `GNU General Public License, version 3
152 <https://www.gnu.org/licenses/gpl-3.0.en.html>`_. If you choose to use cvc5 with
153 CLN support, you are licensing cvc5 under that same license. (Usually cvc5's
154 license is more permissive than GPL, see the file `COPYING` in the cvc5 source
155 distribution for details.)
156
157
158 glpk-cut-log (A fork of the GNU Linear Programming Kit)
159 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
160
161 `glpk-cut-log <https://github.com/timothy-king/glpk-cut-log/>`_ is a fork of
162 `GLPK <http://www.gnu.org/software/glpk/>`_ (the GNU Linear Programming Kit).
163 This can be used to speed up certain classes of problems for the arithmetic
164 implementation in cvc5. (This is not recommended for most users.)
165
166 glpk-cut-log can be installed using the ``contrib/get-glpk-cut-log`` script.
167 Note that the only installation option is manual installation via this script.
168 cvc5 is no longer compatible with the main GLPK library. Configure cvc5 with
169 ``configure.sh --glpk`` to build with this dependency.
170
171 Note that GLPK and glpk-cut-log are covered by the `GNU General Public License,
172 version 3 <https://www.gnu.org/licenses/gpl-3.0.en.html>`_. If you choose to use
173 cvc5 with GLPK support, you are licensing cvc5 under that same license. (Usually
174 cvc5's license is more permissive; see above discussion.)
175
176
177 Editline library (Improved Interactive Experience)
178 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
179
180 The `Editline Library <https://thrysoee.dk/editline/>`_ library is optionally
181 used to provide command editing, tab completion, and history functionality at
182 the cvc5 prompt (when running in interactive mode). Check your distribution for
183 a package named "libedit-dev" or "libedit-devel" or similar.
184
185
186 Google Test Unit Testing Framework (Unit Tests)
187 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
188
189 `Google Test <https://github.com/google/googletest>`_ is required to optionally
190 run cvc5's unit tests (included with the distribution). See :ref:`Testing cvc5
191 <testing-cvc5>` below for more details.
192
193
194 Language bindings
195 -----------------
196
197 cvc5 provides a complete and flexible C++ API (see ``examples/api`` for
198 examples). It further provides Java (see ``examples/SimpleVC.java`` and
199 ``examples/api/java``) and Python (see ``examples/api/python``) API bindings.
200
201 Configure cvc5 with ``configure.sh --<lang>-bindings`` to build with language
202 bindings for ``<lang>``.
203
204
205 Dependencies for Language Bindings
206 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
207
208 - Python
209
210 - `Cython <https://cython.org/>`_
211 - `scikit-build <https://pypi.org/project/scikit-build/>`_
212 - `pytest <https://docs.pytest.org/en/6.2.x/>`_
213
214 If you're interested in helping to develop, maintain, and test a language
215 binding, please contact the cvc5 team via `our issue tracker
216 <https://github.com/cvc5/cvc5/issues>`_.
217
218
219 Building the API Documentation
220 ------------------------------
221
222 Building the API documentation of cvc5 requires the following dependencies:
223
224 - `Doxygen <https://www.doxygen.nl>`_
225 - `Sphinx <https://www.sphinx-doc.org>`_,
226 `sphinx-rtd-theme <https://sphinx-rtd-theme.readthedocs.io/>`_,
227 `sphinx-tabs <https://sphinx-tabs.readthedocs.io/>`_,
228 `sphinxcontrib-bibtex <https://sphinxcontrib-bibtex.readthedocs.io>`_,
229 `sphinxcontrib-programoutput <https://sphinxcontrib-programoutput.readthedocs.io>`_
230 - `Breathe <https://breathe.readthedocs.io>`_
231
232 To build the documentation, configure cvc5 with ``./configure.sh --docs`` and
233 run ``make docs`` from within the build directory.
234
235 The API documentation can then be found at
236 ``<build_dir>/docs/sphinx/index.html``.
237
238 To build the documentation for GitHub pages, change to the build directory and
239 call ``make docs-gh``. The content of directory ``<build_dir>/docs/sphinx-gh``
240 can then be copied over to GitHub pages.
241
242
243 Building the Examples
244 ---------------------
245
246 See ``examples/README.md`` for instructions on how to build and run the
247 examples.
248
249
250 .. _testing-cvc5:
251
252 Testing cvc5
253 ------------
254
255 We use ``ctest`` as test infrastructure. For all command-line options of ctest,
256 see ``ctest -h``. Some useful options are:
257
258 .. code::
259
260 ctest -R <regex> # run all tests with names matching <regex>
261 ctest -E <regex> # exclude tests with names matching <regex>
262 ctest -L <regex> # run all tests with labels matching <regex>
263 ctest -LE <regex> # exclude tests with labels matching <regex>
264 ctest # run all tests
265 ctest -jN # run all tests in parallel with N threads
266 ctest --output-on-failure # run all tests and print output of failed tests
267
268 We have 4 categories of tests:
269
270 - **examples** in directory ``examples`` (label: **example**)
271 - **regression tests** (5 levels) in directory ``test/regress`` (label:
272 **regressN** with N the regression level)
273 - **api tests** in directory ``test/api`` (label: **api**)
274 - **unit tests** in directory ``test/unit`` (label: **unit**)
275
276
277 Testing System Tests
278 ^^^^^^^^^^^^^^^^^^^^
279
280 The system tests are not built by default.
281
282 .. code::
283
284 make apitests # build and run all system tests
285 make <api_test> # build test/system/<system_test>.<ext>
286 ctest api/<api_test> # run test/system/<system_test>.<ext>
287
288 All system test binaries are built into ``<build_dir>/bin/test/system``.
289
290 We use prefix ``api/`` + ``<api_test>`` (for ``<api_test>`` in ``test/api``)
291 as test target name.
292
293 .. code::
294
295 make ouroborous # build test/api/ouroborous.cpp
296 ctest -R ouroborous # run all tests that match '*ouroborous*'
297 # > runs api/ouroborous
298 ctest -R ouroborous$ # run all tests that match '*ouroborous'
299 # > runs api/ouroborous
300 ctest -R api/ouroborous$ # run all tests that match '*api/ouroborous'
301 # > runs api/ouroborous
302
303
304 Testing Unit Tests
305 ^^^^^^^^^^^^^^^^^^
306
307 The unit tests are not built by default.
308
309 Note that cvc5 can only be configured with unit tests in non-static builds with
310 assertions enabled.
311
312 .. code::
313
314 make units # build and run all unit tests
315 make <unit_test> # build test/unit/<subdir>/<unit_test>.<ext>
316 ctest unit/<subdir>/<unit_test> # run test/unit/<subdir>/<unit_test>.<ext>
317
318 All unit test binaries are built into ``<build_dir>/bin/test/unit``.
319
320 We use prefix ``unit/`` + ``<subdir>/`` + ``<unit_test>`` (for ``<unit_test>``
321 in ``test/unit/<subdir>``) as test target name.
322
323 .. code::
324
325 make map_util_black # build test/unit/base/map_util_black.cpp
326 ctest -R map_util_black # run all tests that match '*map_util_black*'
327 # > runs unit/base/map_util_black
328 ctest -R base/map_util_black$ # run all tests that match '*base/map_util_black'
329 # > runs unit/base/map_util_black
330 ctest -R unit/base/map_util_black$ # run all tests that match '*unit/base/map_util_black'
331 # > runs unit/base/map_util_black
332
333
334 Testing Regression Tests
335 ^^^^^^^^^^^^^^^^^^^^^^^^
336
337 We use prefix ``regressN/`` + ``<subdir>/`` + ``<regress_test>`` (for
338 ``<regress_test>`` in level ``N`` in ``test/regress/regressN/<subdir>``) as test
339 target name.
340
341 .. code::
342
343 ctest -L regress # run all regression tests
344 ctest -L regress0 # run all regression tests in level 0
345 ctest -L regress[0-1] # run all regression tests in level 0 and 1
346 ctest -R regress # run all regression tests
347 ctest -R regress0 # run all regression tests in level 0
348 ctest -R regress[0-1] # run all regression tests in level 0 and 1
349 ctest -R regress0/bug288b # run all tests that match '*regress0/bug288b*'
350 # > runs regress0/bug288b
351
352
353 Custom Targets
354 ^^^^^^^^^^^^^^
355
356 All custom test targets build and run a preconfigured set of tests.
357
358 - ``make check [-jN] [ARGS=-jN]``
359 The default build-and-test target for cvc5, builds and runs all examples,
360 all system and unit tests, and regression tests from levels 0 to 2.
361
362 - ``make systemtests [-jN] [ARGS=-jN]``
363 Build and run all system tests.
364
365 - ``make units [-jN] [ARGS=-jN]``
366 Build and run all unit tests.
367
368 - ``make regress [-jN] [ARGS=-jN]``
369 Build and run regression tests from levels 0 to 2.
370
371 - ``make runexamples [-jN] [ARGS=-jN]``
372 Build and run all examples.
373
374 - ``make coverage-test [-jN] [ARGS=-jN]``
375 Build and run all tests (system and unit tests, regression tests level 0-4)
376 with gcov to determine code coverage.
377
378 We use ``ctest`` as test infrastructure, and by default all test targets
379 are configured to **run** in parallel with the maximum number of threads
380 available on the system. Override with ``ARGS=-jN``.
381
382 Use ``-jN`` for parallel **building** with ``N`` threads.
383
384
385 Recompiling a specific cvc5 version with different LGPL library versions
386 ------------------------------------------------------------------------
387
388 To recompile a specific static binary of cvc5 with different versions of the
389 linked LGPL libraries perform the following steps:
390
391 1. Make sure that you have installed the desired LGPL library versions.
392 You can check the versions found by cvc5's build system during the configure
393 phase.
394
395 2. Determine the commit sha and configuration of the cvc5 binary
396
397 .. code::
398
399 cvc5 --show-config
400
401 3. Download the specific source code version:
402
403 .. code::
404
405 wget https://github.com/cvc5/cvc5/archive/<commit-sha>.tar.gz
406
407 4. Extract the source code
408
409 .. code::
410
411 tar xf <commit-sha>.tar.gz
412
413 5. Change into source code directory
414
415 .. code::
416
417 cd cvc5-<commit-sha>
418
419 6. Configure cvc5 with options listed by ``cvc5 --show-config``
420
421 .. code::
422
423 ./configure.sh --static <options>
424
425 7. Follow remaining steps from `build instructions <#building-cvc5>`_