Skip to content

Build: the lld stage link fails on Xcode 27's SDK (.tbd target arm64e.x1-macos) when SDKROOT points at it; comp_host_sdk_path trusts SDKROOT unchecked #1826

Closed

Description

@ehartford

Symptom

src/main build fails at the stage2 link (lld path) when the environment exports SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX27.0.sdk (what this host's shell had on 2026-09-27):

ld64.lld: error: could not load TAPI file at …/MacOSX27.0.sdk/usr/lib/libm.tbd: malformed file
…/MacOSX27.0.sdk/usr/lib/libm.tbd:4:20: error: unknown architecture
                   arm64e.x1-macos, arm64e.x1-maccatalyst ]
ld64.lld: error: undefined symbol: _bzero   (then _memcpy, _abort, … — libSystem.tbd and libc++.tbd fail the same way)
error: build.w target 'stage2' failed with exit code 1

The same tree builds green with SDKROOT unset (comp_host_sdk_path then picks /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk).

Cause

build/compiler.w comp_host_sdk_path returns SDKROOT first, unchecked. Xcode 27's .tbd files list the target arm64e.x1-macos, which our ld64.lld 22.1.6 does not parse. (Same class as the 2026-09-16 bisect note, which then only hit old commits; the stage2 link reads libm/libSystem/libc++ tbd today.)

Expected

Either the lld link path takes an SDK whose tbd files it can read (and says which it took), or the build refuses up front with one clear diagnostic naming the SDK and the unparseable target, instead of a stage2 link failure with hundreds of undefined symbols. Whichever: a battery driven from a shell with Xcode 27's SDKROOT must not go red for an environment reason at stage2.

Found while building #1810 (fix-strview); worked around with env -u SDKROOT.

Activity

  1. added
    bug
    on Sep 28, 2026
  2. ehartford commented on Sep 30, 2026

    @ehartford
    ContributorAuthor

    Fixed on main: e074a10 (#1913) pins the LLVM SDK in sdk.lock — the published darwin SDK carries the arm64e.x1 backport, :deps installs it, and a compiler link refuses any other .deps SDK — and 8b6b850 (#1926) removes the Apple SDK from the build entirely (the compiler links with its own sysroot and lld). Verified: full build with SDKROOT at MacOSX27.0.sdk; the stack battery green on 3b9d06a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions