Skip to content

fix(build): #234 use @response file for teensy link on Windows#235

Merged
zackees merged 1 commit into
mainfrom
fix/issue-234-teensy-link-response-file
May 12, 2026
Merged

fix(build): #234 use @response file for teensy link on Windows#235
zackees merged 1 commit into
mainfrom
fix/issue-234-teensy-link-response-file

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented May 12, 2026

Summary

Closes #234.

  • Teensy boards (notably teensy41 with ~500 .o files) exceeded Windows' ~32 KB CreateProcessW cmdline limit at link time, failing with io error: The filename or extension is too long. (os error 206).
  • Linux (~128 KB) and macOS (~256 KB) absorbed the same cmdline, so CI (Ubuntu) was green while Windows developers were blocked.
  • ArmLinker (STM32/RP2040/NRF52) and Esp32Linker already use GCC @response files for the link step on Windows. TeensyLinker was the outlier.
  • This PR mirrors the existing ArmLinker pattern in crates/fbuild-build/src/teensy/teensy_linker.rs: when cfg!(windows) && args.len() > 50, write the linker args to output_dir/tmp/fbuild_teensy_link_<hash>.rsp via the shared fbuild_core::response_file::write_response_file, then invoke arm-none-eabi-gcc @<rsp>. Linux/macOS keep the direct invocation.

No new utilities, no behavior change for small sketches, no change to the existing Teensy integration test (crates/fbuild-build/tests/teensy_build.rs).

Test plan

  • uv run soldr cargo fmt --all
  • uv run soldr cargo check --workspace --all-targets
  • uv run soldr cargo clippy -p fbuild-build --all-targets -- -D warnings
  • uv run soldr cargo test -p fbuild-build --lib (499 passed)
  • Manual Windows repro: bash compile teensy41 --examples Blink against a FastLED checkout produces firmware.elf and a .fbuild/build/teensy41/release/tmp/fbuild_teensy_link_*.rsp file. (Best verified post-merge in CI/local Windows; companion FastLED PR for the section-conflict compile error is still needed to actually reach the link step on that branch.)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed Windows build failures when linker argument lists exceed typical command-line limits. The build system now automatically uses a response file mechanism to handle complex linking scenarios, ensuring reliable compilation on Windows platforms regardless of project complexity.

Review Change Stack

Teensy boards (notably teensy41 with ~500 .o files) blew past Windows'
~32 KB CreateProcessW limit at link time, surfacing as "os error 206:
The filename or extension is too long". Linux (~128 KB) and macOS
(~256 KB) absorbed the same cmdline so CI stayed green while Windows
developers were blocked.

Mirror the existing ArmLinker (STM32/RP2040/NRF52) and Esp32Linker
pattern: on Windows, when args.len() > 50, write the linker args to a
hash-named .rsp under output_dir/tmp/ via
fbuild_core::response_file::write_response_file and invoke
arm-none-eabi-gcc with @<rsp>. Linux/macOS keep the direct invocation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: feeadb2c-f757-4308-95c5-ebe0ed063298

📥 Commits

Reviewing files that changed from the base of the PR and between 73c2d2f and 6a452eb.

📒 Files selected for processing (1)
  • crates/fbuild-build/src/teensy/teensy_linker.rs

📝 Walkthrough

Walkthrough

This PR adds Windows-specific response file handling to the Teensy linker step. When compiling on Windows with over 50 arguments, the linker arguments are written to a response file with normalized path separators, and the linker is invoked using GCC's @file syntax to avoid the 32 KB command-line limit on Windows.

Changes

Windows Linker Response File

Layer / File(s) Summary
Windows response file for link step
crates/fbuild-build/src/teensy/teensy_linker.rs
TeensyLinker::link conditionally creates a response file under output_dir/tmp when running on Windows with more than 50 arguments, normalizes path separators, and invokes the linker with @response_path syntax; otherwise uses the standard argument slice.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 A rabbit hops through Windows paths,
With response files in its math,
No more command lines too long and wide—
@symbols guide us through with pride!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: using response files for Teensy linking on Windows, matching the PR's primary objective.
Linked Issues check ✅ Passed The PR implements the exact solution proposed in #234: writing linker arguments to a response file when on Windows with >50 args and invoking with @, matching all coding requirements.
Out of Scope Changes check ✅ Passed The changes are scoped to teensy_linker.rs and focus solely on implementing response file support for Windows link failures, with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-234-teensy-link-response-file

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees zackees merged commit dd134d2 into main May 12, 2026
85 checks passed
@zackees zackees deleted the fix/issue-234-teensy-link-response-file branch May 12, 2026 16: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.

Windows: linker fails with os error 206 (cmdline > 32 KB) on teensy41 — use @response file for link step

1 participant