Variable expansion based on the output of coqc --config, such as %{coq:version.major}, is broken when Coq itself is in the workspace. This leads to errors like the following:
Error: Could not expand %{coq:version.minor} as running coqc --config failed
The reason making coqc fail is that it does not know where to find the standard library.
This can be reproduced using the following:
mkdir workspace_bug
cd workspace_bug
echo "(lang dune 3.8)" > dune-workspace
git clone [email protected]:coq/coq.git
mkdir test
echo "(rule (action (with-outputs-to coq-version.txt (echo \"%{coq:version.major}\"))))" > test/dune
dune build test
CC @ejgallego @Alizter