0

I am trying to use Z3 in OCaml in VSCode (Mac).

To make use of it, I wrote the following code: open Z3 but it has raised me the following error: Unbound module Z3 Merlin So I understand Z3 is not installed.

However, I have just run: opam install z3, so it should work.

I also realized that open Num is working, so maybe it has to do with having an old version of OCaml (since Num is now deprecated).

Any help?


EDIT:

I just discovered Z3 has not been correctly installed in the opam install z3 part. This is the message that has thrown:

[ERROR] The compilation of z3 failed at
        "/Users/.../.opam/opam-init/hooks/sandbox.sh build make -C
        build -j 3".

#=== ERROR while compiling z3.4.8.9-1 =========================================#
# context     2.0.8 | macos/x86_64 | ocaml-base-compiler.4.10.2 | https://opam.ocaml.org#ff95b837
# path        ~/.opam/4.10.2/.opam-switch/build/z3.4.8.9-1
# command     ~/.opam/opam-init/hooks/sandbox.sh build make -C build -j 3
# exit-code   2
# env-file    ~/.opam/log/z3-21131-e7966f.env
# output-file ~/.opam/log/z3-21131-e7966f.out
### output ###
# /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:641:18: error: no template named 'numeric_limits'
# [...]
#                  ^
# /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:641:50: error: no template named 'numeric_limits'
#     int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
#                                                  ^
# /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:646:17: error: no template named 'numeric_limits'
#   static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
#                 ^
# fatal error: too many errors emitted, stopping now [-ferror-limit=]
# 20 errors generated.
# make: *** [util/luby.o] Error 1
# make: *** Waiting for unfinished jobs....



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>   
┌─ The following actions failed
│ λ build z3 4.8.9-1

It is giving me an error related to Xcode...

I guess correcting this will yield correcting the original unbound module error. Is that the case? Any help with this?

Chris
  • 26,361
  • 5
  • 21
  • 42
Theo Deep
  • 666
  • 4
  • 15
  • 1
    From what I see I can tell that your version of C++ compiler is very old, so you need to upgrade it, either via upgrading your OS or installing a newer compiler from some third-party package managers. To be honest, I myself can't install z3 on my macOS machine, because of a very old version of macOS. It could be that an easier option would be running a linux virtual machine. – ivg Nov 09 '21 at 20:46
  • 1
    Are you sure this is related to z3? Seems to me like compilation is failing for some other part of the tool-chain. (Perhaps triggered from z3, but doesn't seem to be directly related to z3 sources itself.) – alias Nov 09 '21 at 21:02
  • 1
    As an idea: See if you can remove the Visual-Studio part from your environment. i.e., try to see if you can install the regular O'Caml bindings for z3 to be used directly from the command line. Once that is done, you can investigate the Visual-Studio part. (My guess is that this failure is directly related to the Visual-Studio bits.) – alias Nov 09 '21 at 21:04
  • 1
    Thank you both, I will try to fix it! – Theo Deep Nov 09 '21 at 21:21

0 Answers0