Skip to content

libraries: fail the build when any sensor fails to compile#91

Merged
widgetii merged 1 commit into
mainfrom
fix/libraries-fail-on-sensor-build-errors
May 9, 2026
Merged

libraries: fail the build when any sensor fails to compile#91
widgetii merged 1 commit into
mainfrom
fix/libraries-fail-on-sensor-build-errors

Conversation

@widgetii

@widgetii widgetii commented May 8, 2026

Copy link
Copy Markdown
Member

Summary

Both `libraries/Makefile` and `libraries/sensor/hi3516cv500/Makefile` iterated subdirs with `make ... || true`, which silently swallowed per-sensor compile failures. Three musl-only header bugs surfaced through this gap during the per-platform sensor source migration (#82):

Bug Sensor Fix
missing <linux/ioctl.h>_IOC_SIZEBITS undeclared cv300/imx323 #84
missing -I kernel/pwm/hi3516av100 av100/imx117 #83
av100 hi_spi.h used <sys/ioctl.h> (broken under musl) av100/imx123, imx185 #90

In each case the Build SDK (chiparch) CI job stayed green because the libraries Makefile reported success even when individual sensors didn't link. The breakage was only caught when the firmware-side INSTALL_TARGET_CMDS step couldn't stat the missing .so. For cv300 it even slipped past CI entirely — the install foreach uses ; separators, so its exit code is the last install's exit code, and sony_imx323 (which failed) was followed by sony_imx385 (which succeeded). Only sysupgrading a real camera surfaced the missing libsns_imx323.so.

Change

Replace || true with a fail-late accumulator: keep iterating so all errors surface in one CI run, then exit 1 with a summary list of failing dirs at the end.

all:
	@failed=""; \
	for dir in $(SUBDIRS); do \
		$(MAKE) -C $$dir CHIPARCH=$(CHIPARCH) all || failed="$$failed $$dir"; \
	done; \
	if [ -n "$$failed" ]; then \
		echo; \
		echo "Build failed for:" >&2; \
		for d in $$failed; do echo "  $$d" >&2; done; \
		exit 1; \
	fi

Test plan

  • All 7 platforms still build clean under `arm-openipc-linux-gnueabi-gcc` 13.3.0
  • Injecting `#error` into one sensor source produces the right behaviour:
    • surrounding sensors continue to build
    • loop reports Build failed for: ./sensor/.../
    • make exits 1
  • CI: Build SDK (...) passes on all 11 platform/kernel matrix rows under musl

Why both Makefiles

libraries/Makefile is the top-level entry. libraries/sensor/hi3516cv500/Makefile is reached when CHIPARCH=hi3516cv500 because the outer SUBDIRS filter ./sensor/hi3516cv500/% ./isp/ matches both subsensor dirs and the cv500 dir itself (the % matches empty), so the loop runs make on the cv500 dir which delegates to its inner Makefile. Both paths had the same || true.

🤖 Generated with Claude Code

Both libraries/Makefile and libraries/sensor/hi3516cv500/Makefile
iterated subdirs with `make ... || true`, which silently swallowed
per-sensor compile failures. Three musl-only header bugs surfaced
this way during the per-platform sensor source migration:

  cv300/imx323         missing <linux/ioctl.h> -> _IOC_SIZEBITS  fixed in #84
  av100/imx117          missing -I kernel/pwm/hi3516av100        fixed in #83
  av100/imx123/imx185   av100 hi_spi.h <sys/ioctl.h> vs musl     fixed in #90

In each case the `Build SDK (chiparch)` CI job stayed green because
the libraries Makefile reported success even when individual sensors
didn't link. The breakage was only caught when the firmware-side
INSTALL_TARGET_CMDS step couldn't stat the missing .so. For cv300
that even slipped past CI entirely (the install foreach uses `;`
so its exit code is the LAST install's exit code) — only sysupgrading
a real camera surfaced the missing libsns_imx323.so.

Replace `|| true` with a fail-late accumulator: keep iterating so
all errors surface in one CI run, then exit 1 with a summary list
of failing dirs at the end. Verified locally:

  - all 7 platforms still build clean under arm-openipc-linux-gnueabi-gcc
  - injecting `#error` into one sensor source causes:
      * the surrounding sensors continue to build
      * the loop reports "Build failed for: ./sensor/.../"
      * make exits 1 (CI red)

The libraries/Makefile and libraries/sensor/hi3516cv500/Makefile
are independent invocation paths (the latter is reached when
CHIPARCH=hi3516cv500 since the outer SUBDIRS filter pulls in
./sensor/hi3516cv500/ alongside its subsensors), so both need the
same fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 8c88e6f into main May 9, 2026
24 checks passed
@widgetii widgetii deleted the fix/libraries-fail-on-sensor-build-errors branch May 9, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants