[Win64] Link LibPoly statically for static builds (#7891)
[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-tabs <https://sphinx-tabs.readthedocs.io/>`_,
227 `sphinxcontrib-bibtex <https://sphinxcontrib-bibtex.readthedocs.io>`_
228 - `Breathe <https://breathe.readthedocs.io>`_
229
230 To build the documentation, configure cvc5 with ``./configure.sh --docs`` and
231 run ``make docs`` from within the build directory.
232
233 The API documentation can then be found at
234 ``<build_dir>/docs/sphinx/index.html``.
235
236 To build the documentation for GitHub pages, change to the build directory and
237 call ``make docs-gh``. The content of directory ``<build_dir>/docs/sphinx-gh``
238 can then be copied over to GitHub pages.
239
240
241 Building the Examples
242 ---------------------
243
244 See ``examples/README.md`` for instructions on how to build and run the
245 examples.
246
247
248 .. _testing-cvc5:
249
250 Testing cvc5
251 ------------
252
253 We use ``ctest`` as test infrastructure. For all command-line options of ctest,
254 see ``ctest -h``. Some useful options are:
255
256 .. code::
257
258 ctest -R <regex> # run all tests with names matching <regex>
259 ctest -E <regex> # exclude tests with names matching <regex>
260 ctest -L <regex> # run all tests with labels matching <regex>
261 ctest -LE <regex> # exclude tests with labels matching <regex>
262 ctest # run all tests
263 ctest -jN # run all tests in parallel with N threads
264 ctest --output-on-failure # run all tests and print output of failed tests
265
266 We have 4 categories of tests:
267
268 - **examples** in directory ``examples`` (label: **example**)
269 - **regression tests** (5 levels) in directory ``test/regress`` (label:
270 **regressN** with N the regression level)
271 - **api tests** in directory ``test/api`` (label: **api**)
272 - **unit tests** in directory ``test/unit`` (label: **unit**)
273
274
275 Testing System Tests
276 ^^^^^^^^^^^^^^^^^^^^
277
278 The system tests are not built by default.
279
280 .. code::
281
282 make apitests # build and run all system tests
283 make <api_test> # build test/system/<system_test>.<ext>
284 ctest api/<api_test> # run test/system/<system_test>.<ext>
285
286 All system test binaries are built into ``<build_dir>/bin/test/system``.
287
288 We use prefix ``api/`` + ``<api_test>`` (for ``<api_test>`` in ``test/api``)
289 as test target name.
290
291 .. code::
292
293 make ouroborous # build test/api/ouroborous.cpp
294 ctest -R ouroborous # run all tests that match '*ouroborous*'
295 # > runs api/ouroborous
296 ctest -R ouroborous$ # run all tests that match '*ouroborous'
297 # > runs api/ouroborous
298 ctest -R api/ouroborous$ # run all tests that match '*api/ouroborous'
299 # > runs api/ouroborous
300
301
302 Testing Unit Tests
303 ^^^^^^^^^^^^^^^^^^
304
305 The unit tests are not built by default.
306
307 Note that cvc5 can only be configured with unit tests in non-static builds with
308 assertions enabled.
309
310 .. code::
311
312 make units # build and run all unit tests
313 make <unit_test> # build test/unit/<subdir>/<unit_test>.<ext>
314 ctest unit/<subdir>/<unit_test> # run test/unit/<subdir>/<unit_test>.<ext>
315
316 All unit test binaries are built into ``<build_dir>/bin/test/unit``.
317
318 We use prefix ``unit/`` + ``<subdir>/`` + ``<unit_test>`` (for ``<unit_test>``
319 in ``test/unit/<subdir>``) as test target name.
320
321 .. code::
322
323 make map_util_black # build test/unit/base/map_util_black.cpp
324 ctest -R map_util_black # run all tests that match '*map_util_black*'
325 # > runs unit/base/map_util_black
326 ctest -R base/map_util_black$ # run all tests that match '*base/map_util_black'
327 # > runs unit/base/map_util_black
328 ctest -R unit/base/map_util_black$ # run all tests that match '*unit/base/map_util_black'
329 # > runs unit/base/map_util_black
330
331
332 Testing Regression Tests
333 ^^^^^^^^^^^^^^^^^^^^^^^^
334
335 We use prefix ``regressN/`` + ``<subdir>/`` + ``<regress_test>`` (for
336 ``<regress_test>`` in level ``N`` in ``test/regress/regressN/<subdir>``) as test
337 target name.
338
339 .. code::
340
341 ctest -L regress # run all regression tests
342 ctest -L regress0 # run all regression tests in level 0
343 ctest -L regress[0-1] # run all regression tests in level 0 and 1
344 ctest -R regress # run all regression tests
345 ctest -R regress0 # run all regression tests in level 0
346 ctest -R regress[0-1] # run all regression tests in level 0 and 1
347 ctest -R regress0/bug288b # run all tests that match '*regress0/bug288b*'
348 # > runs regress0/bug288b
349
350
351 Custom Targets
352 ^^^^^^^^^^^^^^
353
354 All custom test targets build and run a preconfigured set of tests.
355
356 - ``make check [-jN] [ARGS=-jN]``
357 The default build-and-test target for cvc5, builds and runs all examples,
358 all system and unit tests, and regression tests from levels 0 to 2.
359
360 - ``make systemtests [-jN] [ARGS=-jN]``
361 Build and run all system tests.
362
363 - ``make units [-jN] [ARGS=-jN]``
364 Build and run all unit tests.
365
366 - ``make regress [-jN] [ARGS=-jN]``
367 Build and run regression tests from levels 0 to 2.
368
369 - ``make runexamples [-jN] [ARGS=-jN]``
370 Build and run all examples.
371
372 - ``make coverage-test [-jN] [ARGS=-jN]``
373 Build and run all tests (system and unit tests, regression tests level 0-4)
374 with gcov to determine code coverage.
375
376 We use ``ctest`` as test infrastructure, and by default all test targets
377 are configured to **run** in parallel with the maximum number of threads
378 available on the system. Override with ``ARGS=-jN``.
379
380 Use ``-jN`` for parallel **building** with ``N`` threads.
381
382
383 Recompiling a specific cvc5 version with different LGPL library versions
384 ------------------------------------------------------------------------
385
386 To recompile a specific static binary of cvc5 with different versions of the
387 linked LGPL libraries perform the following steps:
388
389 1. Make sure that you have installed the desired LGPL library versions.
390 You can check the versions found by cvc5's build system during the configure
391 phase.
392
393 2. Determine the commit sha and configuration of the cvc5 binary
394
395 .. code::
396
397 cvc5 --show-config
398
399 3. Download the specific source code version:
400
401 .. code::
402
403 wget https://github.com/cvc5/cvc5/archive/<commit-sha>.tar.gz
404
405 4. Extract the source code
406
407 .. code::
408
409 tar xf <commit-sha>.tar.gz
410
411 5. Change into source code directory
412
413 .. code::
414
415 cd cvc5-<commit-sha>
416
417 6. Configure cvc5 with options listed by ``cvc5 --show-config``
418
419 .. code::
420
421 ./configure.sh --static <options>
422
423 7. Follow remaining steps from `build instructions <#building-cvc5>`_