Skip to content

Linux release compiler requires external ld.lld to link ordinary programs #1167

Closed

Description

@ehartford

The Linux release compiler cannot link a one-line program on a host with the system C toolchain but no external LLVM SDK on PATH.

Reproduced on Linux arm64 with a fresh seed-driven release build of 196f0a00 (the current floating-package investigation), using the pinned Linux seed SHA256 3e54f7839dbf9549233a19753c897fb08f493fa8cfafeeec25b62fa87a43aac3.

out/release/bin/with -e 'print("clean-host link probe")'
collect2: fatal error: cannot find 'ld'
compilation terminated.

Exit status: 1. GNU ld is installed. The missing executable is actually ld.lld.

Instruction-level evidence: native GDB stopped at the entry of with_exec_argv in this release compiler. The argument blob contained cc and -fuse-ld=lld; the stack was LinkStageCommand.run -> link_stage_result_for_command -> compilation_execute_binary_link_plan. A strace of the same path in the earlier compiler records collect2 searching PATH for ld.lld and receiving ENOENT.

Root: src/compiler/Link.w, link_stage_make_link_command, Linux branch at line 329 unconditionally appends -fuse-ld=lld (and --icf=all), while the ordinary user-program link invokes system cc. No compiler-owned linker is supplied on this path.

Expected: the release compiler links using its self-contained toolchain. AGENTS.md's Self-Contained Toolchain invariant explicitly prohibits an external LLVM resource dependency after bootstrap. Setting runtime LLVM_PREFIX or putting the build SDK on PATH is not a valid release fix.

Build-time SDK PATH allowed bootstrap to finish; removing it before the user-program probe exposed the defect. No runtime workaround has been adopted.

Local evidence: out/with-get-investigation/linux-current-no-sdk-path-run.log, linux-current-linker-exec-gdb.log, and linux-link-spawn-strace.log. This blocks clean-host Linux verification alongside #1165 and #1166.

Activity

  1. added 3 commits that reference this issue on Sep 18, 2026
    83f057d
    9f9177d
    fe4eaa4
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions