Repository navigation
fix(lib_config): only localize stdlib if its in a context - #16563
Conversation
|
I still need to review the tests here, clean up LLM garbage descriptions, verify the logic is all sound in the repro, and confirm the oxcaml trunk build goes thru now (I'm getting a different, I think unrelated failure, trying to build it locally, but I'll need to debug with fresh eyes tomorrow). |
|
The CI failures here look to be on main, and I think Ali has diagnosed at #16561 (comment) |
55fb8ad to
659a32c
Compare
| ;; | ||
|
|
||
| let create ocaml_config ~ocamlopt = | ||
| let create ocaml_config ~ocamlopt ~stdlib_dir = |
There was a problem hiding this comment.
I'm not crazy about adding this extra argument, but AFAIK the alternative is to make this pure computation become a t Memo.t, because we need to search in the registered contexts.
|
@shonfeder Would you mind splitting the reproduction case into a separate PR? The test commit will likely fail, since locally it doesn't seem to be atomic. It will allow us to consider dropping the menhir dependency too which I suspect is not necessary. |
|
edit: ah, just means local to the commit. Indeed, that commit is missing expected output in the cram test. Good catch, thanks. |
659a32c to
3fb387c
Compare
It is an established convention for artifacts to end up in _build that are not tracked by dune's build engine, so long as they stay out of dune's workspace contexts or its private directories. Dune itself does this with its trace files, but we also see this with oxcaml, which puts artifacts in a _build/_bootinstall (e.g., in https://github.com/oxcaml/oxcaml/blob/main/Makefile.common-ox#L216-L228). It is reasonable, and convenient for users, for dune to to allow this. However, oxcaml happens to be locating a built compiler in that location, which caused the fix in #16374 to produce a regression when building the oxcaml trunk for the following reason: the fix in #16374 ensured that the stdblib provided by portable compilers via dune package management was made accessible in sandboxed builds cross all supported platforms (as far as we know). To achieve this, it localizes the path to the stdlib *if* the stdlib is in the build directory. This is reasonable to do under the assumption that anything within the _build directory is managed by dune's build. However, this invariant does not hold, as shown by the the convention of putting stuff that is not part of dune's build in the root of the _build directory. This fix weakens the assumption, so that now only stdlibs located within a registered *context* within the _build directory get localized. The required invariant should indeed hold in that case, and we avoid the build failure on oxcaml (or any other project doing similar things). Signed-off-by: Shon Feder <[email protected]>
3fb387c to
faa54cc
Compare
## Description The oxcaml trunk builds started failing. I think this was due to https://github.com/oxcaml/oxcaml/pull/6562/changes#diff-6cff31f46da42c5f179cda29f9fe7f8dbb6441dcb4d1bd5bfa0a2b9070d87325R107 which ends up leading to tests being built and run on C++, if it's available (as per the target at https://github.com/oxcaml/oxcaml/pull/6562/changes#diff-84be0d67b9397fd509a12b5fbc24ec217c1a8f3900388234f6a2a28d102211bbR1266). The `NIX_CFLAGS_COMPILE` apparently get passed to both C++ and C compilation, but `-std=gnu17` is not valid for C++, leading to the error: ``` cc1plus: error: command-line option '-std=gnu17' is valid for C/ObjC but not for C++ [-Werror] cc1plus: all warnings being treated as errors ``` As per NixOS/nixpkgs#79303, `CFLAGS` (resp. `CXXFLAGS` should be preferred). Applying that fix here allows us to get a clean build of the oxcaml trunk with dune. CI results: - The motivating build failure: https://github.com/ocaml/dune/actions/runs/37988037703/job/114014841515 - A job run against this fix: https://github.com/ocaml/dune/actions/runs/37992567833/job/114030249421 Note that this is on top of #16563 and will need a rebase once that is merged. ## Checklist - [x] Tests added, if applicable. - [x] [Change log entry added](../CONTRIBUTING.md#updating-the-changelog) for any user-facing changes. - [x] Documentation added for any user-facing changes.
Description
This weaken the assumption governing when paths to the stdlib placed within the
_builddirectory are localized: previously, they were localized whenever the path wish in the_builddirectory; we now only localize the path if it is within a registered context. See 659a32c for a more detailed account of the rationale.Related Issue and Motivation
Fixes #16521
Followup to #16374
Checklist
Unbound module Stdlibwhen a project uses menhir with package management #16374 (comment)