Conversation
28a41a0 to
7a4d3ff
Compare
c1fc50d to
c9f7566
Compare
85a9891 to
25a5e68
Compare
391b19a to
f3efbd6
Compare
31610af to
2356554
Compare
hhugo
reviewed
Mar 12, 2026
| with | ||
| | Some "native" -> `Native | ||
| | Some "cps" -> `Cps | ||
| | _ -> `Jspi); |
Member
There was a problem hiding this comment.
Waybe we should not silently ignore unknown values
Member
There was a problem hiding this comment.
There is similar diff in #2189, is there a lot of intersection between the two ?
Use a compact encoding for the [--build-config] output: a key at its default is omitted; all other keys still emit [name=value]. Restructure [set_values] to iterate over the known keys rather than the input entries, so that an omitted bool is reset to its default (instead of silently keeping whatever value the caller left it at) and a missing enum is reported as an error. For the typical wasm builds this reduces e.g. effects=jspi+toplevel=false+use-js-string=true (45 chars) to effects=jspi (12 chars), which keeps the build-config directory that dune derives from this output well within Windows' MAX_PATH limit.
Dune 3.23 forces sandboxing on user rules, so gen.exe runs from _build/.sandbox/<hash>/default/<dir> instead of the project tree. The previous prefix walker (stop when parent ends with _build) then yielded <hash>/default/<dir>/, which both shows up in the generated ;; comment and shifts the Hashtbl.hash-based name suffix, making the runtest diff against the checked-in dune.inc fail. Take the project-relative directory as argv.(1) (replacing the previously unused library-name argument) so the prefix is stable regardless of where dune runs the action.
The current release of ocaml-dune-lint is not compatible with dune 3.23.
Under dune 3.23 sandboxing, rules that run a *.bc.wasm.js file also need to depend on the companion *.bc.wasm.assets/ directory so that the .wasm files are copied into the sandbox.
Under dune 3.23 sandboxing, rules invoking js_of_ocaml or wasm_of_ocaml with --toplevel need their .cmi files brought into the sandbox. For locally built cmis, declare them as deps. For library cmis, add a cmi_include_dirs.txt rule (mirroring the existing one for toplevel.bc) that uses ocamlfind to produce -I flags, and pass the result via read-strings.
Under dune 3.23 sandboxing, wc.ml needs to be brought into the
sandbox. Inline the dep with %{dep:wc.ml} on the command line.
It uses `js_of_ocaml --build-config` to manage config details.
oxcaml-dune-patches pins dune <= 3.21, but the project requires dune >= 3.23. opam re-checks dependency constraints on every install, so a one-shot --ignore-constraints-on=dune flag isn't enough. Re-pin the package with the dune version constraint stripped, so subsequent installs let dune resolve to 3.23.x normally.
Wasmtime only supports these instructions and not the legacy ones. So, emit them when WASI support is requested, since Wasmtime is the primary target for WASI binaries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You can produce a WASI binary by running
wasm_of_ocamlwith the--enable wasiflag:This produces some Wasm code that can be directly executed by the Wizard engine:
wasmtime does not support the legacy exception handling instructions. You can produce a binary that will work with wasmtime as well by adding the
--enable exnrefflag:You can then execute it with the following command:
Note that we keep the same output convention, at least for now: a JavaScript file
foo.jsand a directoryfoo.assetscontaining the Wasm code. The JavaScript file can be use to run the WASI binary withnode.Blocked by: