ocaml / ocamlbuild

The legacy OCamlbuild build manager
Other
121 stars 81 forks source link

0.14.2 Failure: Cannot find "ocamlbuild.cmo" in ocamlbuild -where directory. #321

Closed SnarkBoojum closed 3 months ago

SnarkBoojum commented 1 year ago

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:

  1. "make && make test" in 0.14.1's source directory works on my system ;
  2. "make && make test" in 0.14.2's source directory fails on my system ;
  3. "make && make test" in 0.14.1's source directory works in a chroot without an installed ocamlbuild ;
  4. "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.

gasche commented 1 year ago

Here is my understanding of the issue:

There are two fixes that would make sense:

  1. we could consider adding support for providing several "library directories" to ocamlbuild at runtime; those are used when linking plugins
  2. 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).

SnarkBoojum commented 1 year ago

Or perhaps I should wait until I upgrade to OCaml 5.1 before I upgrade to ocamlbuild 0.14.2 ?

gasche commented 1 year ago

Yes, 0.14.1 should be fine if your OCaml version is 5.0 or older.

gasche commented 1 year ago

(But I still need to fix this bug in the current codebase. Thanks for the report!)

jonahbeckford commented 11 months ago

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.

gasche commented 11 months ago

@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.

jonahbeckford commented 11 months ago

Same error message. I'll stick to the PRs and edit my previous comment.

hhugo commented 3 months ago

This can be closed (by #328)