--- id: "bug-1597" status: "fixed" status_updated: "2026-09-24" status_note: "obsolete: src/frontend/Makefile removed (6fabdba9)" component: "apiserver" severity: "unknown" timestamp: "2026-08-19T00:00:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/frontend/Makefile (build-server target)"] tags: ["frontend", "apiserver", "cgo", "makefile", "build-server", "nix", "pre-existing"] related: ["bug-1558"] fix_commits: ["6fabdba9"] legacy: true --- # bug-1597: backend/reconnect.go:6:10: fatal error: client.h: No such file or directory (compilation… ## Description backend/reconnect.go:6:10: fatal error: client.h: No such file or directory (compilation terminated) -> make: *** [Makefile:33: build-server] Error 1 ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause build-server's recipe is a bare `cd apiserver && go build -o /tmp/apiserver ./cmd/main.go` with no CGO_CFLAGS/CGO_LDFLAGS, so cgo has no -I path to src/include (client.h) or BUILD_DIR/lib (controller.capnp.h) and no -L/-l for libxce + its pkg-config deps. Unlike build-server, both test-backend (same Makefile, bug-1558) and apiserver/meson.build derive CGO_CFLAGS/CGO_LDFLAGS via pkg-config (librtti, c-capnproto, openssl, tinylog) plus -I$(BUILD_DIR)/lib / -L$(BUILD_DIR)/lib -lxce -- build-server was apparently never given the same treatment, so it only works if CGO_CFLAGS/CGO_LDFLAGS happen to already be exported in the shell (e.g. by meson's custom_target env), not under a bare `nix develop ../ --command make build-server`. Reproduced identically with and without an unrelated comment-only change staged elsewhere in the same package (apiserver/backend/handler.go), confirming this is pre-existing and unrelated to that change. ## Fix Not fixed (out of scope for the verification task that found it -- reported only). Workaround that does compile cleanly (exit 0): run the build-server go build with the same self-derived CGO env as test-backend, e.g. inside `nix develop ../ --command bash -c '...'`: BUILD_DIR=$(pwd)/../xce.build; CGO_CFLAGS="-fsanitize=address -g $(pkg-config --cflags librtti c-capnproto openssl tinylog) -I$(pwd)/../include -I$BUILD_DIR/lib"; CGO_LDFLAGS="-fsanitize=address -g $(pkg-config --libs librtti c-capnproto openssl tinylog) -lm -lrt -L$BUILD_DIR/lib -lxce"; then CGO_ENABLED=1 CGO_CFLAGS="$CGO_CFLAGS" CGO_LDFLAGS="$CGO_LDFLAGS" go build -o /tmp/apiserver ./cmd/main.go. Requires BUILD_DIR/lib/libxce.a to already exist (prior xce-build.sh lib run). Proper fix would mirror bug-1558's FRONTEND_CGO_CFLAGS/FRONTEND_CGO_LDFLAGS into the build-server recipe in src/frontend/Makefile. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1558