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

[Coq] (stdlib no) broken since 3.8.0 #8958

Closed
LasseBlaauwbroek opened this issue Oct 17, 2023 · 8 comments · Fixed by #8966
Closed

[Coq] (stdlib no) broken since 3.8.0 #8958

LasseBlaauwbroek opened this issue Oct 17, 2023 · 8 comments · Fixed by #8966
Assignees
Labels

Comments

@LasseBlaauwbroek
Copy link
Contributor

Starting with Dune 3.8.0, due to #6563, dune can no longer build in (stdlib no) mode when the stdlib is not installed. This is because it is checking coqc --config, which gives an exit code of 1. It has always done that, but Dune didn't seem to check it before 3.8.0

Reproduction

We can reproduce the problem with Dune's own tests.

  1. Make sure that you have coq-core.8.18.0 installed, but not coq-stdlib!
  2. DUNE_COQ_TEST=enable ./dune.exe build @no-stdlib outputs:
File "test/blackbox-tests/test-cases/coq/no-stdlib.t/run.t", line 1, characters 0-0:
------ test/blackbox-tests/test-cases/coq/no-stdlib.t/run.t
++++++ test/blackbox-tests/test-cases/coq/no-stdlib.t/run.t.corrected
File "test/blackbox-tests/test-cases/coq/no-stdlib.t/run.t", line 7, characters 0-1:
 |Test that when `(stdlib no)` is provided, the standard library is not bound to `Coq`
 |and the prelude is not imported
 |
 |  $ dune build --display=short foo.vo
 |  Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
 |  3.8 and will be removed in an upcoming Dune version.
-|        coqdep .basic.theory.d
-|          coqc foo.{glob,vo}
+|  cannot guess a path for Coq libraries; please use -coqlib option or ensure you have installed the package containing Coq's stdlib (coq-stdlib in OPAM) If you intend to use Coq without a standard library, the -boot -noinit options must be used.
+|  cannot guess a path for Coq libraries; please use -coqlib option or ensure you have installed the package containing Coq's stdlib (coq-stdlib in OPAM) If you intend to use Coq without a standard library, the -boot -noinit options must be used.
+|  [1]
 |
 |  $ dune build --display=short bar.vo
 |  Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
 |  3.8 and will be removed in an upcoming Dune version.
-|          coqc bar.{glob,vo} (exit 1)
-|  File "./bar.v", line 1, characters 20-23:
-|  Error: The reference nat was not found in the current environment.
-|  
+|  cannot guess a path for Coq libraries; please use -coqlib option or ensure you have installed the package containing Coq's stdlib (coq-stdlib in OPAM) If you intend to use Coq without a standard library, the -boot -noinit options must be used.
+|  cannot guess a path for Coq libraries; please use -coqlib option or ensure you have installed the package containing Coq's stdlib (coq-stdlib in OPAM) If you intend to use Coq without a standard library, the -boot -noinit options must be used.
  1. When you do git checkout 3.7.1 and run the tests again, you will see that they succeed.

CC @ejgallego @Alizter

LasseBlaauwbroek added a commit to coq-tactician/coq-tactician that referenced this issue Oct 17, 2023
@Alizter Alizter added the coq label Oct 17, 2023
LasseBlaauwbroek added a commit to coq-tactician/coq-tactician-dummy that referenced this issue Oct 17, 2023
LasseBlaauwbroek added a commit to LasseBlaauwbroek/opam-coq-archive that referenced this issue Oct 17, 2023
@Alizter
Copy link
Collaborator

Alizter commented Oct 18, 2023

The fact that coqc --config fails when no stdlib is present is a bug and should be reported upstream. We can work around it in Dune but we will no longer be able to use native compilation rules in this case. It's also difficult to test as we would have to have another CI job that has just coq-core which seems a bit wasteful of our CI resources.

@LasseBlaauwbroek
Copy link
Contributor Author

An issue for this already exists: coq/coq#16295

@Alizter Alizter self-assigned this Oct 18, 2023
@Alizter
Copy link
Collaborator

Alizter commented Oct 18, 2023

I'm going to recreate the issue you ran into and see if I can make a reproduction case without the special setup. What's weird is that rereading the code, it seems there should be a fail-safe for when config fails, so I'm not sure what exactly is failing here just yet.

@Alizter
Copy link
Collaborator

Alizter commented Oct 18, 2023

I've chased down the issue some more and it now appears that coqc --config is not the culprit. It's actually because we are querying coqc --version but that too fails! I'll make this more resilient. This is yet another bug in Coq that should probably be reported upstream. It's a shame that something as simple as a version number has to initialize the Coq enviornment and trigger unrelated errors.

@LasseBlaauwbroek
Copy link
Contributor Author

Ah, good find!

I should note that coqc --version -boot does work without stdlib. So that should be an easy fix :-)

@ejgallego
Copy link
Collaborator

Good find @Alizter ! Indeed we need to be a bit more defensive on this side, and fix Coq upstream of course!

@ejgallego
Copy link
Collaborator

Thanks @LasseBlaauwbroek for the report by the way; we have a couple more open issues pending for composed / (no stdlib) builds; that means that indeed we are blocked on our own projects to dune 3.7

I hope to be able to have some time for this soon.

@Alizter
Copy link
Collaborator

Alizter commented Oct 18, 2023

I have tests and fixes ready for this, just need some time to clean them up.

emillon added a commit to emillon/opam-repository that referenced this issue Nov 28, 2023
CHANGES:

- Introduce `$ dune ocaml doc` to open and browse documentation. (ocaml/dune#7262, fixes
  ocaml/dune#6831, @EmileTrotignon)

- `dune cache trim` now accepts binary byte units: `KiB`, `MiB`, etc. (ocaml/dune#8618,
  @Alizter)

- No longer force colors for OCaml 4.03 and 4.04 (ocaml/dune#8778, @rgrinberg)

- Introduce new experimental odoc rules (ocaml/dune#8803, @jonjudlam)

- Introduce the `runtest_alias` field to the `cram` stanza. This allows
  removing default `runtest` alias from tests. (@rgrinberg, ocaml/dune#8887)

- Do not ignore libraries named `bigarray` when they are defined in conjunction
  with OCaml 5.0 (ocaml/dune#8902, fixes ocaml/dune#8901, @rgrinberg)

- Dependencies in the copying sandbox are now writeable (ocaml/dune#8920, @rgrinberg)

- Absent packages shouldn't prevent all rules from being loaded (ocaml/dune#8948, fixes
  ocaml/dune#8630, @rgrinberg)

- Correctly determine the stanza of menhir modules when `(include_subdirs
  qualified)` is enabled (@rgrinberg, ocaml/dune#8949, fixes ocaml/dune#7610)

- Display cache location in Dune log (ocaml/dune#8974, @nojb)

- Re-run actions whenever `(expand_aliases_in_sandbox)` changes (ocaml/dune#8990,
  @rgrinberg)

- Rules that only use internal dune actions (`write-file`, `echo`, etc.) can
  now be sandboxed. (ocaml/dune#9041, fixes ocaml/dune#8854, @rgrinberg)

- Do not re-run rules when their location changes (ocaml/dune#9052, @rgrinberg)

- Correctly ignore `bigarray` on recent version of OCaml (ocaml/dune#9076, @rgrinberg)

- Add `test_` prefix to default test name in `dune init project` (ocaml/dune#9257, fixes
  ocaml/dune#9131, @9sako6)

- Add `coqdoc_flags` field to `coq` field of `env` stanza allowing the setting
  of workspace-wide defaults for `coqdoc_flags`. (ocaml/dune#9280, fixes ocaml/dune#9139, @Alizter)

- [coq rules] Be more tolerant when coqc --print-version / --config don't work
  properly, and fallback to a reasonable default. This fixes problems when
  building Coq projects with `(stdlib no)` and likely other cases. (ocaml/dune#8966, fix
  ocaml/dune#8958, @Alizter, reported by Lasse Blaauwbroek)

- Dune will now run at a lower framerate of 15 fps rather than 60 when
  `INSIDE_EMACS`. (ocaml/dune#8812, @Alizter)

- dune-build-info: when `version=""` is found in a `META` file, we now return
  `None` as a version string (ocaml/dune#9177, @emillon)

- Dune can now be built and installed on Haiku (ocaml/dune#8795, fix ocaml/dune#8551, @Alizter)

- Mark installed directories in `dune-package` files. This fixes `(package)`
  dependencies against packages that contain such directories. (ocaml/dune#8953, fixes
  ocaml/dune#8915, @emillon)
LasseBlaauwbroek added a commit to coq-tactician/coq-tactician that referenced this issue Apr 11, 2024
LasseBlaauwbroek added a commit to LasseBlaauwbroek/opam-coq-archive that referenced this issue Apr 11, 2024
LasseBlaauwbroek added a commit to coq-tactician/coq-tactician-dummy that referenced this issue Apr 11, 2024
LasseBlaauwbroek added a commit to LasseBlaauwbroek/opam-coq-archive that referenced this issue Apr 11, 2024
LasseBlaauwbroek added a commit to LasseBlaauwbroek/opam-coq-archive that referenced this issue Apr 11, 2024
silene added a commit to coq/opam that referenced this issue Apr 11, 2024
thery pushed a commit to thery/opam-coq-archive that referenced this issue Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants