Repository navigation
Description
Follow-up 2 of 5 from the merged research pass in #1761 (design note: docs/design/bare-idf-component-builds.md).
Why
fbuild compiles every ESP32 environment with the Arduino core against precompiled ESP-IDF .a libraries; there is no CMake and no idf.py (crates/fbuild-build-esp/src/esp32/orchestrator/helpers.rs). A genuine idf_component_register() project therefore cannot be built at all today — and must not be claimed (#1664, #1730).
Scope
Per the recommended hybrid option (option 3 in the note): keep the native Arduino-on-IDF path untouched and add an explicit opt-in delegating path.
- New opt-in switch (project config or
FBUILD_*), default off; no behaviour change for existing projects. - Run the pinned IDF (feat(toolchain): pin an ESP-IDF release as fbuild packages with an esp32s3-only install profile #1970, follow-up 1) against the project's own
CMakeLists.txt,set-targetfirst, thenbuild. - Publish the artifacts under
<build>/idf/: appbin,elf,map,bootloader.bin,partition-table.bin, generatedsdkconfig,compile_commands.json. - Supervise it as a subprocess with the daemon's existing bounded-stream + timeout discipline (test(deploy): contain external esptool flash failures (Refs #1329) #1908); a delegated build that dies must surface a structured failure, not a bare exit code.
- Emit the new integration mode only together with the artifact proof required by follow-up 3.
Reference spike (measured, esp32s3, 16-vCPU host)
| step | wall |
|---|---|
set-target esp32s3 |
15.9 s (configure 12.0 s) |
cold build |
50.3 s (1071 ninja actions, 1064 objects, 108 archives) |
no-op build |
1.54 s |
| one-file touch | 10.8 s |
Artifacts: app bin 208,528 B, elf 3,721,344 B, map 3,108,610 B, bootloader.bin 21,056 B, partition-table.bin 3,072 B, sdkconfig 73,024 B, compile_commands.json 7.39 MB / 959 entries, build/ 144 MB.
Acceptance criteria
- A real component project (
maincomponent withidf_component_register(... REQUIRES ...)plus a second component,app_main()only,sdkconfig.defaults) builds through fbuild and produces all artifacts above. - The same project without the opt-in still fails fast with fix(esp32): reject framework = espidf instead of silently building Arduino (#1664) #1730's message (no silent Arduino build).
- The Arduino-on-IDF path is byte-identical to before for an existing board (build a fixture before/after and compare sizes + flash/RAM numbers).
- A delegated build that is killed/timed out produces a structured
/apifailure with both bounded streams and no orphaned children. - Tests exercise the real spawn against a fake
idf.py(argv, cwd, env, artifact discovery) — plus one ignored end-to-end test gated on a locally installed IDF.
Non-goals
- No zccache integration in this issue (follow-up 5); no compile-db re-rooting (follow-up 4); no multi-version IDF matrix.
Depends on: #1970 (follow-up 1). Blocks: #1972, #1973, #1974 (follow-ups 3, 4, 5).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
zackees commentedon Nov 10, 2026
Prerequisite check from the steward — the pinned release is now installable end to end:
EspIdfInstall::new(project_dir, IdfProfile::Esp32S3Only).install()(merged in feat(toolchain): install a whole pinned ESP-IDF release as one fbuild operation #1981) provisions the source tree, all tool archives and the pinned
Python environment, and returns
InstalledEspIdfwithpath_dirs()(venvbinfirst),
env_vars()(IDF_PATH,IDF_PYTHON_ENV_PATH,ESP_ROM_ELF_DIR,OPENOCD_SCRIPTS; deliberately noIDF_TOOLS_PATH) andinstalled_bytes().idf.py build: cmake and ninja.idf.pyshells outto both, and there is no fbuild package for either yet — that is now the only
input this issue is waiting on from feat(toolchain): pin an ESP-IDF release as fbuild packages with an esp32s3-only install profile #1970's scope (see the note on feat(toolchain): pin an ESP-IDF release as fbuild packages with an esp32s3-only install profile #1970).
zackees commentedon Nov 10, 2026
The last non-delegation input is now on
main: PR #1983 (merged as94e54ffc) pins and installs CMake 3.30.2 and Ninja 1.12.1 as part of theEsp32S3OnlyESP-IDF profile.What that means for this issue:
EspIdfInstall::install()now returns an environment that can actually configure:tools/idf.py --versionprintsESP-IDF v5.5.1out of the installed tree, andidf.py set-target esp32s3on a two-component project configures for real (CMAKE_GENERATOR=Ninja,CMAKE_MAKE_PROGRAM= the pinned ninja, compiler = pinnedxtensa-esp32s3-elf-gcc).IDF_TOOLS_PATHmust be set — not to~/.espressif, but to the python entry'spython_env/, becauseidf_tools.py::get_constraints(online=False)fatals whenespidf.constraints.v5.5.txtis missing there andidf.py --versionnever starts.InstalledEspIdf::env_vars()already emits it.PATH, never substituted for it:idf.py/CMake shell out tolnand friends, so a tool-dirs-only PATH dies inside mbedtls withCould not create symbolic link.set-targetconfigure is ~5 s warm on this host; the reference spike's coldbuild(50.3 s, 1071 ninja actions) is unchanged.So AC1 of this issue no longer depends on any host tooling — the remaining work is the delegation itself (
<build>/idf/artifacts, structured failure, fake-idf.pytests, ignored e2e gated on an installed IDF), which is what #1971 asks for.zackees commentedon Nov 10, 2026
Delivered in #1984 (merged as
ed2c845d).1 passed in 129.30s(cold 311 s incl. the release install):component_demo.bin208,528 /.elf3,915,304 /.map3,191,030 /bootloader.bin21,056 /partition-table.bin3,072 /sdkconfig73,024 /compile_commands.json15,537,131 = 22,949,145 B under<build>/idf/, plusidf-artifacts.jsonbare_espidf_framework_is_rejected_before_building(now also namesboard_build.build_system) +the_delegated_opt_in_permits_a_bare_espidf_projectnative; post-mergemainboard jobs (ESP32 Dev/S3/C6/P4/H2/S2, Uno, Teensy) are green on the merge commita_wedged_step_times_out_with_both_streams, plus the newsubprocess::run_command_reportingcells (timeout keeps pre-deadline output; streams bounded to a 64 KiB tail with totals recorded)idf.py(argv, cwd, env, discovery) + one ignored e2eset_target_then_build_runs_with_the_installed_environment,a_failed_step_reports_stage_exit_code_and_both_streams, 7 artifact testsTwo findings worth recording for the follow-ups:
idf.pywrites the generatedsdkconfiginto the project directory, not the build directory (<build>/config/sdkconfig.jsonis the resolved copy).PATHentries must be prepended to the hostPATH(confirmed again here), andIDF_TOOLS_PATHmust be the python entry'spython_env/.Measured env contract for #1972–#1974: with the profile on
PATH,idf.py set-target esp32s3+idf.py buildtake 311 s cold / ~50 s warm on this 16-vCPU host at loadavg ~30, and the delegated build directory is 163 MB.