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

--release for pure Coq code affects flags and triggers rebuild #4553

Closed
Blaisorblade opened this issue Apr 30, 2021 · 5 comments
Closed

--release for pure Coq code affects flags and triggers rebuild #4553

Blaisorblade opened this issue Apr 30, 2021 · 5 comments
Assignees
Labels

Comments

@Blaisorblade
Copy link
Contributor

Blaisorblade commented Apr 30, 2021

Expected Behavior

Since Coq code cannot be optimized, passing --release should not trigger a rebuild of .v files.

Actual Behavior

-w -native-compiler-disabled -native-compiler ondemand is passed for normal builds but not --release builds, triggering a rebuild.

Reproduction

  • PR with a reproducing test:
  1. dune build --cache=disabled --display=verbose theories/lang/prelude/notations.vo &> build-normal
  2. dune build --cache=disabled --display=verbose theories/lang/prelude/notations.vo -p coq-cpp2v &> build-release
  3. confirm that the options are different (which will trigger a rebuild); I've observed the actual rebuild with cache enabled

The code was a version of https://github.com/bedrocksystems/cpp2v but I can minimize.

Specifications

  • Version of dune (output of dune --version): 2.8.5
  • Version of ocaml (output of ocamlc --version): 4.07.1
  • Operating system (distribution and version): MacOS 10.15

Additional information

@ejgallego ejgallego self-assigned this Apr 30, 2021
@ejgallego ejgallego added the coq label Apr 30, 2021
@ejgallego
Copy link
Collaborator

Thanks, this is indeed a bug, and fortunately quite easy to solve I think if you look at coq_rules

@ejgallego ejgallego added this to the 2.9 milestone Apr 30, 2021
@Blaisorblade
Copy link
Contributor Author

Blaisorblade commented May 1, 2021

Ah, I should have mentioned my dune-project has

(lang dune 2.7)
(using coq 0.2)

Bumping to 2.8 and 0.3 works around the problem, which is consistent with the code I see.

It seems the bug is in this code, which for 0.2 should use Legacy instead of VoOnly in non-release mode (is_dev):

let select_native_mode ~sctx ~(buildable : Buildable.t) =
  let profile = (SC.context sctx).profile in
  if Profile.is_dev profile then
    Coq_mode.VoOnly
  else
    snd buildable.mode

(but I wouldn't immediately know how to get to the config, so don't wait for me for a fix).

EDIT: so this might come from #4224.

@ejgallego
Copy link
Collaborator

Yup, thanks a lot for the analysis, it is correct.

gmalecha pushed a commit to bedrocksystems/BRiCk that referenced this issue May 18, 2021
@ejgallego ejgallego modified the milestones: 2.9, 3.0 Jun 18, 2021
@ejgallego ejgallego removed this from the 3.0 milestone Oct 20, 2021
@Blaisorblade
Copy link
Contributor Author

From my latest testing this is not a problem today, even if I'm not sure when this was fixed.

@ejgallego
Copy link
Collaborator

ejgallego commented Jul 26, 2022

It was fixed on some flags rework, I think when I fixed the (env (coq ...)) bug. Thanks for checking it is fixed!

By the way, I'd be nice to have a test suite entry for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants