-
Notifications
You must be signed in to change notification settings - Fork 410
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
dune-site does not work with opam #4198
Comments
I believe there is two problem in one. The one about opam is the most problematic. ContextWe use binary substitution for implementing different features (e.g build_info, sites) in order to keep the built binary independent of these informations and so to be able to use more the cache. However dune does the binary substitution only during promotion and installation through ( Possibilities?
|
Sorry for mixing things up.
I don't think dune install is an option. The same thing will be encountered by linux/BSD distributions that might use I'm curious though, I'm not sure to understand why binary substitution is required here. To my untrained eye it seems to me like an overkill solution for this but I'm probably missing something. |
Distribution uses (or should use)
In a nutshell, you don't want to put the information in the source, otherwise you can't reuse the cache of for example one local opam switch in another. |
The fact that we rewrite the binary always seemed a bit tricky to me, here the sites / version info seems to be a runtime dependency, so why not just generate a file For example, the current approach creates a bit of pain when adding the real binaries to path which is needed for some cases where we have non-dunerized setup use our apps. |
To fix the problem the binaries will not need to be rewritten for opam like layout ( |
I was thinking of having the invariant the file is in the same location than the binary. |
Using a file at the same location than the binary, is a possibility that as drawbacks but advantage. I prefer to stick to the current solution but if you want to look at it by writing an RFC, you need to be careful with:
For this issue, I think the main problem is that we let opam take directly from the The idea of using the opam layout by default is complicated by installed libraries that use sites. |
An additional problem with binary rewriting is that it will perform build in If so that breaks use cases doing I am indeed not sure that the current model is the right one, it seems to me that the binary rewriting is breaking a quite established workflow and now suddenly we have to tell a lot of users "you are all doing it wrong". |
BInary rewriting also sounds like a big no-no to me. First of all, it breaks an established paradigm that the build artifact could be used and packed as it is. Next, the problem that dune is trying to solve is well-known and is being addressed in many ways by many tools. To some extent, using binary rewriting, yes that is what the dynamic loader (ld.so) is doing. But only on the load time and it never touches the artifact. Practically, all solutions rely on the availability of a central program of authority with a well-known location that is the administrative resource for information about library/packages/sites location. As an escape hatch, we also have specific command-lines options (like To summarize, the well-established approach is to keep this information in an external executable. In our case, it could be Ideally, and this is what historically OCaml was doing, we should strive for full compatibility with C runtime. On Linux, I think it is possible, we have plenty of options, e.g., loader scripts to adapt our binaries to the environment. On the other operating systems, the story and traditions are different. Both Windows and macOS tend to hardcode the library information in the binaries, so trying to bring our view to those operating systems will contradict the established traditions and turn OCaml binaries into second-class citizens. Another option, especially, for sites and dynamic linking is to store this information in a library that provides those services. So that any OCaml binary that requires this site information (or needs to load a plugin) will be able to query this information through the library interface. Yes, it is moving the problem to another location, but, at least, this location is a single location. TL;DR;
|
No it does the rewriting on the fly during copying.
The build artifact are not directly available; they are inside The site feature of dune is already I think a service, even if it could be improved. I agree that there are other possibilities and I'm happy to discuss them. There are a lot of constraints (e.g be shared-cache friendly, don't control the dynamic linking of libraries) and the current solution is perhaps not the best. However I would like to keep this issue as fixing the problem without changing the whole feature. |
During the current dev meeting we converged on another possibility:
|
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212 Signed-off-by: François Bobot <francois.bobot@cea.fr>
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212 Signed-off-by: François Bobot <francois.bobot@cea.fr>
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212 Signed-off-by: François Bobot <francois.bobot@cea.fr>
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212 Signed-off-by: François Bobot <francois.bobot@cea.fr>
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212 Signed-off-by: François Bobot <francois.bobot@cea.fr>
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212 Signed-off-by: François Bobot <francois.bobot@cea.fr>
- Substitute the files in an intermediate directory if needed - Backward compatible Fixes ocaml#4198 ocaml#4212 Signed-off-by: François Bobot <francois.bobot@cea.fr>
…ator, dune-private-libs, dune and dune-build-info (2.9.0) CHANGES: - Add `(enabled_if ...)` to `(mdx ...)` (ocaml/dune#4434, @emillon) - Add support for instrumentation dependencies (ocaml/dune#4210, fixes ocaml/dune#3983, @nojb) - Add the possibility to use `locks` with the cram tests stanza (ocaml/dune#4480, @voodoos) - Allow to set up merlin in a variant of the default context (ocaml/dune#4145, @TheLortex, @voodoos) - Add `(package ...)` to `(mdx ...)` (ocaml/dune#4691, fixes ocaml/dune#3756, @emillon) - Handle renaming of `coq.kernel` library to `coq-core.kernel` in Coq 8.14 (ocaml/dune#4713, @proux01) - Fix generation of merlin configuration when using `(include_subdirs unqualified)` on Windows (ocaml/dune#4745, @nojb) - Fix bug for the install of Coq native files when using `(include_subdirs qualified)` (ocaml/dune#4753, @ejgallego) - Allow users to specify install target directories for `doc` and `etc` sections. We add new options `--docdir` and `--etcdir` to both Dune's configure and `dune install` command. (ocaml/dune#4744, fixes ocaml/dune#4723, @ejgallego, thanks to @JasonGross for reporting this issue) - Fix issue where Dune would ignore `(env ... (coq (flags ...)))` declarations appearing in `dune` files (ocaml/dune#4749, fixes ocaml/dune#4566, @ejgallego @rgrinberg) - Disable some warnings on Coq 8.14 and `(lang coq (>= 0.3))` due to the rework of the Coq "native" compilation system (ocaml/dune#4760, @ejgallego) - Fix a bug where instrumentation flags would be added even if the instrumentatation was disabled (@nojb, ocaml/dune#4770) - Fix ocaml/dune#4682: option `-p` takes now precedence on environement variable `DUNE_PROFILE` (ocaml/dune#4730, ocaml/dune#4774, @bobot, reported by @dra27 ocaml/dune#4632) - Fix installation with opam of package with dune sites. The `.install` file is now produced by a local `dune install` during the build phase (ocaml/dune#4730, ocaml/dune#4645, @bobot, reported by @kit-ty-kate ocaml/dune#4198) - Fix multiple issues in the sites feature (ocaml/dune#4730, ocaml/dune#4645 @bobot, reported by @Lelio-Brun ocaml/dune#4219, by @Kakadu ocaml/dune#4325, by @toots ocaml/dune#4415)
…ator, dune-private-libs, dune and dune-build-info (2.9.0) CHANGES: - Add `(enabled_if ...)` to `(mdx ...)` (ocaml/dune#4434, @emillon) - Add support for instrumentation dependencies (ocaml/dune#4210, fixes ocaml/dune#3983, @nojb) - Add the possibility to use `locks` with the cram tests stanza (ocaml/dune#4480, @voodoos) - Allow to set up merlin in a variant of the default context (ocaml/dune#4145, @TheLortex, @voodoos) - Add `(package ...)` to `(mdx ...)` (ocaml/dune#4691, fixes ocaml/dune#3756, @emillon) - Handle renaming of `coq.kernel` library to `coq-core.kernel` in Coq 8.14 (ocaml/dune#4713, @proux01) - Fix generation of merlin configuration when using `(include_subdirs unqualified)` on Windows (ocaml/dune#4745, @nojb) - Fix bug for the install of Coq native files when using `(include_subdirs qualified)` (ocaml/dune#4753, @ejgallego) - Allow users to specify install target directories for `doc` and `etc` sections. We add new options `--docdir` and `--etcdir` to both Dune's configure and `dune install` command. (ocaml/dune#4744, fixes ocaml/dune#4723, @ejgallego, thanks to @JasonGross for reporting this issue) - Fix issue where Dune would ignore `(env ... (coq (flags ...)))` declarations appearing in `dune` files (ocaml/dune#4749, fixes ocaml/dune#4566, @ejgallego @rgrinberg) - Disable some warnings on Coq 8.14 and `(lang coq (>= 0.3))` due to the rework of the Coq "native" compilation system (ocaml/dune#4760, @ejgallego) - Fix a bug where instrumentation flags would be added even if the instrumentatation was disabled (@nojb, ocaml/dune#4770) - Fix ocaml/dune#4682: option `-p` takes now precedence on environement variable `DUNE_PROFILE` (ocaml/dune#4730, ocaml/dune#4774, @bobot, reported by @dra27 ocaml/dune#4632) - Fix installation with opam of package with dune sites. The `.install` file is now produced by a local `dune install` during the build phase (ocaml/dune#4730, ocaml/dune#4645, @bobot, reported by @kit-ty-kate ocaml/dune#4198) - Fix multiple issues in the sites feature (ocaml/dune#4730, ocaml/dune#4645 @bobot, reported by @Lelio-Brun ocaml/dune#4219, by @Kakadu ocaml/dune#4325, by @toots ocaml/dune#4415)
Expected Behavior
dune-site
should work when used in a package installed by opam.In my opinion the destination directory given by
dune-site
should always return exactly one directory:_build/install/default/<dir>
when called from the source code by dune../<dir>
when called from a directory calledbin/
(e.g._build/install/default/bin/
or$prefix/bin
)/usr/local/<dir>
otherwise (or maybe give justNone
)Actual Behavior
The current implementation of
dune-site
does not work when the package in installed by opam.The destination directory given by
dune-site
returns[]
when the program is called directly without having calleddune install
before.Reproduction
Specifications
dune
(output ofdune --version
): 2.8.2The text was updated successfully, but these errors were encountered: