Skip to content

fix(recipe): scope the openblas dep off macOS (Accelerate is the platform BLAS) - #165

Merged
transfix merged 3 commits into
masterfrom
fix/macos-openblas-accelerate
Aug 4, 2026
Merged

transfix merged 3 commits into
masterfrom
fix/macos-openblas-accelerate

Conversation

@transfix

@transfix transfix commented Aug 4, 2026

Copy link
Copy Markdown
Owner

package-macos has been red since at least 2026-07-27 and was being written off as part of the Xcode 26.5 breakage. It is not that.

Cause

The recipe asked for openblas unconditionally — but openblas deliberately has no macOS build. macOS ships BLAS/LAPACK in the Accelerate framework, so libcvc-deps uses the system libraries there. From openblas's own recipe:

build:
  # No macOS entry: macOS provides BLAS/LAPACK via the Accelerate
  # framework, so we use the system libraries there instead.

So every macOS deps-install died at resolution:

Error: requested component(s) not found in the catalog for this platform tuple: openblas

Why it looked like something else

install-deps is all-or-nothing. When openblas failed to resolve, nothing was installed — so the error CMake reported was a missing libiimod at src/cvc/CMakeLists.txt:279. That named an innocent package and sent the diagnosis down the wrong path. libiimod was collateral damage, not the cause.

The pattern was already here

The assimp dep directly above this line guards against exactly this failure mode, with a comment saying so. And levmar already scopes its own openblas dep the same way:

runtime: {name: openblas, version: ">=0.3", platforms: [linux, freebsd, openbsd, netbsd]}

This dep just didn't follow it.

Why nothing breaks

Nothing needs openblas by name on macOS. libcvc reaches BLAS through levmar, whose config tries find_dependency(OpenBLAS CONFIG QUIET) and falls back to find_dependency(LAPACK) — which resolves to Accelerate.

Verification

Ran install-deps for macos/arm64 against the edited recipe:

cvcpkg: done -- 29 component(s) installed
libiimod present: yes      openblas present: no

The package the CMake error blamed now resolves; openblas is correctly absent.

Still open

Windows is a separate gap and stays red: curl, freetype and libpng have no windows bundles at all. That needs those packages published for windows, not a recipe scope change.

…form BLAS)

package-macos has been red since at least 2026-07-27 and was being written
off as part of the Xcode 26.5 breakage. It is not. The recipe asked for
openblas unconditionally, and openblas deliberately has NO macOS build --
macOS ships BLAS/LAPACK in Accelerate, so libcvc-deps uses the system
libraries there ("No macOS entry" on openblas's own build matrix).

So every macOS deps-install died at resolution:

    Error: requested component(s) not found in the catalog for this
    platform tuple: openblas

install-deps is all-or-nothing, so NOTHING got installed -- and the error
CMake then reported was a missing libiimod at src/cvc/CMakeLists.txt:279.
That named an innocent package and sent the diagnosis down the wrong path;
libiimod was collateral damage, not the cause.

This is the same failure mode the assimp dep directly above already guards
against, and levmar already scopes its own openblas dep exactly this way
(platforms: [linux, freebsd, openbsd, netbsd]). The pattern was there; this
dep just did not follow it.

Nothing needs openblas by name on macOS. libcvc reaches BLAS through
levmar, whose config tries find_dependency(OpenBLAS CONFIG QUIET) and falls
back to find_dependency(LAPACK), which resolves to Accelerate.

Verified by running install-deps for macos/arm64 against the edited recipe:
29 components install cleanly, libiimod among them, openblas absent.

Windows is a separate, still-open gap: curl, freetype and libpng have no
windows bundles, so package-windows stays red until those are published.
…e links

Scoping openblas off macOS got the deps-install working, and the build then
reached test discovery and died there:

    dyld: Library not loaded: @rpath/libfontconfig.1.dylib
      Referenced from: .../libMagickCore-7.Q16HDRI.10.dylib

That reads like a broken test harness but is not: gtest discovery RUNS the
test binary, so dyld resolves MagickCore's whole chain at that moment. An
undeclared delegate surfaces as a CMake discover_tests error, several layers
from the cause.

Rather than fix one dylib per CI round-trip, scanned the installed macOS
prefix for @rpath deps nothing in it provides. Exactly two are missing, and
both are needed by libraries libcvc links -- not just ImageMagick's CLI:

  libfontconfig.1.dylib  <- libMagickCore, libMagickWand, libMagick++
  libbz2.1.0.8.dylib     <- libMagickCore, libMagickWand, libMagick++, libfreetype

fontconfig is scoped [linux, macos]: those are the only platforms it is
published for, and libcvc also builds windows, where an unconditional dep
fails the deps-install outright -- the same trap as assimp and openblas.
bzip2 is published everywhere libcvc builds, so it needs no scope.

One false alarm worth recording: the scan also flagged
png.framework/Versions/1.6.44/png as missing. It is present; the scanner
compared basenames against a full relative path. Checked before acting.

BLOCKED on libcvc-deps#437 + a macOS bzip2 republish: the live macOS
bzip2 1.0.8+cvc.2 carries absolute symlinks into a builder scratch dir, so
declaring bzip2 today aborts the install with tarfile.AbsoluteLinkError.
@transfix

transfix commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Update: macOS root-caused to the end, but this PR is now BLOCKED

The openblas scoping worked — macOS went from dying at dependency resolution to installing deps, configuring, compiling, and reaching test discovery, where it hit:

dyld: Library not loaded: @rpath/libfontconfig.1.dylib
  Referenced from: .../libMagickCore-7.Q16HDRI.10.dylib

That looks like a broken test harness but isn't — gtest discovery runs the test binary, so dyld resolves MagickCore's whole chain at that moment. An undeclared delegate surfaces as a CMake discover_tests error several layers from the cause.

Found the remaining gaps in one pass

Instead of one dylib per CI round-trip, I scanned the installed macOS prefix for @rpath deps nothing in it provides. Exactly two, both needed by libraries libcvc links (not just ImageMagick CLI tools):

missing needed by
libfontconfig.1.dylib libMagickCore, libMagickWand, libMagick++
libbz2.1.0.8.dylib libMagickCore, libMagickWand, libMagick++, libfreetype

Both now declared. fontconfig is scoped [linux, macos] — the only platforms it's published for, and libcvc also builds windows where an unconditional dep would fail the deps-install (same trap as assimp/openblas).

One false alarm, recorded for honesty: the scan also flagged png.framework/Versions/1.6.44/png. It is present — my scanner compared basenames against a full relative path. I checked before acting rather than "fixing" a non-problem.

Blocked on libcvc-deps#437

The live macOS bzip2 1.0.8+cvc.2 ships absolute symlinks into a builder scratch dir:

bin/bzcmp -> /private/var/folders/.../cvcpkg-bzip2-5de_csjx/install/bin/bzdiff

so declaring bzip2 today aborts the install with tarfile.AbsoluteLinkError. #404 fixed that in the recipe but never bumped cvc_revision, and the macOS bundle was published 57 minutes before the fix merged — so the fix has never reached the catalog.

Order to green: merge deps#437 → republish macOS bzip2 at +cvc.3 → this PR goes green.

Until then expect the macOS job here to fail earlier (at extraction) than it did before. That is expected, not a regression.

Adding fontconfig revealed its own link. cvcpkg install is FLAT -- a
bundle's required_deps are not auto-pulled -- so every layer has to be
declared explicitly, and adding one dep can expose the next:

    libfontconfig.dylib -> @rpath/libexpat.1.10.0.dylib

Unscoped: expat is published for every platform libcvc builds.

Verified against the real catalog now that macOS bzip2 1.0.8+cvc.3 has
published (libcvc-deps#437): install-deps for macos/arm64 installs 32
components with no AbsoluteLinkError, and a Mach-O scan of the resulting
prefix reports

    510 mach-o/dylib, 147 distinct @rpath deps, MISSING 0

Every dylib the tree loads is now satisfied from inside the prefix, so the
dyld failure during gtest discovery cannot recur for a missing delegate.

The scanner used for this had a bug worth noting: it compared dep BASENAMES
against provided basenames, so png.framework/Versions/1.6.44/png -- a path,
and present -- was reported missing. Fixed to also match paths relative to
the prefix before trusting the 0.
@transfix
transfix merged commit e5ee9ba into master Aug 4, 2026
4 of 7 checks passed
@transfix
transfix deleted the fix/macos-openblas-accelerate branch August 4, 2026 07:19
transfix added a commit that referenced this pull request Aug 4, 2026
ImageTest.CopyOnWrite was the only failing test of 2080 in package-macos.
It is a test bug, not a COW bug, and it is not macOS-specific -- it is
clang vs gcc.

    EXPECT_EQ(a.storage().get(), a.data());   // image_test.cpp:93

storage() returns the shared_array BY VALUE, so the returned temporary holds
a reference and pushes use_count() to 2. data() calls detach(), which copies
whenever use_count() > 1. Both calls are arguments of ONE full-expression,
and argument evaluation order is UNSPECIFIED in C++:

    data() first    -> no extra ref, no detach      -> pointers equal
    storage() first -> temporary still alive        -> data() DETACHES

gcc picked the first order, clang the second. Reproduced locally with the
identical expression against a minimal shared_array model:

    gcc  : EXPECT_EQ(a.storage().get(), a.data()) -> PASS
    clang: EXPECT_EQ(a.storage().get(), a.data()) -> FAIL

matching the CI pointers exactly (0x1070a5940 = the buffer storage() captured,
0x1070a5b40 = the fresh one data() allocated).

Fix is to sequence data() before storage() in its own statement. Verified the
corrected sequence passes under BOTH g++ and clang++.

The implementation is correct and unchanged. Detaching while a storage()
handle is outstanding is exactly right: that handle may be a live zero-copy
view (pycvc numpy, cvcGL vtkTexture) and a mutable data() must not write
through it.

Also replaced the preceding EXPECT_EQ(a.data(), a.data()), which compared one
call to itself and so could never fail. Its comment claimed the copy "shares
the buffer", so it now asserts that via storage() -- which does not detach.
Checking sharing with data() is impossible: the first call detaches and
destroys the aliasing being observed.

Swept the tree for the same trap (a detaching and a non-detaching accessor in
one EXPECT); this was the only instance.

Only reachable now because PR #165 fixed the macOS dependency closure -- the
macOS build previously died in cvcpkg install-deps and never ran a test.
transfix added a commit that referenced this pull request Aug 4, 2026
#166)

ImageTest.CopyOnWrite was the only failing test of 2080 in package-macos.
It is a test bug, not a COW bug, and it is not macOS-specific -- it is
clang vs gcc.

    EXPECT_EQ(a.storage().get(), a.data());   // image_test.cpp:93

storage() returns the shared_array BY VALUE, so the returned temporary holds
a reference and pushes use_count() to 2. data() calls detach(), which copies
whenever use_count() > 1. Both calls are arguments of ONE full-expression,
and argument evaluation order is UNSPECIFIED in C++:

    data() first    -> no extra ref, no detach      -> pointers equal
    storage() first -> temporary still alive        -> data() DETACHES

gcc picked the first order, clang the second. Reproduced locally with the
identical expression against a minimal shared_array model:

    gcc  : EXPECT_EQ(a.storage().get(), a.data()) -> PASS
    clang: EXPECT_EQ(a.storage().get(), a.data()) -> FAIL

matching the CI pointers exactly (0x1070a5940 = the buffer storage() captured,
0x1070a5b40 = the fresh one data() allocated).

Fix is to sequence data() before storage() in its own statement. Verified the
corrected sequence passes under BOTH g++ and clang++.

The implementation is correct and unchanged. Detaching while a storage()
handle is outstanding is exactly right: that handle may be a live zero-copy
view (pycvc numpy, cvcGL vtkTexture) and a mutable data() must not write
through it.

Also replaced the preceding EXPECT_EQ(a.data(), a.data()), which compared one
call to itself and so could never fail. Its comment claimed the copy "shares
the buffer", so it now asserts that via storage() -- which does not detach.
Checking sharing with data() is impossible: the first call detaches and
destroys the aliasing being observed.

Swept the tree for the same trap (a detaching and a non-detaching accessor in
one EXPECT); this was the only instance.

Only reachable now because PR #165 fixed the macOS dependency closure -- the
macOS build previously died in cvcpkg install-deps and never ran a test.

Co-authored-by: Joe Rivera <[email protected]>
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