Skip to content

Get rid of calls to opam when using opam#61

Closed
kit-ty-kate wants to merge 1 commit into
mirage:mainfrom
kit-ty-kate:411
Closed

Get rid of calls to opam when using opam#61
kit-ty-kate wants to merge 1 commit into
mirage:mainfrom
kit-ty-kate:411

Conversation

@kit-ty-kate
Copy link
Copy Markdown
Member

Currently using opam 2.1~alpha (this is probably a bug but it might break in the future), mirage-solo5 fails to install because it uses opam config var while already being inside opam.

This PR gets rid of the issue by using dune variables. However I didn't found a way to directly get the PREFIX (e.g. ~/.opam/<switch>/) with dune other than relying on the "hack" %{lib:pkgconfig:}/../pkgconfig, so I'm tagging this PR as a draft for now to start a discussion. cc @jeremiedimino @rgrinberg is there a cleaner way to get the opam prefix with dune?

@rgrinberg
Copy link
Copy Markdown
Member

This seems like the best workaround for now. We could add an %{install:lib} variable, but it seems like that's very specialized.

@samoht
Copy link
Copy Markdown
Member

samoht commented Jun 11, 2020

This looks like a bug in opam 2.1~alpha (did you report it upstream?). This mechanism will go away in mirage4 so I'm not sure we really want to workaround that bug.

@hannesm
Copy link
Copy Markdown
Member

hannesm commented Jun 11, 2020

I agree with @samoht here, that opam config var {prefix,lib} should not open a log file (and be fine to be called under opam - would be great to re-introduce this behaviour in opam 2.1). The use of opam config var prefix/lib is present in for MirageOS3 "cross"-compilation in roughly a dozen opam packages.

@mato
Copy link
Copy Markdown
Contributor

mato commented Jul 1, 2020

What is the status of this and the related mirage/ocaml-solo5#79? Do I understand this correctly, namely that functionality Mirage has been relying on (and will continue to rely on, at least for the lifetime of Mirage 3.x), i.e. the use of $(opam config var XXX) while "inside" opam, has been removed in opam 2.1?

@samoht
Copy link
Copy Markdown
Member

samoht commented Jul 2, 2020

@mato That's a bug in opam 2.1~alpha and should be fixed there. /cc @rjbou

@rjbou
Copy link
Copy Markdown

rjbou commented Jul 2, 2020

Calling opam during build is still permitted (with --safe restriction). It is indeed a bug in 2.1.0~alpha that under some circumstances (switch state), a syscall is made. Cf. the corresponding opam issue ocaml/opam#4188.

@hannesm
Copy link
Copy Markdown
Member

hannesm commented Nov 18, 2021

I'll close this PR. With #79, opam is only called if available (as in other cross-compilation Makefiles). Furthermore, the "calling opam inside opam" is allowed. And opam var prefix is used instead of opam config var prefix (that is now deprecated). Please reopen if you need further adjustments.

@hannesm hannesm closed this Nov 18, 2021
kit-ty-kate pushed a commit to kit-ty-kate/mirage-solo5 that referenced this pull request Oct 6, 2022
configure: fix 4.08+ case; support >= 4.08.1+rc3
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

Successfully merging this pull request may close these issues.

6 participants