Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Z3 an optional dependency #223

Merged
merged 7 commits into from
Mar 9, 2022
Merged

Conversation

AltGr
Copy link
Contributor

@AltGr AltGr commented Mar 8, 2022

If Catala is compiled without Z3, trying to run it with the backend Proof
will yield:

[ERROR] This instance of Catala was compiled without Z3 support.

and return 124

Note that this doesn't change the make depends, opam file or CI to account
for it, it just enables it at the build-system level.

There are also no hooks at this moment to have Catala self-document the
options whith which it was compiled (e.g. in the --help screen). But that
could be added in a more general way later, it's probably not really needed
yet.

If Catala is compiled without Z3, trying to run it with the backend `Proof` will
yield:
```
[ERROR] This instance of Catala was compiled without Z3 support.
```
and return 124

Note that this doesn't change the `make depends`, opam file or CI to account for it,
it just enables it at the build-system level.

There are also no hooks at this moment to have Catala self-document the options
whith which it was compiled (e.g. in the `--help` screen). But that could be
added in a more general way later, it's probably not really needed yet.
Copy link
Contributor

@denismerigoux denismerigoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Altough I would prefer if you didn't rename the z3backend.ml into the z3backend.real.ml, the "realness" is implicit enough I guess.

Also could you provide some documentation about what dune command to run? Maybe create a new target in the top-level Makefile ?

@AltGr
Copy link
Contributor Author

AltGr commented Mar 9, 2022

Altough I would prefer if you didn't rename the z3backend.ml into the z3backend.real.ml, the "realness" is implicit enough I guess.

It's exactly what I tried to do at first… but dune enforces it unfortunately 🤷

Also could you provide some documentation about what dune command to run? Maybe create a new target in the top-level Makefile ?

well it's not changed, just running make build will work as before, but if z3 wasn't installed you will still be able to compile. Or did you mean something like a make depends-except-z3 target ?

@denismerigoux
Copy link
Contributor

Yeah an explicit make depends-except-z3 would be perfect.

@denismerigoux
Copy link
Contributor

BTW this should also fix #207, you might want to use the make depends-except-z3 to build the JS executable of the compiler.

Also the CI will no longer compile/use z3
@AltGr
Copy link
Contributor Author

AltGr commented Mar 9, 2022

hm wait the CI still installs z3

and adapt the CI to skip z3 installation.

Is it more usual for `all` targets to build everything but not include
dependencies handling ?
@denismerigoux denismerigoux added ✨ enhancement New feature or request 🏗️ build system Build system or Makefile labels Mar 9, 2022
(select
z3backend.ml
from
(z3 -> z3backend.real.ml)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you here make the case disjunction based on the fact that the user has passed a particular compilation flag or profile?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum reading https://dune.readthedocs.io/en/stable/concepts.html#alternative-dependencies it looks like you can't. But OK I thinking about it I quite like this behaviour : by default Catala does not come with the proof platform unless you have specifically installed z3 to enable it. Looks good to me!

@denismerigoux
Copy link
Contributor

So there are two types of CI: run-make-all.yml is executed on stateful CI managed by Inria on which z3 has been preinstalled. run-build.yml in run on GitHub runners that build everything from scratch at each CI run.

(select
z3backend.ml
from
(z3 -> z3backend.real.ml)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum reading https://dune.readthedocs.io/en/stable/concepts.html#alternative-dependencies it looks like you can't. But OK I thinking about it I quite like this behaviour : by default Catala does not come with the proof platform unless you have specifically installed z3 to enable it. Looks good to me!

Makefile Outdated
@@ -15,15 +15,20 @@ K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(warning [WARNING] No "$(exec)" executable found. \
Please install this executable for everything to work smoothly)))

dependencies-ocaml:
dependencies-ocaml-noz3:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK thinking about it the default should not include z3 and the special target should be dependencies-ocaml-with-z3:)

@denismerigoux denismerigoux merged commit 6227097 into CatalaLang:master Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏗️ build system Build system or Makefile ✨ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants