Repository navigation
Preserve the inherited pkg-config environment on macOS - #17078
Merged
Merged
Conversation
aikhanjum
marked this pull request as ready for review
November 17, 2026 05:59
rgrinberg
force-pushed
the
fix-configurator-brew-env
branch
from
November 22, 2026 14:50
f9ceab5 to
a2280cf
Compare
Add a macOS regression for inherited variables when a Homebrew pkg-config search path is present, including existing path precedence and the case without a Homebrew package directory. Signed-off-by: Aikhan Jumashukurov <[email protected]>
Merge explicit environment bindings with the inherited environment before Unix.create_process_env, allowing explicit bindings to override matching variables. This preserves settings used by pkg-config and wrappers. Related to ocaml#10805. Signed-off-by: Aikhan Jumashukurov <[email protected]>
Signed-off-by: Aikhan Jumashukurov <[email protected]>
Stub the compiler system so the Homebrew path is testable on Linux. Check that query_variable inherits PKG_CONFIG_LIBDIR as well as the search path. Signed-off-by: Rudi Grinberg <[email protected]>
Precompute override names before filtering inherited bindings. Keep override precedence and environment ordering unchanged. Signed-off-by: Rudi Grinberg <[email protected]>
rgrinberg
force-pushed
the
fix-configurator-brew-env
branch
from
November 22, 2026 14:57
a2280cf to
cb9030c
Compare
Member
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When Homebrew adds a pkg-config search path, configurator passes an explicit
PKG_CONFIG_PATHbinding toUnix.create_process_env. That replaces the inheritedenvironment and drops settings such as
PKG_CONFIG_LIBDIRandPKG_CONFIG_SYSROOT_DIR, causing a package that depends on those settings to bereported as missing.
Merge the explicit bindings with the inherited environment, with explicit
bindings taking precedence. The macOS regression uses controlled
brewandpkg-configexecutables to cover inherited variables, existing search-pathprecedence, and packages without a Homebrew directory.
Related to #10805. The original vcpkg setup in that issue has not been reproduced.
Validation performed against main at
5a68b1910384be91a56b8f99046b00db6b87b8ab../dune.exe build --cache=disabled @check @fmtpassed on macOS../dune.exe runtest --cache=disabled otherlibs/configurator/test/blackbox-testspassed on macOS. The saved before-fix regression reports
package missing../dune.exe build --cache=disabled @check @fmt @runtestwas run on Linuxarm64 with OCaml 5.5.2 in the repository's pinned Nix development shell. The
final fresh run failed in
pkg/opam-package-with-build-env.tandpkg/pkg-extract-fail.twithLock directory is not active for context "default". Earlier runs hit the same error in other package-lock cases.A separate clean upstream checkout reproduced the same error in
pkg/pin-stanza/opam-template.t. No expectations were changed or promoted.fsevents_tests.mlexpectation failure alsoreproduced on clean upstream.
AI assistance was used to prepare and validate this change.