ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.62k stars 401 forks source link

Dune Developer Preview (Sept-28-2024) fails to build z3 #10970

Open cogumbreiro opened 1 week ago

cogumbreiro commented 1 week ago

Expected Behavior

I would like to migrate my project to Dune developer preview.

Actual Behavior

dune build is unable to compile the package z3. See point 4 below for output.

Reproduction

1. Create a new project ``` $ dune init proj hello_world $ cd hello_world ```
2. Change the dependency section of `dune-project` and add `z3`. ``` (depends ocaml dune (z3 (>= 4.13.0)) ) ```
3. Update `bin/dune` to include `z3` in the libraries section ``` (executable (public_name hello_world) (name main) (libraries hello_world z3)) ```
4. `dune build` fails in a Python script. ``` $ dune build Building z3.4.13.0-3 File "dune.lock/z3.pkg", line 11, characters 7-14: 11 | (run python3 scripts/mk_make.py --ml) ^^^^^^^ Error: Logs for package z3 Traceback (most recent call last): File "/home/tiago/Work/hello_world/_build/.sandbox/f902b8116518b10f30ed7475b3b5c86b/_private/default/.pkg/z3/source/scripts/mk_make.py", line 21, in mk_makefile() File "/home/tiago/Work/hello_world/_build/.sandbox/f902b8116518b10f30ed7475b3b5c86b/_private/default/.pkg/z3/source/scripts/mk_util.py", line 2809, in mk_makefile mk_install(out) File "/home/tiago/Work/hello_world/_build/.sandbox/f902b8116518b10f30ed7475b3b5c86b/_private/default/.pkg/z3/source/scripts/mk_util.py", line 2764, in mk_install c.mk_install(out) File "/home/tiago/Work/hello_world/_build/.sandbox/f902b8116518b10f30ed7475b3b5c86b/_private/default/.pkg/z3/source/scripts/mk_util.py", line 2121, in mk_install self._init_ocamlfind_paths() File "/home/tiago/Work/hello_world/_build/.sandbox/f902b8116518b10f30ed7475b3b5c86b/_private/default/.pkg/z3/source/scripts/mk_util.py", line 1980, in _init_ocamlfind_paths raise MKException('The destdir reported by {ocamlfind} ({destdir}) does not exist'.format(ocamlfind=OCAMLFIND, destdir=self.destdir)) mk_exception.MKException: 'The destdir reported by ocamlfind (/home/tiago/Work/hello_world/_build/.sandbox/f902b8116518b10f30ed7475b3b5c86b/_private/default/.pkg/z3/target/lib) does not exist' ```

Specifications

$ dune --version
"Dune Developer Preview: build 2024-09-28T01:30:13+00:00, git revision
17071ec30d10390badcb6cb1f6a43984b1be54a6"
$ ocaml --version
The OCaml toplevel, version 5.2.0
$ cat /etc/issue
Pop!_OS 22.04 LTS \n \l
Leonidas-from-XIV commented 1 week ago

This looks like an issue where our ocamlfind fork reports a DESTDIR that doesn't exist. I am not sure whether the right way would be to patch ocamlfind to create it when reporting it or whether Z3 should mkdir $DESTDIR.