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

Crash when running example.ml (Ocaml) #5517

Closed
bleepbloopsify opened this issue Aug 29, 2021 · 9 comments
Closed

Crash when running example.ml (Ocaml) #5517

bleepbloopsify opened this issue Aug 29, 2021 · 9 comments

Comments

@bleepbloopsify
Copy link

bleepbloopsify commented Aug 29, 2021

I currently have z3.4.8.11 installed, and when running the example, I get this error:

libc++abi: terminating with uncaught exception of type is_non_propositional_predicate::found

We are building with dune:

(executable
 (name example)
 (libraries z3))

and running using

dune exec ./example.exe

the directory looks like this:

dune
example.ml

where example.ml is this file: https://github.com/Z3Prover/z3/blob/master/examples/ml/ml_example.ml

Note:
I am on macOS Big Sur (11.5.2)

@NikolajBjorner
Copy link
Contributor

I can't address bugs in downstream versions of z3

@k4rtik
Copy link
Contributor

k4rtik commented Sep 24, 2021

Hi @NikolajBjorner

I tried the OCaml example using the latest Z3 and get the same error:

$ ocamlfind ocamlopt -o example -thread -package Z3 -linkpkg example.ml
ld: warning: directory not found for option '-L/opt/local/lib'
$ ./example
libc++abi: terminating with uncaught exception of type is_non_propositional_predicate::found
Abort trap: 6
$ z3 --version
Z3 version 4.8.13 - 64 bit

Do you think the ld warning is worth investigating?

@k4rtik
Copy link
Contributor

k4rtik commented Sep 24, 2021

For reference, I built z3 this way, following the build and install instructions in the opam file for 4.8.11 by @c-cube:

$ python scripts/mk_make.py --ml --staticlib
$ cd build; make -j8
$ ocamlfind install  z3 api/ml/* libz3-static.a
[...]
ocamlfind: [WARNING] You have installed DLLs but the directory /Users/kartik/.opam/4.12.0/lib/stublibs is not mentioned in ld.conf
[...]
$ cp z3 /Users/kartik/.opam/4.12.0/bin/

There was an issue earlier with libstdc++.so which @ivg had resolved, so I am cc'ing him in this conversation.

@ivg
Copy link
Contributor

ivg commented Sep 24, 2021

Do you think the ld warning is worth investigating?

To my opinion it is irrelevant. It is just saying that there was no such folder. The package is linked statically, and there are no extra dependencies, and it loads without any linker errors, so it looks good to me.

And the message is likely coming from the C++ to C boundary from an escaping exception. Have you tried this example on a Linux machine?

@ivg
Copy link
Contributor

ivg commented Sep 24, 2021

For your information, I tried this on a Linux machine and an old version of z3 (4.8.9) and the example works perfectly fine.

@k4rtik
Copy link
Contributor

k4rtik commented Sep 24, 2021

I will try on Linux later today, but this is certainly an issue on Mac as reported by OP and confirmed with my report.

@k4rtik
Copy link
Contributor

k4rtik commented Sep 24, 2021

So I may be doing something really stupid, but I can't seem to get ocamlfind to recognize that z3 is installed (using 'opam install') on Linux:

$ ocamlfind ocamlopt -o ml_example -thread -package Z3 -linkpkg ml_example.ml
ocamlfind: Package `Z3' not found

opam list says:

[...]
z3                    4.8.11      Z3 solver
[...]

@aytey
Copy link
Contributor

aytey commented Sep 24, 2021

Z3 vs. z3?

@k4rtik
Copy link
Contributor

k4rtik commented Sep 25, 2021

Wow, indeed that fixed it on Linux, but the official example at https://github.com/Z3Prover/z3/blob/master/examples/ml/README does have what I wrote above. While both -package Z3 and -package z3 works fine on macOS (except for the crash reported above).

Perhaps, the example doc needs to be fixed.

@ivg answered it here: https://stackoverflow.com/a/50004273/1167061

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants