Skip to content

Windows with long paths off (the default): no ESP32 build can install its packages #2156

Done

Description

@stevenmunn312-tech

Summary

On Windows with LongPathsEnabled = 0, which is the default, fbuild 2.5.52
cannot build any ESP32 project. It selects its short-path fallback, then
refuses both the Xtensa toolchain and the Arduino framework during extraction.
The only way forward that fbuild offers is fbuild --fix-win, which needs an
administrator, so a standard user cannot build for ESP32 at all.

The paths below the cache root are too long by themselves, so no cache
location can pass the check. FBUILD_CACHE_DIR does not help.

Environment

  • fbuild 2.5.52 (the checked code is identical at v2.5.53 and on main)
  • Windows 11, HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled = 0
  • Seen on two accounts on the same PC: a new standard (non-administrator)
    account with an empty fbuild cache, and an existing account

Reproduction

platformio.ini:

[env:esp32s3]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.312-1/platform-espressif32.zip
board = esp32-s3-devkitc-1
framework = arduino

src/main.cpp:

#include <Arduino.h>
void setup() {}
void loop() {}

Then:

fbuild build -e esp32s3 --no-timestamp

Output

WARNING: Windows long-path support is disabled. Using short-path fallback cache: C:\fb-8cffdc466966\prod\cache. Extraction scratch: C:\fb-8cffdc466966\prod\tmp. Requested cache: C:\Users\User\.fbuild\prod\cache. Deep build outputs are redirected under C:\fb-8cffdc466966\prod\b. Run fbuild --fix-win to enable Windows long paths.
========================
=   BUILDING esp32s3   =
========================
Board: Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM) / ESP32S3 @ 240MHz
Memory: 8.00MB Flash, 320.00KB RAM
esp32-xtensa-gcc xtensa-esp-elf-14.2.0_20260121-x86_64-w64-mingw32: extracting esp32-xtensa-gcc xtensa-esp-elf-14.2.0_20260121-x86_64-w64-mingw32
build error: build failed: pioarduino package resolution failed — toolchain: package error: Windows short-path fallback cannot safely use extracted path C:\fb-8cffdc466966\prod\cache\toolchains\toolchain-xtensa-esp-elf\164cda8d219cc6bd\xtensa-esp-elf-14.2.0_20260121-x86_64-w64-mingw32+esp32s3_staging\picolibc\xtensa-esp-elf\include\c++\14.2.0\ext\pb_ds\detail\binary_heap_\constructors_destructor_fn_imps.hpp. Run fbuild --fix-win or use a shorter package location.; framework: package error: Windows short-path fallback cannot safely use extracted path C:\fb-8cffdc466966\prod\tmp\esp32-framework\fbuild_sdk_aMykAR\esp32-arduino-libs\esp32s3\include\espressif__esp_matter\connectedhomeip\connectedhomeip\src\app\clusters\boolean-state-configuration-server\BooleanStateConfigurationTestEventTriggerHandler.h. Run fbuild --fix-win or use a shorter package location.

Exit code 1. The standard account gave the same two errors under its own root
(C:\fb-77f661d5001e).

The two refused paths are 257 and 253 characters long.

Cause

crates/fbuild-packages-fetch/src/extractor.rs, lines 10 to 29 at v2.5.52:
validate_extraction_tree walks every extracted entry and returns the error
when legacy_path_units(path) + 1 > LEGACY_DIRECTORY_UNITS, with
LEGACY_DIRECTORY_UNITS = 248 (line 11). So the longest path it accepts is
247 characters. The walk stops at the first entry over the limit, so the path
in the message is not the longest one in the package.

crates/fbuild-paths/src/long_paths.rs reserves room for this:
MAX_SHORT_ROOT_UNITS = 64 (line 18) carries the comment "Leaves at least 180
characters for SDK/package paths below a cache root". The ESP32 packages need
more than 180.

Why no cache location can work

Longest path below the cache root for each package, measured in a cache that
was installed earlier with long paths on (so these are the final installed
layouts, without the +esp32s3_staging suffix):

Package Longest path below the cache root
platforms\framework-arduinoespressif32 (core 3.3.11) 290
toolchains\toolchain-riscv32-esp 256
toolchains\toolchain-xtensa-esp-elf 245

The three paths:

platforms\framework-arduinoespressif32\9ef436ac06b7bf7f\3.3.11\esp32-core-3.3.11\tools\esp32-arduino-libs\esp32c3\include\espressif__esp_matter\connectedhomeip\connectedhomeip\src\app\clusters\camera-av-settings-user-level-management-server\camera-av-settings-user-level-management-server.h
toolchains\toolchain-riscv32-esp\d62421ecad92b427\riscv32-esp-elf-14.2.0_20260121-x86_64-w64-mingw32\riscv32-esp-elf\picolibc\riscv32-esp-elf\include\c++\14.2.0\riscv32-esp-elf\rv32imafc_zicsr_zifencei_zba_zbb_zbc_zbs\ilp32f\no-rtti\bits\messages_members.h
toolchains\toolchain-xtensa-esp-elf\164cda8d219cc6bd\xtensa-esp-elf-14.2.0_20260121-x86_64-w64-mingw32\xtensa-esp-elf\picolibc\xtensa-esp-elf\include\c++\14.2.0\ext\pb_ds\detail\cc_hash_table_map_\constructor_destructor_no_store_hash_fn_imps.hpp

Against a limit of 247:

  • The Xtensa toolchain would need a cache root of one character.
  • The RISC-V toolchain and the framework are over the limit before any root is
    added.
  • The framework's longest path is also over the real 260 limit at any root.

So the message's advice, "use a shorter package location", cannot be followed,
and FBUILD_CACHE_DIR cannot fix it. The toolchain is also checked in a
staging folder whose name is 16 characters longer than the final one
(+esp32s3_staging).

What this means for users

With the Windows default setting, the only route is fbuild --fix-win. That
changes a machine-wide setting and needs administrator approval. A standard
user without administrator rights (a school or work PC, or a family PC) has no
way to build for ESP32.

Possible fix (inference, not tested)

Most of the length above the limit comes from folder names that fbuild chooses
or keeps, not from the files themselves:

  • toolchains\toolchain-xtensa-esp-elf\164cda8d219cc6bd\xtensa-esp-elf-14.2.0_20260121-x86_64-w64-mingw32\
    is 103 characters. The toolchain's own longest path below it is 142.
  • The matching RISC-V prefix is 101 characters. Its own longest path is 155.
  • platforms\framework-arduinoespressif32\9ef436ac06b7bf7f\3.3.11\esp32-core-3.3.11\tools\
    is 86 characters. The longest path from esp32-arduino-libs\ down is 204.

If fallback mode installed each package under a short id (for example
<root>\p\<8 hex>\) and dropped the archive's own top folder, the longest
paths would be about 204 below the package folder. With the automatic root
(C:\fb-<12 hex>\prod\cache, 29 characters) that gives about 245, inside the
limit of 247 but with little room. A shorter fallback root or scratch folder
name would add margin. The scratch path used while extracting
(tmp\esp32-framework\fbuild_sdk_XXXXXX\) would need the same treatment.

Not tested

  • Boards other than esp32-s3-devkitc-1. The RISC-V figure above is a
    measurement of the installed package, not a failed build.
  • Whether the compiler can read every header it needs once the packages are
    installed under shorter folders.
  • fbuild 2.5.53 at run time. Its source has the same check and constants.

Activity

  1. zackees commented on Nov 23, 2026

    @zackees
    Member

    Steward triage — 2026-11-23

    Checked against origin/main fcf09a5e. The report's analysis is correct, and its proposed fix is necessary but not sufficient (numbers below).

    Confirmed in the code

    • crates/fbuild-packages-fetch/src/extractor.rs:11 — LEGACY_DIRECTORY_UNITS = 248, and validate_extraction_tree rejects legacy_path_units(path) + 1 > 248, i.e. max accepted 247. legacy_path_units counts UTF-16 units on Windows (crates/fbuild-core/src/platform/windows/fs.rs:150), which for these ASCII paths equals characters.
    • crates/fbuild-paths/src/long_paths.rs:18 — MAX_SHORT_ROOT_UNITS = 64, commented "Leaves at least 180 characters for SDK/package paths below a cache root". The ESP32 packages need 245–290 below the root, so the reservation is 65–110 units short. That comment is the actual defect: the constant encodes a budget no ESP32 package meets.
    • The automatic fallback root is automatic_roots() in long_paths.rs — <drive>:\fb-<12 hex>\<prod|dev>\cache, 29 units, and the layout below it is <kind>\<stem>\<16 hex>\<version>\<archive-top-folder>\… (crates/fbuild-packages-fetch/src/disk_cache/paths.rs, the sole path constructor).

    Measured budget (the three paths from the report; limit 247)

    package below root at the automatic root (29) over by
    framework-arduinoespressif32 (core 3.3.11) 290 320 +73
    toolchain-riscv32-esp 252 282 +35
    toolchain-xtensa-esp-elf 245 275 +28

    New finding — the layout proposed in the report still does not fit

    Dropping <kind>\<stem>\<16 hex> and the archive's own top folder (esp32-core-3.3.11, xtensa-esp-elf-14.2.0_…, …) gives <root>\i\<8 hex>\<version>\<file tail>:

    package below root root 29 (today) root 19 root 16
    framework 227 257 (+10) 247 (0 margin) 244 (−3)
    riscv32 169 199 189 186
    xtensa 160 190 180 177

    So the flat install layout alone leaves the framework 10 units over the limit at today's root. The automatic root has to shrink as well (to ≤ 19 units for zero margin, ≤ 16 for any margin — C:\fb<8 hex>\p\c is 15). The extraction scratch needs the same treatment: +esp32s3_staging adds 16 units to the check, inside <root>\tmp\esp32-framework\fbuild_sdk_XXXXXX\….

    Fix shape (all fbuild-owned, ~2–3 files + a Windows e2e)

    1. In fallback mode only, install under <root>\i\<8 hex>\<version>\ and drop the archive's top folder — touches disk_cache/paths.rs (sole constructor), DiskCache::get_toolchain_path / get_platform_path, install_path() consumers, the index rel_path, and the GC walk.
    2. Shrink automatic_roots() to ≤ 16 units (fb<8 hex>\p\c), with a marker-schema bump so an existing windows-short-paths.json re-resolves instead of failing validation.
    3. Shorten the framework staging scratch name and drop +<chip>_staging in favour of the flat id.

    Why CI never caught it — this part is unconditional

    .github/workflows/check-windows.yml, step "Windows long-path repair and fallback smoke", sets LongPathsEnabled = 0 and then only runs

    $cli --no-update-check install tests/platform/esp32dev --dry-run --json
    

    A dry run never extracts, so validate_extraction_tree is never reached with the flag off. The two real ESP32 installs in that job (legacy [email protected], pioarduino 55.03.35) run earlier, under the runner's default policy. That dry-run is the whole reason a build-blocking gap shipped.

    Acceptance test for the fix: in the same step, after setting the value to 0, run a real install of the report's pioarduino/[email protected] esp32s3 environment (not --dry-run), assert exit 0, assert every extracted path is ≤ 247 units, then build the sketch; restore the registry value in finally.

    Ruling needed before implementation

    Parts 1–2 fork the on-disk cache layout for every fallback-mode user (new directories, index rel-paths, GC) and rename/re-schema the automatic root. Both are one-way doors for already-populated caches: entries written by an older fallback build become unreachable and are reclaimed by GC. Options:

    • (a) do both, fallback mode only — recommended; it is the only combination that fits under 260;
    • (b) extended-length \\?\ plumbing instead of a layout change — no Windows proof exists, and third-party mingw gcc / archive tools do not reliably accept \\?\;
    • (c) diagnostic only (say plainly that a standard user cannot build ESP32 until an administrator enables long paths) — no code fork.

    Blocked on that ruling; nothing is implemented yet. Re-verify with --unblock-issue 2156 once one of (a)–(c) is chosen.

  2. added
    bug
    on Nov 23, 2026
  3. moved this from Triage to In Progress in FastLED Trackeron Nov 24, 2026
  4. moved this from In Progress to In Review in FastLED Trackeron Nov 24, 2026
  5. moved this from In Review to Done in FastLED Trackeron Nov 25, 2026
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

    bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions