Skip to content

pack: run prepare commands from xtool.yml and link Darwin compiler-rt on Linux - #369

Draft
zdehasek wants to merge 1 commit into
xtool-org:mainfrom
zdehasek:prepare-and-compiler-rt
Draft

zdehasek wants to merge 1 commit into
xtool-org:mainfrom
zdehasek:prepare-and-compiler-rt

Conversation

@zdehasek

Copy link
Copy Markdown

What does this PR do?

  1. xtool.yml gains prepare, a list of shell commands run in the package directory before planning; a failing command stops the build. Documented in Control.md. Packages that depend on generated inputs, such as a binary target produced by another compiler, previously needed a wrapper script around xtool; with prepare, xtool dev alone builds and installs them.
  2. On non-Apple hosts, the generated builder package links the platform's compiler-rt builtins archive from the installed Darwin SDK (libclang_rt.ios.a, .iossim.a or .osx.a, chosen from the build triple). Apple's clang driver always links these builtins; the Linux clang that drives the link here does not, so any dependency using __builtin_available (every Kotlin/Native framework, among others) fails with undefined symbol: ___isPlatformVersionAtLeast. The SDK bundle already carries Xcode's toolchain with the archive.

How was it tested?

  • PackerTests.compilerRTLibraryNameFollowsBuildTriple (unit).
  • On Linux x64 with Swift 6.4 and the SDK from Xcode 26.4.1: a SwiftPM app that links a Kotlin/Native static xcframework and declares a prepare step builds with xtool dev build --ipa (the generated builder package carries the compiler-rt path, and the link no longer needs the archive copied into the host clang's resource directory), then installs with xtool install and launches on an iPhone.
  • Not tested on macOS (the compiler-rt lookup is compiled out there) or on Windows.

AI tool usage

How much of this PR was AI-assisted? (check one)

  • 0 - No AI was used to write code
  • 1 - I was assisted by AI. I reviewed the finished result.
  • 2 - I set the AI going and left it to it; nobody has read the result - no review, or AI review only

Opened as a draft per the template; I will mark it ready after reviewing the diff myself.

…rt on Linux

`xtool.yml` gains `prepare`, a list of shell commands run in the package
directory before planning, so a package that depends on generated inputs (such
as a binary target built by another compiler) builds with `xtool dev` alone.

On non-Apple hosts, the generated builder package links the platform's
compiler-rt builtins archive from the installed Darwin SDK. Apple's clang
driver always links it; the Linux clang that drives the link here does not,
so any dependency using `__builtin_available` (a Kotlin/Native framework,
for example) failed with `undefined symbol: ___isPlatformVersionAtLeast`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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