Skip to content

fbuild: bash autoresearch esp32p4 --parlio fails to build (WString.h / soc_caps.h missing, zccache hang) #2507

Closed

Description

@zackees

Summary

Meta-issue tracking that bash autoresearch esp32p4 --parlio cannot complete on a fresh dev environment for the ESP32-P4-EV board. Both default (fbuild) and --no-fbuild code paths hit toolchain integration failures, while plain pio run -e esp32p4 --target upload against the same sketch succeeds. This is blocking empirical verification of the PARLIO-blocking follow-up to #2493 / #2494 / #2503 — the new fl::PerfTrace instrumentation (see PR linked below) needs a working autoresearch loop to capture per-frame data.

Reproducer

Environment: Windows 10 x64, ESP32-P4-EV on COM25 (VID 0x303A, PID 0x1001), arduino-esp32 framework v3.3.7, fbuild 2.2.5, zccache 1.9.0.

git clone https://github.com/FastLED/FastLED && cd FastLED
git checkout master
bash autoresearch esp32p4 --parlio --skip-lint --timeout 180

Observed failures

1. zccache daemon hang (first run after fresh zccache clear)

[fbuild] operation failed: build error: build failed: project-as-library 'fastled' compilation failed:
  build failed: build failed: failed to compile <repo>/src/fl/build/fl.sensors+.cpp in library fastled:
  zccache[err][R]: broken connection to daemon: recv timed out after 300s

Daemon recovers on retry, but ~300s of wall time is burned.

2. arduino-esp32 internal-header miss (fbuild default path)

[fbuild] compilation failed for .../framework-arduinoespressif32/.../3.3.7/esp32-core-3.3.7/cores/esp32/HEXBuilder.cpp:
HEXBuilder.h:23:10: fatal error: WString.h: No such file or directory
   23 | #include <WString.h>

WString.h is present at <cache>/.../3.3.7/esp32-core-3.3.7/cores/esp32/WString.h (sibling file). The compile command for HEXBuilder.cpp is missing the cores/esp32/ include directory.

3. arduino-esp32 SoC-header miss (fbuild --no-filter / --no-fbuild path)

fatal error: soc/soc_caps.h: No such file or directory
   16 | #include "soc/soc_caps.h"

The header exists at <cache>/.../3.3.7/esp32-core-3.3.7/tools/esp32-arduino-libs/esp32p4/include/soc/esp32p4/include/soc/soc_caps.h. The compile command is missing the chip-specific SoC include path that PlatformIO injects via the platform manifest.

Direct PlatformIO works

The same sketch builds and uploads cleanly via stock PlatformIO:

PLATFORMIO_SRC_DIR=examples/AutoResearch \
  uv run pio run -e esp32p4 --target upload --upload-port COM25 \
    --project-dir .

Result: SUCCESS, 1654858 bytes flash (52.6% of 3MB), firmware uploaded over USB-Serial-JTAG.

Why this matters

We need autoresearch to capture per-frame PARLIO timing on a real ESP32-P4 to confirm whether the wait-loop blocking issue is fully resolved post-#2503 or if the new setPerfTraceEnabled / getPerfTraceLog RPCs (PR forthcoming) still show residual ~16 ms blocking. Without autoresearch we have no automated regression coverage for #2493.

Scope / acceptance

  • Investigate why fbuild's arduino-esp32 esp32p4 toolchain config omits cores/esp32/ and the chip-specific tools/esp32-arduino-libs/<chip>/include/soc/<chip>/include/ directories from the compile command. PIO derives these from the platform's manifest; fbuild may be skipping the same wiring.
  • Investigate the zccache daemon timeout — repeatable on first compile of fl.sensors+.cpp after zccache clear. May be unrelated (large TU?) or a daemon stability bug.
  • Fix in the fbuild repo (https://github.com/FastLED/fbuild) and cut a new release.
  • Bump fbuild pin in FastLED (mirroring 7ae55c0 / adab3f8).
  • Re-run bash autoresearch esp32p4 --parlio to confirm green.
  • Run the new ci/perf_trace_sweep.py against the device and append the per-frame trace dump (12 lanes × 256 LEDs WS2812B) to this issue.

Related

🤖 Filed via Claude Code while attempting the PARLIO perf-trace follow-up to #2503.

Activity

  1. zackees commented on May 24, 2026

    @zackees
    MemberAuthor

    Additional finding: USB-Serial-JTAG produces no host-side bytes after boot

    Reproduced PR #2494's serial-capture failure. Updating because it should be tracked alongside the fbuild work (autoresearch is blocked by both the toolchain issue and the inability to read serial back).

    What works

    • esptool --chip esp32p4 --port COM25 write_flash 0x2000 bootloader.bin 0x8000 partitions.bin 0x10000 firmware.bin — uploads cleanly, hash verified.
    • image-info on the produced firmware.bin confirms a valid ESP32P4 image.
    • ROM-loader / 2nd-stage bootloader output IS visible if the partition table is absent (we see "invalid header: 0x0c7a177d" loops + the ESP-ROM banner). So the host-side serial path itself is alive.

    What doesn't work

    After a valid app is flashed and the device reset, no bytes ever arrive on COM25 — neither boot banners nor the AutoResearch sketch's Serial.println output. Any RPC sent to the port goes silent (no REMOTE: response).

    Likely cause + first remediation tried

    On the ESP32-P4-EV board, ARDUINO_USB_MODE=1 routes Serial to the USB-OTG connector (separate from the JTAG port that enumerates as COM25, VID 0x303A PID 0x1001). Master had ARDUINO_USB_MODE=1; PR #2494 already noticed this and set it to 0 in their reproducer.

    I applied ARDUINO_USB_MODE=0 (Serial → built-in USB-Serial-JTAG / UART0) and reflashed. Still no bytes. This matches what PR #2494 reported after exhausting their combinations.

    Suggested investigation paths

    • Try ARDUINO_USB_CDC_ON_BOOT=1 with ARDUINO_USB_MODE=1 and connect to the OTG port (would mean enumerating as a different COM device).
    • Add a long delay(2000) before the first Serial.println (USB-Serial-JTAG sometimes drops bytes during host enumeration).
    • Confirm Serial.begin(115200) is hit — there may be a fault in setup() that never reaches Serial.begin. A simple sketch (just Serial.println("hi") in loop()) would isolate this.
    • Check whether the COM25 "USB Serial Device" driver is the ESP32-S3 USB-Serial-JTAG class or some generic CDC driver that needs different DTR/RTS handshaking on Windows.

    Until host-side serial is restored, autoresearch can't drive the device even if fbuild gets fixed. Both issues block the perf-trace validation work.

    Where this leaves the PR

    The new PR introduces fl::PerfTrace + RPCs (setPerfTraceEnabled, getPerfTraceLog) + a ci/perf_trace_sweep.py driver script. Host-side unit tests pass (10/10). The autoresearch sweep is wired but cannot be empirically run on this dev env until at least one of the two issues above is resolved.

    🤖 Filed via Claude Code.

  2. zackees commented on May 24, 2026

    @zackees
    MemberAuthor

    fbuild investigation — partial findings

    Dug into the fbuild code path. Confirmed observations + open questions below. Posting here because the actual fix point is still ambiguous and warrants a maintainer's eyes before touching the local working tree (which has 8 unrelated modified files in your fbuild clone).

    Confirmed: relevant code is in crates/fbuild-packages/src/library/esp32_framework/

    • sdk_paths.rs:54-121 — Esp32Framework::get_sdk_include_dirs(mcu, memory_type)

      • First tries <framework>/tools/esp32-arduino-libs/<mcu>/flags/includes (the -iwithprefixbefore list shipped by arduino-esp32 ≥3.3.7).
      • Falls back to recursive scan of <sdk>/include/ 4 levels deep.
      • Fallback codepath, lines 102-109 has a hardcoded ["esp32", "esp32s2", "esp32s3"] loop for Xtensa port headers and no RISC-V equivalent. So if the flags file is missing for a RISC-V chip (esp32c*, esp32h*, esp32p*) the chip-specific port includes are silently dropped.
    • parsing.rs:55-91 — parse_include_flags. Takes the file content, splits, and for each -iwithprefixbefore RELATIVE/PATH resolves to include_base.join(relative) where include_base = <sdk>/include/. Pushes onto the dir list if it exists.

    What I verified

    The flags/includes file for esp32p4 DOES exist on disk and DOES contain soc/esp32p4/include as a relative entry:

    $ head -1 .../tools/esp32-arduino-libs/esp32p4/flags/includes
    ... -iwithprefixbefore soc/esp32p4/include ...
    

    The header file path is:

    .../tools/esp32-arduino-libs/esp32p4/include/soc/esp32p4/include/soc/soc_caps.h
    

    parse_include_flags should resolve that entry to .../tools/esp32-arduino-libs/esp32p4/include/soc/esp32p4/include/, which makes #include "soc/soc_caps.h" work.

    So the primary path should work for esp32p4. The error must mean one of:

    1. The flags file is being read but parse_include_flags is dropping the entry (maybe <resolved>.exists() check fails due to a path-separator issue on Windows?)
    2. The include dirs from get_sdk_include_dirs() are computed for framework-lib compilation but NOT being passed to sketch/project-as-library compilation
    3. The orchestrator is using a different code path for esp32p4 that bypasses get_sdk_include_dirs() entirely

    I'd start by adding eprintln! tracing inside parse_include_flags and get_sdk_include_dirs and re-running bash compile esp32p4 --examples AutoResearch --no-filter to see which dirs actually make it onto the compile command for the failing TU.

    For the WString.h failure

    That's a different root cause — cores/esp32/ is not part of the SDK include tree, it's the Arduino core itself. crates/fbuild-build/src/esp32/orchestrator/build.rs:247 adds core_dir once. Need to check framework_libs.rs to see whether it's threaded through when compiling HEXBuilder.cpp. The fact that PIO compiles it successfully suggests PIO adds cores/esp32/ to every framework-lib compile and fbuild may be adding it only at sketch-compile time.

    Likely (but unverified) fix sketch

    In sdk_paths.rs:102-109, parallel the Xtensa loop with RISC-V chip paths — even though the flags file should cover esp32p4 already, the explicit safety net never hurts and protects the 2.x fallback:

    for sub_mcu in &["esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4"] {
        let riscv_inc = include_dir.join("riscv").join(sub_mcu).join("include");
        if riscv_inc.exists() && !dirs.contains(&riscv_inc) {
            dirs.push(riscv_inc);
        }
        let soc_inc = include_dir.join("soc").join(sub_mcu).join("include");
        if soc_inc.exists() && !dirs.contains(&soc_inc) {
            dirs.push(soc_inc);
        }
    }

    But the primary fix likely lives somewhere else — most likely the orchestrator forgets to use these dirs when compiling the sketch/project-as-library. Worth tracing the actual -I… arguments fbuild emits for the failing TU to confirm.

    Status

    Once the fbuild fix lands and a new release ships, the FastLED-side bump is a 1-line change (mirroring 7ae55c0 / adab3f8). Re-running bash autoresearch esp32p4 --parlio + uv run ci/perf_trace_sweep.py --port COM25 --lanes 12 --strip-size 256 will close out the validation.

    🤖 Filed via Claude Code.

  3. zackees commented on May 24, 2026

    @zackees
    MemberAuthor

    Update: hardware sweep unblocked via flash-dump workaround (PR #2508)

    Was able to capture per-frame PARLIO trace data without resolving either blocker by adapting PR #2494's ParlioBench pattern:

    • examples/PerfTraceBench/PerfTraceBench.ino flushes fl::PerfTrace events to a flash data partition once per run.
    • ci/perf_trace_decode.py parses the dump back on the host.
    • esptool read-flash works fine (it's USB-Serial-JTAG output that's broken, not the ROM-loader path).

    Doesn't unblock fbuild or serial. Both still need to be fixed for bash autoresearch esp32p4 to function as intended. But it does let us answer the original "is #2493 fixed?" question (it's not — 755 ms per frame in the manager's flush wait, full per-PR-#2508 comment for details).

    Posting because someone looking at this issue might want the workaround. The flash-dump path is intentionally minimal — not a replacement for autoresearch, just an escape hatch.

  4. zackees commented on May 24, 2026

    @zackees
    MemberAuthor

    Update: fbuild fix merged-pending; serial remains stuck

    ✅ fbuild side — fixed and PR'd

    Root-caused both compile failures and shipped a fix:

    FastLED/fbuild#273 — fix(esp32): strip Windows UNC prefix + collect .S/.s assembly sources

    Two bugs:

    1. Path::canonicalize() on Windows returns \?\C:\…. The response-file writer rewrites all backslashes to forward slashes so gcc doesn't see them as escapes, producing -I//?/C:/…. Most headers resolve, but chip-specific SoC headers like soc/soc_caps.h don't — esp32p4 was the only chip where this surfaced because its include paths nest two levels deeper than esp32/s2/s3. Fixed by stripping the \?\ prefix in canonicalize_existing_path before it ever reaches the response-file writer.
    2. library_info::is_source_file only matched .c/.cpp/.cc/.cxx, silently dropping .S assembly files from project archives. FastLED's gpio_isr_rx/fast_isr.S (defines gpio_fast_edge_isr) was lost → undefined reference at link.

    Local fbuild build of the patch + bash compile esp32p4 --examples AutoResearch --no-filter now succeeds end-to-end (1.7 MB firmware.bin in 100 s).

    ⚠️ Still broken on the autoresearch path

    After the fbuild fix, bash compile esp32p4 --examples AutoResearch --no-filter works, but bash autoresearch esp32p4 --parlio --skip-lint still fails because the fbuild daemon compiles examples/Sailboat (the platformio.ini default src_dir) instead of examples/AutoResearch. The autoresearch front-end sets PLATFORMIO_SRC_DIR=examples/AutoResearch in os.environ, but the change does not propagate to the long-lived daemon (which inherits its env from whoever spawned it first).

    Separate bug, separate fix: either pass src_dir through the daemon protocol, or restart the daemon on every autoresearch invocation. Worth filing as its own issue.

    ❌ USB-Serial-JTAG output remains silent post-boot

    Tried, all on COM25 (VID 0x303A PID 0x1001):

    • ARDUINO_USB_MODE=0 alone — silent.
    • ARDUINO_USB_MODE=0 + ARDUINO_USB_CDC_ON_BOOT=1 — silent.
    • ARDUINO_USB_MODE=1 + ARDUINO_USB_CDC_ON_BOOT=1 — silent (also no new COM port enumerates for the OTG side; the dev board only has one USB cable connected, to the JTAG bridge).
    • delay(5000) before the first Serial.println(...).flush() — silent.
    • DTR=True/False permutations, no-touch open (dtr=None, rts=None) — silent.
    • Long post-reset settling delays (3 s, 5 s, 10 s) — silent.
    • Reopening port after the device's internal CDC re-enumeration — silent.

    ROM bootloader output IS visible, so the host-side path is alive — it's specifically the post-app-boot CDC stream. Matches PR #2494's experience. Likely a board/driver-level config issue this dev environment doesn't expose to user-space.

    What works as a workaround

    examples/PerfTraceBench/PerfTraceBench.ino (added on the perf-trace branch) flushes the fl::PerfTrace log to a flash data partition and ci/perf_trace_decode.py reads it back via esptool read-flash. No serial needed. This is what produced the empirical data on PR #2508 showing the PARLIO blocking issue is not fully fixed by #2503.

    Status checklist

    🤖 Filed via Claude Code.

  5. zackees commented on May 31, 2026

    @zackees
    MemberAuthor

    Closing as stale. fbuild has been bumped 2.2.5 → 2.2.11 (commits adab3f8, dc586bf, 84633f6, d11bcd9), addressing the include-path normalization and zccache stability issues from the original report. Please reopen with a fresh repro if the failure recurs on current master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions