fix(build): close capnp codegen missing-dependency-edge race (bug-1798)

libxce_src listed only gen_srcs[0] (controller.capnp.c) as a source of
the static_library('xce', ...) target, never controller.capnp.h -- which
several library files (utils.c and others) reach only via #include.
Ninja had no build edge forcing the capnp custom_target to finish before
those files compiled, so a from-scratch build could schedule them first,
intermittently failing with "controller.capnp.h: No such file or
directory". This is the same symptom recorded across 5+ prior recurrences
in buglog.json since 2026-07-16, previously worked around by retrying the
build rather than root-caused.

Fix: pass the whole gen_srcs custom_target (not gen_srcs[0]) into
libxce_src -- Meson still compiles only its .c output, but now orders the
entire target's build after both outputs are generated. Verified via two
consecutive from-scratch `xce-build.sh lib debug` builds (no retry
needed), the full lib test suite (313/313), and an incremental controller
asan rebuild (1331/1331, 0 ASAN diagnostics) to confirm no regression.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019jaMf9QEwpugH2W9KAuc7f
This commit is contained in:
Rongsong Shen 2026-09-10 07:10:44 +00:00
parent 38595099b9
commit 654c6e8c75
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
2 changed files with 38 additions and 1 deletions

View file

@ -62,7 +62,20 @@ xce_select_parser = custom_target(
],
build_by_default: true)
libxce_src = [ gen_srcs[0],
libxce_src = [ # bug-1798: pass the whole gen_srcs custom_target (both
# controller.capnp.c AND controller.capnp.h), not just
# gen_srcs[0] -- several files below (utils.c and others)
# reach controller.capnp.h only via #include, which ninja
# cannot see. Indexing to gen_srcs[0] dropped that header
# from this target's declared outputs entirely, so a
# from-scratch build had no dependency edge forcing capnp
# codegen to finish before those files compiled,
# intermittently failing with "controller.capnp.h: No such
# file or directory" (recurring since 2026-07-16). Passing
# the full custom_target compiles only its .c output (as
# before) while ordering the ENTIRE target's build after
# BOTH outputs are generated.
gen_srcs,
section_parser[0],
rusage_parser[0],
xce_resreq_parser[0],