Skip to content

fix(host): forward Apple SDK clang resource-dir for Darwin compiler-rt linking - #7

Merged
Apdelrahman1911 merged 1 commit into
mainfrom
fix/clang-resource-dir
Dec 5, 2026
Merged

Apdelrahman1911 merged 1 commit into
mainfrom
fix/clang-resource-dir

Conversation

@Apdelrahman1911

Copy link
Copy Markdown

Root cause

On Linux, OriginalHostCompiler passes -Xclang-linker -isysroot to swiftc so clang locates the Darwin SDK, but did not pass -Xclang-linker -resource-dir pointing to the Apple SDK Clang resource directory containing lib/darwin/libclang_rt.iossim.a / lib/darwin/libclang_rt.ios.a.

As a result, any original SwiftUI/UIKit host containing @available(iOS ..., *) checks (such as Compose graphics hosts and production iOS apps) failed linking on Linux with:

ld64.lld: error: undefined symbol: __isPlatformVersionAtLeast

Changes

  • Resolve AppleBuildDestination.clangResourceDirPath from <swiftResources>/clang (or fallback Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/<version>) when genuine lib/darwin/libclang_rt.{iossim,ios}.a is present.
  • Forward -Xclang-linker -resource-dir -Xclang-linker <clangResourceDir> in OriginalHostCompiler.frameworkAndLinkerFlags (covering both direct linking and split .dSYM linking) unless overridden via extraSwiftFlags.
  • Add unit tests in SDKBuilderTests covering both arm64-apple-ios and arm64-apple-ios-simulator, custom override preservation, and usr/lib/clang/<version> fallback.

@Apdelrahman1911
Apdelrahman1911 merged commit 00b2a79 into main Dec 5, 2026
7 checks passed
@Apdelrahman1911
Apdelrahman1911 deleted the fix/clang-resource-dir branch December 5, 2026 20:20
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