mirage / checkseum

MIT License
15 stars 13 forks source link

Cannot find file topfind. Unknown directive `require'. #48

Closed Faliszek closed 3 years ago

Faliszek commented 4 years ago

Sorry if this issue is not properly addressed. I try to add irmin-unix package to my project which is build with esy and reasonml. But after trying to build it with esy build i get the error below.

error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @opam/checkseum@opam:0.2.1
    # esy-build-package: pwd: /Users/pawelfalisz/.esy/3/b/opam__s__checkseum-opam__c__0.2.1-3b39b42e
    # esy-build-package: running: 'dune' 'build' '-p' 'checkseum' '-j' '4'
    # esy-build-package: running: './install/install.ml'
    Cannot find file topfind.
    Unknown directive `require'.
    error: command failed: './install/install.ml' (exited with 2)
    esy-build-package: exiting with errors above...

  building @opam/checkseum@opam:0.2.1
esy: exiting due to errors above

From my understanding, there is something wrong with ./install/install.ml file? But i dont have that much knowledge about ocaml and ocaml tools, to know what exactly went wrong.

Thanks in advance.

dinosaure commented 4 years ago

Hi, I'm not an user of esy but from the given OPAM file, ocamlfind is required to build checkseum. From your output error it seems that esy did not install it (because we don't find topfind).

You probably should report the issue to esy.

Thanks for your report.

jordwalke commented 4 years ago

@dinosaure I believe it is because ocamlfind is marked with-test, which according to opam means that it will only be installed when built with tests. However, ocamlfind is indeed required to build without tests apparently. I believe the reason why esy caught this is because it sandboxes all builds so that packages cannot depend on packages that they did not express as dependencies.

jordwalke commented 4 years ago

The other issue I noticed is that it assumes that dune build artifacts will exist in _build, but that isn't always the case - as Dune may also be configured by package managers to build out of source into the DUNE_BUILD_DIR directory, and esy sets this env var so that all dune builds occur out of source into a reproducible shared cache.

Could checkseum:

jordwalke commented 4 years ago

Update: I'm not sure the with-test was what was causing this issue, and we're still investigating but I think that with-test might still need to be removed if it does indeed depend on ocamlfind, right?

dinosaure commented 4 years ago

So currently the purpose of install/install.ml is to tweak the META file generated by dune to still be compatible with MirageOS 3 (an other issue exist about that here: ocaml/dune#3557). At least, ocamlfind is used to build checkseum (tweak on the META file) and to test checkseum. From the esy output, it seems that ocamlfind, even if it's tagged with build, is not installed by esy.

From my perspective, as opam, esy should at least install ocamlfind as a dependency needed to build & install checkseum (and it's where I think esy does not do correctly the job). However, if we fallback to install/install.ml, it seems that ocamlfind/topfind is only used to #require "unix" (and correctly load unix.cma according to the META file).

So a good solution for both seems to remove ocamlfind as a dependency to build checkseum and use instead #load "unix.cma" (where this module is global from the point of view of the REPL) to, may be, fix the initial issue with esy.

dinosaure commented 4 years ago

If someone can try #49 to see if it's the right fix :+1:. The error will be the same for digestif (which shares the same layout), so it still is exist for irmin in general (where transitively irmin depends on digestif)

jordwalke commented 4 years ago

even if it's tagged with build, is not installed by esy. My understanding is that the opam build flag is not what it sounds like. It is used as a kind of optimization to avoid recompiling in certain circumstances.

From the opam docs

build: limits the dependency to a build-time one, avoiding recompilation if it changes

jordwalke commented 4 years ago

The predicates are "anded" together as well, so even if build did mean "at build time", it would be anded together like"only take this dependency if (build and only for with-docs build)". I'm by no means an opam expert but I'm just reporting what I'm interpreting from the docs, and the docs are what we use to implement esy as an alternative opam client.

dinosaure commented 4 years ago

A release will appear soon.

dmtrKovalenko commented 3 years ago

cc @dinosaure will this be released? This blocks us :(

dinosaure commented 3 years ago

Sorry I completely forgot the release. I will do that today, just fix the PR about MirageOS tests.