0.14.2 Failure: Cannot find "ocamlbuild.cmo" in ocamlbuild -where directory.
Ocamlbuild 0.14.2 compiles successfully with "make", but at the "make test" stage, several of the tests fail with a similar error:
Warning: Won't be able to compile a native plugin
Failure: Cannot find "ocamlbuild.cmo" in ocamlbuild -where directory.
Version 0.14.1 is installed on my system, and I'm using OCaml 4.13.1.
I tested:
- "make && make test" in 0.14.1's source directory works on my system ;
- "make && make test" in 0.14.2's source directory fails on my system ;
- "make && make test" in 0.14.1's source directory works in a chroot without an installed ocamlbuild ;
- "make && make test" in 0.14.2's source directory fails in a chroot without an installed ocamlbuild.
So the problem is really something new in 0.14.2.
Here is my understanding of the issue:
- the bug was introduced in #319, which implemented support for OCaml 5.1
- the issue is that, after #319,
ocamlbuild.cmois compiled in a different directory from other object files (bin/instead ofsrc/), while our test infrastructure assumes that all library/plugin files can be found in the same directory that is passed to ocamlbuild using the-install-lib-diroption -
-install-lib-dirsets a single constant, I cannot pass several directories there - the reason why #319 moved source files around is to solve a small issue with the Makefile-based build system, that would build all source files with
-for-pack Ocamlbuild_pack, even though some files were actually not packed. This used to be morally incorrect but work fine, and it is now explicitly rejected by OCaml 5.x ( see https://github.com/dbuenzli/mtime/issues/45 ).
There are two fixes that would make sense:
- we could consider adding support for providing several "library directories" to ocamlbuild at runtime; those are used when linking plugins
- or we could change the build system to store all build objects in a single directory, finding another workaround to the -for-pack issue
Approach (1) is nicer on paper but it requires more effort, and is more invasive/risky. Approach (2) is somewhat ugly but should make no observable change to ocamlbuild users (after install).
Given the fact that ocamlbuild is now in maintenance-only mode, I would vote for approach (2).
Or perhaps I should wait until I upgrade to OCaml 5.1 before I upgrade to ocamlbuild 0.14.2 ?
Yes, 0.14.1 should be fine if your OCaml version is 5.0 or older.
(But I still need to fix this bug in the current codebase. Thanks for the report!)
Edit. Ignore this comment
The same error message occurs on Windows but with a different root cause. Filed a bug at https://github.com/diskuv/dkml-installer-ocaml/issues/70 and submitted a PR to this ocamlbuild project.
@jonahbeckford I don't understand the relation between the patches you are showing and the issue here, that I think is related to the ocamlbuild build system and testsuite layout that breaks make test. Could it be that you see the same error message, but in a different situation (not only when running make test, but also after ocamlbuild is installed)? If so, I think we should open a separate issue or stick to the PRs you are opening (thanks!), to not muddy the conversation here.
Same error message. I'll stick to the PRs and edit my previous comment.
This can be closed (by #328)