fix incorrect 64-bit detection -- powerpc64le doesn't end in 64 but is 64-bit (#8955)
[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).
191 See `Testing cvc5 <#testing-cvc5>`_
192 below for more details.
193
194
195 Language bindings
196 -----------------
197
198 cvc5 provides a complete and flexible C++ API (see ``examples/api`` for
199 examples). It further provides Java (see ``examples/SimpleVC.java`` and
200 ``examples/api/java``) and Python (see ``examples/api/python``) API bindings.
201
202 Configure cvc5 with ``configure.sh --<lang>-bindings`` to build with language
203 bindings for ``<lang>``.
204
205
206 Dependencies for Language Bindings
207 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
208
209 - Python
210
211 - `Cython <https://cython.org/>`_
212 - `scikit-build <https://pypi.org/project/scikit-build/>`_
213 - `pytest <https://docs.pytest.org/en/6.2.x/>`_
214
215 If you're interested in helping to develop, maintain, and test a language
216 binding, please contact the cvc5 team via `our issue tracker
217 <https://github.com/cvc5/cvc5/issues>`_.
218
219
220 Building the API Documentation
221 ------------------------------
222
223 Building the API documentation of cvc5 requires the following dependencies:
224
225 - `Doxygen <https://www.doxygen.nl>`_
226 - `Sphinx <https://www.sphinx-doc.org>`_,
227 `sphinx-rtd-theme <https://sphinx-rtd-theme.readthedocs.io/>`_,
228 `sphinx-tabs <https://sphinx-tabs.readthedocs.io/>`_,
229 `sphinxcontrib-bibtex <https://sphinxcontrib-bibtex.readthedocs.io>`_,
230 `sphinxcontrib-programoutput <https://sphinxcontrib-programoutput.readthedocs.io>`_
231 - `Breathe <https://breathe.readthedocs.io>`_
232
233 To build the documentation, configure cvc5 with ``./configure.sh --docs`` and
234 run ``make docs`` from within the build directory.
235
236 The API documentation can then be found at
237 ``<build_dir>/docs/sphinx/index.html``.
238
239 To build the documentation for GitHub pages, change to the build directory and
240 call ``make docs-gh``. The content of directory ``<build_dir>/docs/sphinx-gh``
241 can then be copied over to GitHub pages.
242
243
244 Building the Examples
245 ---------------------
246
247 See ``examples/README.md`` for instructions on how to build and run the
248 examples.
249
250
251 .. _testing-cvc5:
252
253 Testing cvc5
254 ------------
255
256 We use ``ctest`` as test infrastructure. For all command-line options of ctest,
257 see ``ctest -h``. Some useful options are:
258
259 .. code::
260
261 ctest -R <regex> # run all tests with names matching <regex>
262 ctest -E <regex> # exclude tests with names matching <regex>
263 ctest -L <regex> # run all tests with labels matching <regex>
264 ctest -LE <regex> # exclude tests with labels matching <regex>
265 ctest # run all tests
266 ctest -jN # run all tests in parallel with N threads
267 ctest --output-on-failure # run all tests and print output of failed tests
268
269 We have 4 categories of tests:
270
271 - **examples** in directory ``examples`` (label: **example**)
272 - **regression tests** (5 levels) in directory ``test/regress`` (label:
273 **regressN** with N the regression level)
274 - **api tests** in directory ``test/api`` (label: **api**)
275 - **unit tests** in directory ``test/unit`` (label: **unit**)
276
277
278 Testing System Tests
279 ^^^^^^^^^^^^^^^^^^^^
280
281 The system tests are not built by default.
282
283 .. code::
284
285 make apitests # build and run all system tests
286 make <api_test> # build test/system/<system_test>.<ext>
287 ctest api/<api_test> # run test/system/<system_test>.<ext>
288
289 All system test binaries are built into ``<build_dir>/bin/test/system``.
290
291 We use prefix ``api/`` + ``<api_test>`` (for ``<api_test>`` in ``test/api``)
292 as test target name.
293
294 .. code::
295
296 make ouroborous # build test/api/ouroborous.cpp
297 ctest -R ouroborous # run all tests that match '*ouroborous*'
298 # > runs api/ouroborous
299 ctest -R ouroborous$ # run all tests that match '*ouroborous'
300 # > runs api/ouroborous
301 ctest -R api/ouroborous$ # run all tests that match '*api/ouroborous'
302 # > runs api/ouroborous
303
304
305 Testing Unit Tests
306 ^^^^^^^^^^^^^^^^^^
307
308 The unit tests are not built by default.
309
310 Note that cvc5 can only be configured with unit tests in non-static builds with
311 assertions enabled.
312
313 .. code::
314
315 make units # build and run all unit tests
316 make <unit_test> # build test/unit/<subdir>/<unit_test>.<ext>
317 ctest unit/<subdir>/<unit_test> # run test/unit/<subdir>/<unit_test>.<ext>
318
319 All unit test binaries are built into ``<build_dir>/bin/test/unit``.
320
321 We use prefix ``unit/`` + ``<subdir>/`` + ``<unit_test>`` (for ``<unit_test>``
322 in ``test/unit/<subdir>``) as test target name.
323
324 .. code::
325
326 make map_util_black # build test/unit/base/map_util_black.cpp
327 ctest -R map_util_black # run all tests that match '*map_util_black*'
328 # > runs unit/base/map_util_black
329 ctest -R base/map_util_black$ # run all tests that match '*base/map_util_black'
330 # > runs unit/base/map_util_black
331 ctest -R unit/base/map_util_black$ # run all tests that match '*unit/base/map_util_black'
332 # > runs unit/base/map_util_black
333
334
335 Testing Regression Tests
336 ^^^^^^^^^^^^^^^^^^^^^^^^
337
338 We use prefix ``regressN/`` + ``<subdir>/`` + ``<regress_test>`` (for
339 ``<regress_test>`` in level ``N`` in ``test/regress/regressN/<subdir>``) as test
340 target name.
341
342 .. code::
343
344 ctest -L regress # run all regression tests
345 ctest -L regress0 # run all regression tests in level 0
346 ctest -L regress[0-1] # run all regression tests in level 0 and 1
347 ctest -R regress # run all regression tests
348 ctest -R regress0 # run all regression tests in level 0
349 ctest -R regress[0-1] # run all regression tests in level 0 and 1
350 ctest -R regress0/bug288b # run all tests that match '*regress0/bug288b*'
351 # > runs regress0/bug288b
352
353
354 Custom Targets
355 ^^^^^^^^^^^^^^
356
357 All custom test targets build and run a preconfigured set of tests.
358
359 - ``make check [-jN] [ARGS=-jN]``
360 The default build-and-test target for cvc5, builds and runs all examples,
361 all system and unit tests, and regression tests from levels 0 to 2.
362
363 - ``make systemtests [-jN] [ARGS=-jN]``
364 Build and run all system tests.
365
366 - ``make units [-jN] [ARGS=-jN]``
367 Build and run all unit tests.
368
369 - ``make regress [-jN] [ARGS=-jN]``
370 Build and run regression tests from levels 0 to 2.
371
372 - ``make runexamples [-jN] [ARGS=-jN]``
373 Build and run all examples.
374
375 - ``make coverage-test [-jN] [ARGS=-jN]``
376 Build and run all tests (system and unit tests, regression tests level 0-4)
377 with gcov to determine code coverage.
378
379 We use ``ctest`` as test infrastructure, and by default all test targets
380 are configured to **run** in parallel with the maximum number of threads
381 available on the system. Override with ``ARGS=-jN``.
382
383 Use ``-jN`` for parallel **building** with ``N`` threads.
384
385
386 Recompiling a specific cvc5 version with different LGPL library versions
387 ------------------------------------------------------------------------
388
389 To recompile a specific static binary of cvc5 with different versions of the
390 linked LGPL libraries perform the following steps:
391
392 1. Make sure that you have installed the desired LGPL library versions.
393 You can check the versions found by cvc5's build system during the configure
394 phase.
395
396 2. Determine the commit sha and configuration of the cvc5 binary
397
398 .. code::
399
400 cvc5 --show-config
401
402 3. Download the specific source code version:
403
404 .. code::
405
406 wget https://github.com/cvc5/cvc5/archive/<commit-sha>.tar.gz
407
408 4. Extract the source code
409
410 .. code::
411
412 tar xf <commit-sha>.tar.gz
413
414 5. Change into source code directory
415
416 .. code::
417
418 cd cvc5-<commit-sha>
419
420 6. Configure cvc5 with options listed by ``cvc5 --show-config``
421
422 .. code::
423
424 ./configure.sh --static <options>
425
426 7. Follow remaining steps from `build instructions <#building-cvc5>`_