Skip to content

[FIX] Fix macOS CMake builds: drop Corrosion's hard-coded CLT SDK link dir - #2384

Merged
cfsmp3 merged 1 commit into
masterfrom
fix/mac-cmake-clt-sdk
Oct 17, 2026
Merged

cfsmp3 merged 1 commit into
masterfrom
fix/mac-cmake-clt-sdk

Conversation

@cfsmp3

@cfsmp3 cfsmp3 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

Any macOS CMake build on the current macos-26-arm64 runner image (e.g. the cmake, cmake_ocr_hardsubx and cmake_ffmpeg_mp4 jobs of "Build CCExtractor on Mac", failing on master since Oct 15) stops at the final link:

ld: multiple errors: tapi error: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX27.0.sdk/usr/lib/libiconv.2.tbd:4:20: error: unknown architecture
 in '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libiconv.tbd'

Corrosion hard-codes /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib as an INTERFACE_LINK_DIRECTORIES entry of the Rust static library on macOS (Corrosion.cmake, still present in Corrosion 0.6.1, so upgrading doesn't help). The runner image of 2026-10-13 installed a macOS 27 SDK and repointed that MacOSX.sdk symlink to it, while the selected toolchain is still Xcode 26.6 (SDK 26.5). Compilation uses the Xcode SDK, but the explicit -L makes Xcode 26's ld pick up the 27 SDK's .tbd stubs, which it can't parse.

The libraries rustc asks for (-lSystem -lc -lm) resolve through the compiler's own SDK without that -L — the shell and autoconf builds on the same runner link fine — so this clears the property on Apple after corrosion_import_crate. Linux and Windows are unaffected (the block is if(APPLE)).

Verified on the macOS runners: all 9 jobs of "Build CCExtractor on Mac" pass on this branch, including the three CMake jobs. Diagnosis (runner SDK layout, the CMake link script showing the stray -L) came from a throwaway CI branch.

Corrosion adds /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
as an interface link directory of the Rust static library on macOS
(still the case in Corrosion 0.6.1). Since the macos-26-arm64 runner
image of 2026-10-13, that symlink points to a macOS 27 SDK while the
selected toolchain is Xcode 26.6, and its ld rejects the 27 SDK's .tbd
stubs ("unknown architecture"). Every macOS CMake build has failed to
link since.

The libraries rustc asks for (-lSystem -lc -lm) resolve through the
compiler's own SDK without the extra -L, as the shell and autoconf
builds on the same runner show, so clear the property.
@cfsmp3
cfsmp3 merged commit 6370ecf into master Oct 17, 2026
47 of 49 checks passed
@cfsmp3
cfsmp3 deleted the fix/mac-cmake-clt-sdk branch October 17, 2026 23:38
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