--- id: "bug-1558" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "apiserver" severity: "unknown" timestamp: "2026-08-15T11:20:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/frontend/Makefile (test-backend target)", "src/frontend/apiserver/meson.build"] tags: ["build", "tooling", "cgo", "apiserver", "test-backend", "meson", "makefile", "component-failover-adoption"] related: ["bug-1440", "bug-1441"] legacy: true --- # bug-1558: make test-backend fails standalone: backend/reconnect.go:6:10: fatal error: client.h: No such file… ## Description make test-backend fails standalone: backend/reconnect.go:6:10: fatal error: client.h: No such file or directory -- FAIL apiserver/backend [build failed], make: *** [Makefile:33: test-backend] Error 1. Hit during /kiro-validate-impl component-failover-adoption full-suite validation. ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause CGO_CFLAGS/CGO_LDFLAGS for libxce and its transitive deps are constructed only inside apiserver/meson.build (lines 11-49) and set via meson's go_env environment() for its custom_target. They are never exported to a general shell, so the Makefile's test-backend target runs bare `CGO_ENABLED=1 go test ./backend/...` with no include or link paths. Compounding this, xce-build.sh's RUN_TESTS path only invokes `make test` (CGO_ENABLED=0), so the CGO backend suite -- which holds this spec's load-bearing rejoin/heartbeat/candidate-parity tests -- is structurally never exercised by any documented command. Previously noted narratively in component-failover-adoption tasks.md Implementation Notes (task 4.1, task 5.4) but never logged as a bug. ## Fix FIXED (component-failover-adoption tasks.md Phase 6, non-blocking build-tooling fix). src/frontend/Makefile's test-backend target now self-derives CGO_CFLAGS/CGO_LDFLAGS via `pkg-config --cflags/--libs librtti c-capnproto openssl tinylog` plus -I$(CURDIR)/../include -I$(BUILD_DIR)/lib and -L$(BUILD_DIR)/lib -lxce -lm -lrt -fsanitize=address, mirroring apiserver/meson.build's own construction. BUILD_DIR anchored on $(CURDIR) (the Makefile's own directory), not a path relative to the `cd apiserver` recipe target, avoiding the off-by-one the workaround note flagged. Verified 2026-08-15: `make test-backend` run standalone from a nix develop shell with zero manual env setup -- `ok apiserver/backend 14.652s`, `ok apiserver/backend/auth 0.010s`. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1440, bug-1441