Skip to content

Self-host M5: gen-0 bootstrap link scripts still shell out to Zend php bin/compile.php #2842

Description

@PurHur

Milestone

M5 (bootstrap driver) — parent #1492 (closed #1521 proved native driver smoke; gen-0 entrypoints still Zend)

Problem

M4 ladder is green (make bootstrap-loop-probe, gen-2→gen-3 717/717), and BOOTSTRAP_M5_DRIVER_SMOKE=1 make bootstrap-selfhost-driver-smoke uses a compiled gen-2 driver for emit+run. Yet every fresh tree still requires host Zend for the first native link:

script/bootstrap-selfhost-link.sh (and siblings) call:

php "${ROOT}/bin/compile.php" -o "${OUT}" "${ENTRY}"

Harness 2026-05-27: build/selfhost-compile-driver and PHP_COMPILER_M3_SOURCE=bin/compile.php helloworld-compile-bin are green, but bootstrap-selfhost-link does not use them for gen-0.

Scope

Path Work
script/bootstrap-selfhost-link.sh After one-time gen-0 link, prefer build/selfhost-compile-driver or build/bin-compile-aot when present
script/bootstrap-selfhost-lib-spine-smoke-link.sh Same pattern for spine link
script/bootstrap-loop-gen1-link.sh Ensure gen-1 path does not re-invoke Zend when compiled driver exists
lib/JIT.php, lib/Cli/ Any remaining driver symbols for inventory-scale link
Makefile Document two-stage bootstrap env vars

Repro

# Green M4/M5 slices (compiled driver):
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-driver-smoke'
./script/docker-exec.sh -- bash -lc '
  export PHP_COMPILER_M3_SOURCE=bin/compile.php
  ./script/bootstrap-selfhost-helloworld-compile-bin.sh
'

# Still Zend on gen-0:
grep -n 'php.*bin/compile.php' script/bootstrap-selfhost-link.sh
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-link'
# uses php bin/compile.php (requires host php + vendor/)

Done when

  • Documented two-stage bootstrap: (1) optional Zend gen-0 link once, (2) all routine make bootstrap-* use compiled driver when build/selfhost-compile-driver exists
  • make bootstrap-selfhost-link succeeds on a host without php when gen-0 artifact + compiled driver already built (or skip gen-0 with env)
  • docs/bootstrap-selfhost.md row “Bootstrap driver” reflects compiled path as default
  • Unblocks shrinking Zend from developer loop before full Language: enum implements metadata in CFG/VM (#2299) #2830-class cold boot

Labels

self-host, bootstrap, IMPORTANT

Links

#1492 · #1521 ✅ · #2697 ✅ · #1416 (cold boot)

Activity

  1. added a commit that references this issue on May 27, 2026
  2. PurHur commented on May 27, 2026

    @PurHur
    OwnerAuthor

    Landed in #2845.

    • script/bootstrap-resolve-compile-invoke.sh: prefers build/selfhost-compile-driver / bin-compile-aot when executable; falls back to Zend when native link does not produce the output binary (current drivers are not yet inventory-scale linkers).
    • Wired: bootstrap-selfhost-link.sh, bootstrap-selfhost-lib-spine-smoke-link.sh, bootstrap-loop-gen1-link.sh.
    • Integrated with Self-host bootstrap: add unified preflight (docker + php) with actionable guidance #2810 selfhost-preflight (php-only when Zend path; skip when native driver selected).

    Verified in Docker: compiled attempt + Zend fallback → compiler_minimal bundle OK; make bootstrap-loop-gen1-link green.

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

    MOST IMPORTANTThis are the most important targetsphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions