Skip to content

CI(macos): silence example-build ld deployment-target warnings in test-distribution#6159

Merged
Fedr merged 5 commits into
masterfrom
fix/macos-examples-deployment-target
May 27, 2026
Merged

CI(macos): silence example-build ld deployment-target warnings in test-distribution#6159
Fedr merged 5 commits into
masterfrom
fix/macos-examples-deployment-target

Conversation

@Fedr
Copy link
Copy Markdown
Contributor

@Fedr Fedr commented May 25, 2026

What

Bump the deployment target of the C/C++ example builds in macos-test (.github/workflows/test-distribution.yml) to 12.7 only on macOS-12 hosts, leaving the SDK default in place everywhere else:

if [ "$(sw_vers -productVersion | cut -d. -f1)" -lt 13 ]; then
  export MACOSX_DEPLOYMENT_TARGET=12.7
fi

Why

The test-distribution / macos-test (x64, macos-12-intel, *x64.pkg) job was producing a wall of linker warnings against every dylib in the installed framework, e.g.:

ld: warning: dylib (.../MeshLib.framework/.../libMeshLibC2.dylib) was built for newer macOS version (12.7) than being linked (12.0)

(See run https://github.com/MeshInspector/MeshLib/actions/runs/26396912525/job/77711295815.)

The mismatch has two ends:

  • The framework dylibs are stamped at min-macOS 12.7. MeshLib's top-level CMakeLists.txt (lines 26-28) defaults CMAKE_OSX_DEPLOYMENT_TARGET to 12.7 on macOS, and that value is baked into every libMR*.dylib / libMeshLibC2.dylib shipped in the .pkg.
  • The example binaries were stamped at min-macOS 12.0. The cmake .. invocations for examples/cpp-examples and examples/c-examples don't set a deployment target, so AppleClang on the self-hosted macos-12-intel runner falls back to the macOS-12 SDK's default min-macOS of 12.0.

ld then sees a 12.0-target binary linking against 12.7-target dylibs and warns for every example. Only the macos-12-intel cell showed this — on macOS-13+ cells the SDK default min-macOS is already >= 12.7.

Why the fix is conditional

The obvious fix — exporting MACOSX_DEPLOYMENT_TARGET=12.7 unconditionally — fixes macos-12-intel but introduces the symmetric warning on newer cells, because the brew bottles there are built at the host's macOS version:

# macos-13 arm64
ld: warning: dylib (/opt/homebrew/lib/libfmt.12.1.0.dylib) was built for newer macOS version (13.0) than being linked (12.7)
# macos-26 / macos-26-intel
ld: warning: building for macOS-12.7, but linking with dylib '.../libjsoncpp.27.dylib' which was built for newer version 26.0

The warning fires whenever any linked dylib's min-macOS exceeds the binary's link target. Forcing 12.7 everywhere drops the target below the brew bottles on every macOS-13+ host. So the target is bumped to 12.7 only when the host SDK would otherwise default below it (macOS-12); on macOS-13+ the SDK default already covers both MeshLib's 12.7 and the brew bottles.

Scope

CI workflow only. No source, no CMake files, no example logic touched. The 12.7 literal matches the constant in the top-level CMakeLists.txt; if that moves, both should move together.

Test plan / results

Verified on run https://github.com/MeshInspector/MeshLib/actions/runs/26468388117 — all 7 macos-test cells pass with zero ld warnings:

Cell Original master Unconditional 12.7 This PR (conditional)
x64, macos-12-intel 65 0 0
x64, macos-15-intel 0 0 0
x64, macos-26-intel 0 133 0
arm64, macos-13 0 124 0
arm64, macos-14 0 0 0
arm64, macos-15 0 0 0
arm64, macos-26 0 133 0
  • macos-12-intel cell: original 65 warnings gone.
  • All other cells: still warning-free (no regression from the conditional).
  • MeshModification example still runs at the end of "Build C++ examples".

Note: test-distribution.yml is invoked via workflow_call from the release pipeline; on this PR it was exercised by applying the upload-binaries label.

Match the deployment target baked into the framework dylibs
(CMAKE_OSX_DEPLOYMENT_TARGET=12.7 from top-level CMakeLists.txt) so the
C/C++ example builds in the macos-test distribution job don't link with
the macos-12 SDK's default min-macOS of 12.0, which produces
"dylib (libMR*.dylib) was built for newer macOS version (12.7) than
being linked (12.0)" ld warnings on the macos-12-intel cell.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fedr and others added 3 commits May 25, 2026 16:07
Empty commit to re-run CI now that the upload-binaries label is applied,
so test-distribution / macos-test (x64, macos-12-intel) actually executes
and we can confirm the "dylib was built for newer macOS version (12.7)
than being linked (12.0)" warnings are gone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The first cut of this fix exported MACOSX_DEPLOYMENT_TARGET=12.7
unconditionally on every macos-test cell. That silenced the original
warnings on the macos-12-intel cell (where the macOS-12 SDK defaults
the link target to 12.0, lower than the framework dylibs' 12.7), but
introduced symmetric warnings on macos-13/26 cells:

    ld: warning: dylib (.../libfmt.12.1.0.dylib) was built for newer
      macOS version (13.0) than being linked (12.7)

The brew bottles on those hosts are built at the host's macOS version
(13.0, 14.0, 26.0), so forcing the link target down to 12.7 makes the
brew dependencies "newer than being linked" instead.

Gate the export on the host's macOS major version: apply 12.7 only on
hosts older than 13, where the SDK default would otherwise fall below
MeshLib's 12.7. On macOS-13+ hosts the SDK's default min-macOS is
already >= 12.7 and >= every brew bottle on that host, so both classes
of warning stay silent.

Net effect across the matrix vs. the original master run:
- x64, macos-12-intel: 65 warnings -> 0 (original symptom, fixed)
- arm64, macos-13:        0 warnings ->   0 (regression from the
  previous commit reverted)
- arm64, macos-26:        0 warnings ->   0 (ditto)
- x64, macos-26-intel:    0 warnings ->   0 (ditto)
- all other cells:        0 -> 0 (unchanged)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Fedr Fedr changed the title CI(macos): set MACOSX_DEPLOYMENT_TARGET=12.7 for example builds in test-distribution CI(macos): silence example-build ld deployment-target warnings in test-distribution May 27, 2026
@Fedr Fedr requested a review from Grantim May 27, 2026 07:06
Copy link
Copy Markdown
Contributor

@Grantim Grantim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment seems too large

Condense the 9-line explanation above the example-build steps to 3 lines.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Fedr Fedr merged commit bedb20b into master May 27, 2026
19 checks passed
@Fedr Fedr deleted the fix/macos-examples-deployment-target branch May 27, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants