Skip to content

build(deps): keep Homebrew out of local dependency child builds - #5361

Draft
zachlewis wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
zachlewis:zl-fix_dep_isolation
Draft

build(deps): keep Homebrew out of local dependency child builds#5361
zachlewis wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
zachlewis:zl-fix_dep_isolation

Conversation

@zachlewis

Copy link
Copy Markdown
Collaborator

Motivation

IGNORE_HOMEBREWED_DEPS=ON prunes the Homebrew prefixes from the search paths and sets CMAKE_IGNORE_PATH, but CMAKE_IGNORE_PATH is not honored by config-package searches — and the local dependency child builds launched by build_dependency_with_cmake can therefore quietly resolve Homebrew packages that the parent build is deliberately ignoring.

Concrete failure: with Homebrew Imath 3.2 installed, a local OpenEXR dependency build resolved Imath_DIR=/opt/homebrew/lib/cmake/Imath while OpenImageIO itself compiled against the locally built Imath 3.1.10. Imath's versioned namespace is baked into every mangled symbol, so the mismatch (Imath_3_2 vs Imath_3_1) surfaced as unresolved symbols when linking libOpenImageIO. (This is an instance of the auto-build "sharp edges" discussed on #5313.)

What this does

  • In the IGNORE_HOMEBREWED_DEPS block, also append the Homebrew prefixes to CMAKE_IGNORE_PREFIX_PATH (CMake ≥ 3.23), which config-package searches do honor.
  • Forward CMAKE_IGNORE_PREFIX_PATH to dependency child builds alongside the existing CMAKE_IGNORE_PATH forwarding.

What it deliberately does not do

No behavior change when IGNORE_HOMEBREWED_DEPS is off and CMAKE_IGNORE_PREFIX_PATH is unset — both hunks are conditional on the variable being non-empty.

Testing

On macOS (arm64, Homebrew Imath 3.2.2 present), IGNORE_HOMEBREWED_DEPS=ON + OpenImageIO_BUILD_MISSING_DEPS=all:

  • before: OpenEXR child build cached Imath_DIR=/opt/homebrew/lib/cmake/Imath; libOpenImageIO failed to link with Imath_3_2/Imath_3_1 symbol mismatches;
  • after: child build resolves the local deps-dist Imath and libOpenImageIO links clean.

Assisted-by: Claude Code (Fable 5)

IGNORE_HOMEBREWED_DEPS pruned prefix paths and set CMAKE_IGNORE_PATH,
but CMAKE_IGNORE_PATH does not stop config-package searches, and local
dependency child builds could still quietly resolve Homebrew packages
we are ignoring. Concretely: with a Homebrew Imath 3.2 installed, the
local OpenEXR build resolved Imath_DIR=/opt/homebrew/lib/cmake/Imath
while OpenImageIO itself used the locally built Imath 3.1.10, and
libOpenImageIO then failed to link with Imath_3_2 vs Imath_3_1
namespace-mangled symbol mismatches.

Set CMAKE_IGNORE_PREFIX_PATH for the Homebrew prefixes (honored by
config searches) and forward it to dependency child builds alongside
CMAKE_IGNORE_PATH. Verified: the OpenEXR child build resolves the
local deps Imath and libOpenImageIO links clean.

Assisted-by: Claude Code (Fable 5)
Signed-off-by: Zach Lewis <zachcanbereached@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant