Skip to content

Add full support for OCaml 4.12#3904

Closed
kit-ty-kate wants to merge 5 commits intoocaml:masterfrom
kit-ty-kate:412-empty-modules-support
Closed

Add full support for OCaml 4.12#3904
kit-ty-kate wants to merge 5 commits intoocaml:masterfrom
kit-ty-kate:412-empty-modules-support

Conversation

@kit-ty-kate
Copy link
Member

This is a "rebase" of #3793 just in case the reason why the PR is stalling is that it required a rebase.
This PR contain a merge commit to make it more obvious what has changed compared to the previous #3793. Feel free to squash it in the end.
Fixes #3766

cc @rgrinberg

rgrinberg and others added 4 commits September 15, 2020 15:54
Libraries without any modules must specify (modules) so that dune knows
whether it needs a native archive for this library without evaluating
any rules.

Signed-off-by: Rudi Grinberg <[email protected]>
@kit-ty-kate kit-ty-kate force-pushed the 412-empty-modules-support branch from a96b808 to e50303f Compare October 30, 2020 13:48
@rgrinberg
Copy link
Member

Thanks for reminding. The rebase isn't the problem, it's just that this patch is still in my backlog.

@kit-ty-kate
Copy link
Member Author

There seems to be an issue with some non-wrapped libraries without implementation for their main modules.
For instance with digestif.0.7.1: (side note: the latest version compiles fine)

#=== ERROR while compiling digestif.0.7.1 =====================================#
# context              2.1.0~beta3 | linux/x86_64 | ocaml-variants.4.12.0+trunk | file:///home/opam/opam-repository
# path                 ~/.opam/4.12.0+trunk/.opam-switch/build/digestif.0.7.1
# command              ~/.opam/4.12.0+trunk/bin/dune build -p digestif -j 47
# exit-code            1
# env-file             ~/.opam/log/digestif-7-a77a5e.env
# output-file          ~/.opam/log/digestif-7-a77a5e.out
### output ###
# File "src/dune", line 1, characters 0-206:
# 1 | (library
# 2 |  (name        digestif)
# 3 |  (public_name digestif)
# 4 |  (modules     digestif)
# 5 |  (wrapped     false)
# 6 |  (flags       (:standard -no-keep-locs))
# 7 |  (libraries   eqaf)
# 8 |  (modules_without_implementation digestif))
# Error: Rule failed to generate the following targets:
# - src/digestif.a
#       ocamlc src-c/.digestif_c.objs/byte/digestif.{cmo,cmt}

Does Modules.is_empty return false in this particular case? Or maybe this is an issue with dune master?

@rgrinberg
Copy link
Member

Does Modules.is_empty return false in this particular case? Or maybe this is an issue with dune master?

Could you try it with dune master if you don't mind?

@kit-ty-kate
Copy link
Member Author

Could you try it with dune master if you don't mind?

I just tried with dune master and this also failed

@dra27
Copy link
Member

dra27 commented Dec 7, 2020

Just summarising an(other!) offline discussion on this: the (modules) trick is clearly misappropriating the feature, especially for wrapped libraries where it's not enough. Plan at the moment:

  • introduce a dummy module by default, so a .a/.lib file is always created
  • have an opt-in option which stdlib-shims can use to explicitly opt-out of the dummy module, and indicate to Dune that there will be no .a/.lib file. If the compiler generates one (i.e. if the user lied), Dune could choose to fail the build step (or just ignore the .a/.lib file, just like any other rule which generates files it didn't claim it was going to)
  • note that Dune may need to be more liberal about external libraries for 4.12+ - a separately-compiled library providing a META could have foo.cmxa now and no foo.a/foo.lib
  • in the future, as and when Dune becomes able to determine exactly when no .a/.lib will be generated, stop needing the opt-out flag

@Octachron
Copy link
Member

@dra27 , what is the current status of this specific plan for supporting 4.12?

@dra27
Copy link
Member

dra27 commented Jan 4, 2021

@Octachron - there's a new fix in #3973

@Octachron
Copy link
Member

Oops, I missed this PR, thanks for the pointer!

@dra27
Copy link
Member

dra27 commented Jan 4, 2021

No problem - this issue has created myriad issues and PRs!!

@rgrinberg rgrinberg closed this Jan 4, 2021
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 this pull request may close these issues.

dune runtest fails on OCaml 4.12.0

4 participants