-
-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mbed target - Linking fails under Windows with large list of source files #839
Comments
This is required if the number of object files is too high. Fix arduino#839
@aureleq we'd like to hear back from you at your earliest convenience :) |
Hi @ubidefeo, Just tested it works :) Thanks! Aurelien |
Hello, FYI we had a similar issue while linking for an ESP32 target. We cannot use the same workaround as the xtensa linker expands the list of files with the @ syntax. Below is another solution for ESP32 that should work on any target (this workaround is also mentioned here by @facchinm : #961 (comment)):
|
Bug Report
Current behavior
My project contains a library with a large number of source files (roughly 500 .cpp).
Under macOS the project compiles without any issue. However, under Windows 10 linking fails as the 500 object files put as argument make the command line exceeds 32k characters (Windows limit). The linking command line is roughly 64k characters long. The issue appears both with CLI or IDE.
Arduino output:
fork/exec C:\Users\aurel\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4/bin/arm-none-eabi-g++.exe: The filename or extension is too long.
Expected behavior
As a solution the list of object files should be put in a text file, linking command can read the list from it to avoid exceeding the 32k characters limit.
As a workaround, I created a platform.local.txt to bypass this issue, my linking command has become:
platform.local.txt
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "@{compiler.mbed.ldflags}" "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" @{build.path}\obj_files.txt -Wl,--whole-archive "{build.path}/{archive_file}" {compiler.mbed} -Wl,--no-whole-archive -Wl,--start-group {compiler.mbed.extra_ldflags} {compiler.libraries.ldflags} -Wl,--end-group
This solution should work well for most of projects but this should be managed directly into the Arduino builder.
Environment
Additional context
The text was updated successfully, but these errors were encountered: