Skip to content

CMake: Command line too long on Ninja/ARMClang on Windows #14533

@ccli8

Description

@ccli8

Description of defect

On Ninja/ARMClang, Win10, mbed-os-example-for-azure is failed to compile. The cause seems to related to the bugfix below:

mbed-os/CMakeLists.txt

Lines 245 to 252 in c734138

# Ninja requires to be forced for response files
if ("${CMAKE_GENERATOR}" MATCHES "Ninja")
# known issue ARMClang and Ninja with response files for windows
# https://gitlab.kitware.com/cmake/cmake/-/issues/21093
if(NOT (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows" AND CMAKE_CXX_COMPILER_ID MATCHES "ARMClang"))
set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "")
endif()
endif()

However, after the bugfix, a new issue is introduced: command line too long.

Target(s) affected by this defect ?

DISCO_L475VG_IOT01A

Toolchain(s) (name and version) displaying this defect ?

ARM Compiler 6.12

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.9.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed-tools: 7.8.0
CMake: 3.19.3
Ninja:: 1.10.2

How is this defect reproduced ?

  1. Clone mbed-os-example-for-azure and navigate to mbed-os-6.9.0 tag.

    git clone https://github.com/ARMmbed/mbed-os-example-for-azure
    mbed update -C mbed-os-6.9.0
  2. No need to change azure cloud related setting. Just focus on compile process.

  3. Patch CMakeLists.txt to be compatible with mbed-tools 7.8.0

     set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
     ......
     mbed_set_mbed_target_linker_script(${APP_TARGET})
     
  4. Build on Ninja/ARMClang

    mbed-tools configure -m DISCO_L475VG_IOT01A -t ARM
    cmake -S . -B cmake_build/DISCO_L475VG_IOT01A/develop/ARM -GNinja -DCMAKE_BUILD_TYPE=develop
    cmake --build cmake_build/DISCO_L475VG_IOT01A/develop/ARM
    
  5. Error log with command line stripped

    CreateProcess failed. Command attempted:
    "C:\Keil_v5\ARM\ARMCLANG\bin\armclang.exe --target=arm-arm-none-eabi -DARM_MATH_CM4 ......
    ninja: fatal: CreateProcess: The parameter is incorrect.    
    (is the command line too long?)
    

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions