Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement Linker command/response files in make export #9596
The original PR was closed since "it's really hard to find make > 3.81 for windows."
The fix allows to build the mbed projects exported under Windows to environments that use the generated makefile: make_gcc_arm, make_iar, make_armc5, make_armc6, eclipse_gcc_arm, eclipse_iar, eclipse_armc5, vscode_gcc_arm, vscode_iar, vscode_armc5.
The error happens due to the list of the object files passed to the linker process exceeding Windows limit for the command line length.
Fixes the following issues:
Pull request type
@theotherjimmy (who is the author of the original commit on the PR)
The original commit uses $(file > $@.in, $(filter %.o, $^)) syntax - this is not compatible with GNU Make 3.81 commonly found on macOS.
I reworked the rule in Makefile template to use the echo redirect instead:
I believe .link_options.txt is more appropriate name for the temporary response file: $(PROJECT).in looks like a public artifact.
I tested this with GNU Make 4.21 on Cygwin and MSYS2, as well as with make 3.81 on macOS.
ARMmbed/mbed-os-5-docs#935 documents the findings on make utilities compatible with mbed generated makefiles.
Please prioritize this for the next release: Cypress heavily relies on the ability to build and debug Mbed projects in external environments supported by Makefile, throwing
echo "$(filter %.o, $^)" is executed by cygwin make, in cygwin shell, my guess is that standard Win32 interface for process execution is somehow bypassed. The same works with MSYS2. In contrary, linker process (arm-none-eabi-gcc.exe) is native Win32 executable, unable to handle the huge argument list.
Yes, here is my test plan:
Windows 10 x64, Mbed CLI 1.8.3, Cygwin x64, make 4.2.1, GNU Tools ARM Embedded 6 2017-q2-update, GNU MCU Eclipse.
Failing test case
Open GNU MCU Eclipse and import mbed-os-example-blinky
Project -> Build project
Passing test case
Switch back to Mbed CLI
Switch back to GNU MCU Eclipse
I also checked the build passes with GNU Make 3.81 on macOS High Sierra.
Feb 7, 2019
27 checks passed
@vmedcy @theotherjimmy This is labeled as fix for 5.11.4. However, some windows users might be affected (as mentioned in ARMmbed/mbed-os-5-docs#935, gnuwin32 is not compatible. I have this installed locally as well). Thus this can be viewed as breaking change and should be in 5.12 rather with release notes mentioning this change?
No. This change is only applicable to makefile based exporters. CMake export produces the projects that can be compiled and linked on Windows without path length issues. I tested with Ninja generator:
By the way, ninja build is much faster than makefile build.