Skip to content

Commit dd134d2

Browse files
zackeesclaude
andauthored
fix(build): #234 use @response file for teensy link on Windows (#235)
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>
1 parent 73c2d2f commit dd134d2

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

crates/fbuild-build/src/teensy/teensy_linker.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,23 @@ impl Linker for TeensyLinker {
101101
tracing::info!("link: {}", args.join(" "));
102102
}
103103

104-
let args_ref: Vec<&str> = args.iter().map(|s| s.as_str()).collect();
105-
let result = run_command(&args_ref, None, None, None)?;
104+
// On Windows, use a response file to avoid command-line length limits
105+
// (teensy41 produces ~500 .o files; see issue #234).
106+
let result = if cfg!(windows) && args.len() > 50 {
107+
let temp_dir = output_dir.join("tmp");
108+
std::fs::create_dir_all(&temp_dir)?;
109+
let rsp_content: Vec<String> = args[1..].iter().map(|a| a.replace('\\', "/")).collect();
110+
let rsp_path = fbuild_core::response_file::write_response_file(
111+
&rsp_content,
112+
&temp_dir,
113+
"teensy_link",
114+
)?;
115+
let rsp_arg = format!("@{}", rsp_path.display());
116+
run_command(&[args[0].as_str(), &rsp_arg], None, None, None)?
117+
} else {
118+
let args_ref: Vec<&str> = args.iter().map(|s| s.as_str()).collect();
119+
run_command(&args_ref, None, None, None)?
120+
};
106121

107122
if !result.success() {
108123
return Err(fbuild_core::FbuildError::BuildFailed(format!(

0 commit comments

Comments
 (0)