-
Notifications
You must be signed in to change notification settings - Fork 435
[pkg] Build OxCaml with Dune package management #11652
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
Comments
The opam packaging has been designed to work well for opam - in particular to allow OxCaml to be updated without having to rebuild all the constituent parts. The obvious Dune fit would be to building OxCaml in a separate build context (i.e. compiling the Dune stage of OxCaml in a build context which has the correct compiler). I'm wondering (= quite strongly recommending) not adding features to |
Just as a proof-of-concept for simplifying: --- a/dune-workspace
+++ b/dune-workspace
@@ -2,7 +2,7 @@
(repository
(name jst)
- (url git+https://github.com/janestreet/opam-repository#with-extensions))
+ (url git+https://github.com/dra27/opam-repository#with-extensions-dp))
(lock_dir
(repositories upstream overlay jst)) and then: $ dune --version
"Dune Developer Preview: build 2025-04-26, git revision
1a0d3646a365210cb42a4366cb3a026b4c8928e3"
$ dune pkg lock
$ time dune build
Downloading ocaml-variants.5.2.0+flambda2
Building ocaml-variants.5.2.0+flambda2
real 12m59.186s The first build is taking an inordinately long time1, but the caching is definitely working after that: $ git clean -dfX
$ time dune build
Building ocaml-variants.5.2.0+flambda2
real 0m1.483s Footnotes
|
+1 to modifying the package metadata rather than modifying dune. Thanks for the proof-of-concept @dra27! |
I've updated my example project to use @dra27's fork of the JST repo which internalizes the "init-*" packages and changed the example program to use the new oxcaml syntax to demonstrate that it's being built with the oxcaml compiler. |
@dra27 thanks for the proof-of-concept! I agree with your point. Note that some problems we encountered here are related to non-relocatable packages in general. This isn't exclusive to As @gridbugs, I have tried the solution, and I'm able to make it build and run the code! |
Some feedback about it, I have been able to push a working version using @dra27 patches and using a custom repository. |
This issue will serve as a meta issue to describe the changes required to build OxCaml with Dune package management.
Currently, I have trying to build it using @gridbugs small repository, hello-oxcaml. The locking happens correctly, but the build encounters various errors:
init-compiler
requires it to be added totoolchains
supported list. Otherwise, as it is not relocatable, it will suffer the same problem as the compiler.init-*.pkg
use the%{prefix}
variable, which is causing a problem with Dune Package Management because it points to the_build/.sanbox/...
path. We extend the path with the dependencies instead of having a global state asopam
would do. The semantic of%{prefix}
is not really clear for me in this context. I'm not confident it has one.%{pkg:init-compiler:share}
in theinit-*.pkg
lock files, we are able to build it to a findable path. However, when doing the variable expansion in other*.pkg
files (which updates thePATH
accordingly), it is not using the path within toolchains but the one within the_build
directory. I'm writing a test to reproduce this error.ocaml-variants
package (after buildinginit-*
packages), it fails because of the problem discovered in dune-pkg: Local commands (ie./configure
) should be picked up from the sandbox rather than the source #11514. Indeed,(run autoconf)
generates aconfigure
but it can't be executed.I have been discussing with @rgrinberg on how to make Dune Package Management worked with
OxCaml
and more broadly on how to generalize it to support non-relocatable packages.I'll update the issue to point to the various resources and changes.
The text was updated successfully, but these errors were encountered: