Silly Q: If b
depends on a
and I run dune build -p b
, is it expected the result differs from -p a,b
? Is the point that -p b
assumes a
is installed already? This behavior does not seem Coq-specific, I get errors on both executables and Coq theories that live in a
.
I've first noticed this together with Coq theory composition — with dune build -p b
, Cob
Yes, that's the whole point of -p
to build the package against installed deps
see the docs. Note you can do -pa,b
we are still missing user-contrib support so that's useless for Coq unfortunately
Why are you using -p anyway?
I can use that with a slight hack — if I install a
, for now I can patch out mentions of a
's theories in b
. Emilio's right and that doesn't scale, but it's still better than coq_makefile
in my scenario
@Rudi Grinberg I'm packaging a
so -p
was the obvious choice
it's a bit unfortunate that --no-config
disables the cache, but -p a --cache enabled
seems to work out. I get cache misses for Coq code that depends on custom OCaml plugins, but that seems as intended (the OCaml command-line changes in release mode, and the Coq one does not).
and of course, skipping caches might be the reasonable default for a reproducible build but YMMV. In fact, "write to the cache but don't read from it" seems an attractive option when you fear (or know for certain) that your incremental builds are not sound because you do not track dependencies fully
Isn't the problem that you've enabled the cache in the config? Release builds shouldn't be relying on any configuration settings in your HOME dir
Yes, that's certainly as specified* — it's just unfortunate that the spec means caching is disabled.
*because -p
implies --release
which implies --no-config
; dune build --help
is unambiguous here.
of course I can patch _my_ foo.opam
to use dune build -p ... --cache enabled
(if I don't use dune-release
), but that won't enable caches for other packages.
I think there's a way to enable the cache for an entire switch in opam
See this issue https://github.com/ocaml/opam-repository/issues/19150
There's a way to set environment variables for opam switches but it escapes me at the moment
Ah, it's opam config env
:-)
so even with -p
, env variables are still considered (as the manual says).
I'm less sure how to _set_ such environment variables... opam packages can use the setenv
field, (https://opam.ocaml.org/doc/Manual.html)
and it seems opam option setenv
allows to change the per-switch-global setenv
option (https://opam.ocaml.org/doc/man/opam-option.html)...
Yes, you need the latter here
setenv
doesn't seem modular or fully documented (need I query the current map to extend it?) — can I just set the variables in the environment? or does opam
clear them?
You could try it. I don't remember if opam clears them.
try DUNE_CACHE=enabled; opam exec -- sh -c 'echo $DUNE_CACHE'
$ export DUNE_CACHE=enabled; opam exec -- sh -c 'echo $DUNE_CACHE'
enabled
:-)
thanks a lot!
Last updated: Oct 13 2024 at 01:02 UTC