Skip to content
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

Js_of_ocaml separate compilation issue when using some jsoo flags. #6679

Closed
hhugo opened this issue Dec 12, 2022 · 0 comments · Fixed by #6714
Closed

Js_of_ocaml separate compilation issue when using some jsoo flags. #6679

hhugo opened this issue Dec 12, 2022 · 0 comments · Fixed by #6714
Milestone

Comments

@hhugo
Copy link
Collaborator

hhugo commented Dec 12, 2022

Users can pass arbitrary flags to js_of_ocaml (since #5049).
When using separate compilation, js_of_ocaml needs to compile multiple bits (runtime.js, deps*.cma.js, and *cmo.js) separately and link everything together.

The isssue is that some jsoo flags (e.g --enable use-js-string, --enable effects) require that all individual bits are compiled the same way or the generated js might not work correctly. ocsigen/js_of_ocaml#1346 improves the situation a bit by having jsoo complain if this is not the case, instead of emitting invalid JS.

As far as I know, we mostly have an issue with how we compile cma files to js.
We currently setup a single rule per lib (in _build/default/.js/{LIB}/ for findlib libraries and in _build/default/{PATH_TO_LIB}/.{LIB}.objs/) but we would need to generate rules based on the jsoo flags used by executables.

One easy solution would be to declare all cma.js rules needed by an executable for each executables but we would lose sharing which kind of defeat the purpose of separate compilation.

Any suggestion ?

@hhugo hhugo mentioned this issue Dec 15, 2022
hhugo added a commit to hhugo/dune that referenced this issue Dec 21, 2022
hhugo added a commit to hhugo/dune that referenced this issue Dec 21, 2022
Signed-off-by: Hugo Heuzard <[email protected]>
hhugo added a commit to hhugo/dune that referenced this issue Dec 21, 2022
Signed-off-by: Hugo Heuzard <[email protected]>
@rgrinberg rgrinberg added this to the 3.7.0 milestone Dec 21, 2022
rgrinberg pushed a commit to hhugo/dune that referenced this issue Dec 22, 2022
rgrinberg pushed a commit that referenced this issue Dec 22, 2022
Signed-off-by: Hugo Heuzard <[email protected]>
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 a pull request may close this issue.

2 participants