[MSYS2] CMake+Ninja Fix arm-none-eabi-ar: Argument list too long
This issue is related to the Arm toolchain for Windows which is available for x86 host architecture only (compatible with x86_64)
Windows (mingw-w64-i686) hosted cross toolchains
AArch32 bare-metal target (arm-none-eabi)
Issue
/bin/sh: line 1: /home/nuttx/nuttxnew/tools/gcc-arm-none-eabi/bin/arm-none-eabi-ar: Argument list too long
On Windows, arm-none-eabi-ar can only accept strings up to a maximum length of 32,768 characters.
We could suppress the 32K include string limitation by setting the CMake variable CMAKE_NINJA_FORCE_RESPONSE_FILE to ON.
This is unfortunately not enough!!! ): In the build phase this error comes out
$ cmake --build build
[2/1025] Building ASM object arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj
FAILED: arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj
/home/nuttx/nuttxnew/tools/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe @arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj.rsp -MD -MT arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj -MF arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj.d -o arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj -c /home/nuttx/nxninja/nuttx/arch/arm/src/armv7-m/arm_exception.S
C:/msys64/home/nuttx/nxninja/nuttx/arch/arm/src/armv7-m/arm_exception.S:42:10: fatal error: nuttx/config.h: No such file or directory
42 | #include <nuttx/config.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
The Workround I found to solve this problem is to overwrite
the responsible file flag CMAKE_${lang}_RESPONSE_FILE_FLAG with $DEFINES $INCLUDES $FLAGS
Maybe there is a better solution but this one it works. :)
This commit is contained in:
parent
27f278af90
commit
d16de91e39
3 changed files with 17 additions and 3 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
|
@ -328,7 +328,7 @@ jobs:
|
|||
git config --global --add safe.directory /github/workspace/sources/nuttx
|
||||
git config --global --add safe.directory /github/workspace/sources/apps
|
||||
cd sources/nuttx/tools/ci
|
||||
./cibuild.sh -g -i -A -C -R testlist/${{matrix.boards}}.dat
|
||||
./cibuild.sh -g -i -A -C -N -R testlist/${{matrix.boards}}.dat
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -337,13 +337,19 @@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config OR NOT "${NUTTX_DEFCONFIG}" STREQUAL
|
|||
CACHE INTERNAL "Saved defconfig path" FORCE)
|
||||
|
||||
# Print configuration choices
|
||||
message(STATUS " CMake ${CMAKE_VERSION}")
|
||||
message(STATUS " CMake: ${CMAKE_VERSION}")
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja")
|
||||
execute_process(
|
||||
COMMAND ninja --version
|
||||
OUTPUT_VARIABLE ninja_version
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS " Ninja ${ninja_version}")
|
||||
message(STATUS " Ninja: ${ninja_version}")
|
||||
|
||||
# Ninja generator does not yet know how to build archives in pieces, so
|
||||
# response files must be used to deal with very long linker command lines.
|
||||
set(CMAKE_NINJA_FORCE_RESPONSE_FILE
|
||||
1
|
||||
CACHE INTERNAL "")
|
||||
endif()
|
||||
message(STATUS " Board: ${NUTTX_BOARD}")
|
||||
message(STATUS " Config: ${NUTTX_CONFIG}")
|
||||
|
|
|
|||
|
|
@ -73,6 +73,14 @@ if(CONFIG_ARCH_TOOLCHAIN_GNU AND NOT CONFIG_ARCH_TOOLCHAIN_CLANG)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# override the responsible file flag
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja")
|
||||
set(CMAKE_C_RESPONSE_FILE_FLAG "$DEFINES $INCLUDES $FLAGS @")
|
||||
set(CMAKE_CXX_RESPONSE_FILE_FLAG "$DEFINES $INCLUDES $FLAGS @")
|
||||
set(CMAKE_ASM_RESPONSE_FILE_FLAG "$DEFINES $INCLUDES $FLAGS @")
|
||||
endif()
|
||||
|
||||
# override the ARCHIVE command
|
||||
|
||||
set(CMAKE_ARCHIVE_COMMAND "<CMAKE_AR> rcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue