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

Example fails to build with up-to-date opam-repository #11

Closed
LogicalOverflow opened this issue Jan 3, 2023 · 2 comments
Closed

Example fails to build with up-to-date opam-repository #11

LogicalOverflow opened this issue Jan 3, 2023 · 2 comments

Comments

@LogicalOverflow
Copy link
Contributor

Updating the flake inputs of the example repo causes it to fail to build
since the release of ptime.1.1.0, even when ensuring ocaml 4 is used.

This invocation fails to build (my fork just updates the flake.lock and adds package "ocaml" ~max:"5.0.0" to the packages in the config.ml):

nix build "github:LogicalOverflow/mirage-hello-hillingar" --override-input opam-repository \
    "github:ocaml/opam-repository?rev=49c3ad31df3f2f60c2006211900b6553c097277c"

With the following error:

File "duniverse/mirage-logs/src/dune", line 4, characters 50-55:
4 |   (libraries logs mirage-clock lwt mirage-profile ptime))
                                                      ^^^^^
Error: Library "ptime" not found.
-> required by library "mirage-logs" in
   _build/default/duniverse/mirage-logs/src
-> required by executable main in dune.build:12
-> required by _build/default/main.exe
-> required by _build/default/hello
-> required by _build/default/dist/hello
-> required by alias dist/all
-> required by alias dist/default

The previous commit of opam-repository still works:

nix build "github:LogicalOverflow/mirage-hello-hillingar" --override-input opam-repository \
    "github:ocaml/opam-repository?rev=29869b0a1ad4fb7fc4a08d8a888a7abb6d0fa5cc"

The first bad commit is ocaml/opam-repository@49c3ad3, which adds ptime.1.1.0

I am not sure yet, where the issue lies (here, with opam-nix or somewhere else), but I am still able to build the example unikernel without nix. (mirage configure -t unix followed by make)

As a work-around, adding package "ptime" ~max:"1.1.0" to the packages in the config.ml allows the build with nix to work again.

@RyanGibb
Copy link
Owner

RyanGibb commented Jan 4, 2023

The reason dune isn't picking up ptime.1.1.0 from the monorepo is because it isn't built with dune. We use the overlay for v1.0.0 here: https://github.com/dune-universe/opam-overlays/blob/master/packages/ptime/ptime.1.0.0%2Bdune/opam, but no such overlay has been created for v1.1.0 (yet). (More info on these overlays here: https://github.com/dune-universe/opam-overlays.)

Building outside the nix derivation with make uses the opam monorepo solver which filters out non-dune dependent packages so that only those with overlays are returned. We're using opam's default solver which doesn't filter out non-dune dependent packages, hence this problem. This issue is tracked here: #3

I also tried to build a repository for using the solver on that had the non-dune dependent packages filtered out, but that was ridiculously slow: tweag/opam-nix#18 (comment).

Until #3 is resolved, manually specifying the dependency version seems like a reasonable workaround.

@LogicalOverflow
Copy link
Contributor Author

Thanks for the insight. I'll close this issue then, as it's a duplicate of #3.

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

2 participants