From 27a9788ac87d1fc325d5182ce1ec1284ca88f903 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Tue, 10 Nov 2026 15:21:12 -0400 Subject: [PATCH 1/2] build: the Makefile generator refuses `--target 1bit` by name instead of silently doing nothing (engine#1993) `1bit` is the OUTPUT NAME of the target `onebit` (CMakeLists.txt:135). With CMake's default **Makefile** generator, the file `1bit` sitting in the build directory is a satisfied FILE rule with no dependencies, so cmake --build --target 1bit -> prints nothing, exits 0, builds nothing and a stale binary keeps its old timestamp. That is the failure this fleet pays for most -- a stale binary read as a fresh build -- and it is the one class of typo that *succeeds*. Measured on both generators before and after: generator command before after Unix Makefiles cmake --build . --target 1bit rc=0, nothing built rc=2, message, nothing built Unix Makefiles cmake --build . --target onebit rc=0, builds rc=0, builds (1bit produced) Ninja cmake --build . --target 1bit rc=0 (file target) rc=0 (unchanged, correct) Ninja cmake --build . --target onebit rc=0, builds rc=0, builds The Ninja row is why this is gated to the Makefile generator rather than applied to both: ninja has no file rules, so it resolves `1bit` to the output file and builds its producer and dependencies -- correct behaviour, verified by watching it rebuild ten targets from a stale binary and say "no work to do" once fresh. Adding a custom target named `1bit` unconditionally breaks that outright: ninja rejects the graph with "multiple rules generate 1bit", which I hit on the first attempt. Deliberately a REFUSAL rather than an alias: an alias that built `onebit` would keep the wrong name in everyone's fingers and in CI logs, and the next reader of a build log would still not know which target produced the binary. One line of friction removes the class. Ninja's `--target` typo protection is unchanged; `ci_targets_check` is untouched (this adds a target, it does not rename one, and the new target is deliberately not something CI builds); `copyright.py --check` rc 0. --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94ebb8def..26f05685b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,6 +133,20 @@ file(WRITE ${CMAKE_BINARY_DIR}/generated/hrx_archs.h "static const char* const kHrxGgufArchs[] = {\n${_onebit_archs}};\n") set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/registry/architectures.json) set_target_properties(onebit PROPERTIES OUTPUT_NAME 1bit) + +# engine#1993: `1bit` is the OUTPUT NAME, not a target -- the target is `onebit`. With the MAKEFILE generator (CMake's +# default) the output file `1bit` in the build directory makes `--target 1bit` a satisfied FILE rule, so the command prints +# nothing, exits 0 and builds nothing while a stale binary keeps its old timestamp: a typo that succeeds, which is the +# failure this fleet pays for most. Ninja errors on that command already (`unknown target '1bit'`), because it has no file +# rules -- so this refusal is added ONLY for the Makefile generator: a custom target with that name is a second rule for an +# output `onebit` already produces, which ninja rejects outright ("multiple rules generate 1bit") and Makefile absorbs as a +# phony. Deliberately not an alias: an alias that built `onebit` would keep the wrong name in everyone's fingers and logs. +if(CMAKE_GENERATOR MATCHES "Makefiles") + add_custom_target(1bit + COMMAND ${CMAKE_COMMAND} -E echo "error: the build target is onebit; 1bit is only its output file name. Nothing was built. Use: cmake --build --target onebit" + COMMAND ${CMAKE_COMMAND} -E false + VERBATIM) +endif() target_link_libraries(onebit PRIVATE nlohmann_json::nlohmann_json httplib::httplib Threads::Threads) # ── The chat-template renderer (engine #963, docs/npu-chat-template.md) ────── From 2d2155d1ba1c23518b48b2a769b5c596855de6f0 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Tue, 10 Nov 2026 18:41:15 -0400 Subject: [PATCH 2/2] build: say what Ninja does with --target 1bit, and fix the one command that used it (review of #2007) The comment said Ninja errors on `--target 1bit`; it rebuilds the binary through the output-file rule. And tools/hyperloom/custom/README.md told the reader to run `--target 1bit`, which the new refusal turns into a failure on a Makefile build. Co-Authored-By: Claude Fable 5.2 --- CMakeLists.txt | 10 ++++++---- tools/hyperloom/custom/README.md | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26f05685b..4ed5b1206 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,10 +137,12 @@ set_target_properties(onebit PROPERTIES OUTPUT_NAME 1bit) # engine#1993: `1bit` is the OUTPUT NAME, not a target -- the target is `onebit`. With the MAKEFILE generator (CMake's # default) the output file `1bit` in the build directory makes `--target 1bit` a satisfied FILE rule, so the command prints # nothing, exits 0 and builds nothing while a stale binary keeps its old timestamp: a typo that succeeds, which is the -# failure this fleet pays for most. Ninja errors on that command already (`unknown target '1bit'`), because it has no file -# rules -- so this refusal is added ONLY for the Makefile generator: a custom target with that name is a second rule for an -# output `onebit` already produces, which ninja rejects outright ("multiple rules generate 1bit") and Makefile absorbs as a -# phony. Deliberately not an alias: an alias that built `onebit` would keep the wrong name in everyone's fingers and logs. +# failure this fleet pays for most. With Ninja the same command is not a trap: `1bit` there is the output-file rule of +# `onebit`, so `--target 1bit` rebuilds and relinks the binary (measured, CMake 4.2.3: a touched source, rc 0, new mtime). +# So this refusal is added ONLY for the Makefile generator, and it cannot be added for Ninja at all: a custom target with +# that name is a second rule for an output `onebit` already produces, which ninja rejects outright ("multiple rules generate +# 1bit") and Makefile absorbs as a phony. Deliberately not an alias: an alias that built `onebit` would keep the wrong name +# in everyone's fingers and logs. if(CMAKE_GENERATOR MATCHES "Makefiles") add_custom_target(1bit COMMAND ${CMAKE_COMMAND} -E echo "error: the build target is onebit; 1bit is only its output file name. Nothing was built. Use: cmake --build --target onebit" diff --git a/tools/hyperloom/custom/README.md b/tools/hyperloom/custom/README.md index df383a805..7725bf2e3 100644 --- a/tools/hyperloom/custom/README.md +++ b/tools/hyperloom/custom/README.md @@ -48,7 +48,7 @@ plus `hl_cli_login.py` and a `launch.sh` wrapper) is gone: upstream now knows th cmake -B ~/wt/hl-engine-build -G Ninja -S ~/wt/hl-engine -DCMAKE_BUILD_TYPE=Release \ -DONEBIT_HRX=ON -DONEBIT_HRX_TOOLCHAIN=/opt/rocm-therock \ -DONEBIT_HRX_LIBHSA=/opt/rocm-therock/lib/python3.14/site-packages/_rocm_sdk_core/lib/libhsa-runtime64.so.1 - cmake --build ~/wt/hl-engine-build -j 4 --target 1bit llama-bench llama-perplexity llama-server + cmake --build ~/wt/hl-engine-build -j 4 --target onebit llama-bench llama-perplexity llama-server ``` The build root is `HL_BUILD` (default `~/wt/hl-engine-build`): `1bit` sits at its top, and the