[CMake] No RSP_FILE if generating in a path that contains "@"

Gerhard Olsson gerhard.nospam at gmail.com
Tue Jun 5 11:47:12 EDT 2018


 The following occurs with CMake on Windows, crosscompiling with ARMCC.

If the path contains "@", CMake ignores response file in the toolchain file:
SET( CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1 )

 The linker command is too long and fails.

The command is run in Jenkins, I have not seen a way to avoid generating @
in the path
A workaround could be to patch rules.ninja to add the rsp_file handling if
missing.

Any configuration changes that resolves the problem?
Any hints how to debug and fix CMake for this?

/Gerhard

---------------------------------------
Run in Cygwin, using Windows binary (to use with Windows compiler)

 "c:/Tools/CMake/3.11.2/bin/cmake" -G "Ninja" --no-warn-unused-cli
-DCMAKE_TOOLCHAIN_FILE=toolchain.cmake .

Note that the WindRiver compiler is OK, a difference is that
CMAKE_C_RESPONSE_FILE_LINK_FLAG is "@" by default, no need to override to
"--via" as for armcc.

--------------------------------------------
>From rules.ninja, where the path contains a "@"
rule C_EXECUTABLE_LINKER__FBLZYNQ
  command = cmd.exe /C "$PRE_LINK && C:\Tools\ARM_Compiler_5\5.0.4.82\bin64\
armlink.exe $LINK_FLAGS $LINK_PATH $LINK_LIBRARIES $in -o $TARGET_FILE &&
$POST_
BUILD"
  description = Linking C executable $TARGET_FILE
  restat = $RESTAT


>From rules.ninja, where the path has no "@"
  rule C_EXECUTABLE_LINKER__FBLZYNQ
  command = cmd.exe /C "$PRE_LINK && C:\Tools\ARM_Compiler_5\5.0.4.82\bin64\
armlink.exe $LINK_FLAGS  --via=$RSP_FILE -o $TARGET_FILE && $POST_BUILD"
  description = Linking C executable $TARGET_FILE
  rspfile = $RSP_FILE
  rspfile_content = $in_newline $LINK_PATH $LINK_LIBRARIES
  restat = $RESTAT


--------------------------------------------
toolchain.cmake:
SET( CMAKE_SYSTEM_NAME Generic )

# specify the cross compiler
SET( CMAKE_C_COMPILER "c:/Tools/ARM_Compiler_5/5.0.4.82/bin64/armcc.exe" )
SET( CMAKE_CXX_COMPILER "c:/Tools/ARM_Compiler_5/5.0.4.82/bin64/armcc.exe" )

#Disable some CMake checks - may be useful when updating the environment
SET (CMAKE_C_COMPILER_WORKS 1)
SET (CMAKE_CXX_COMPILER_WORKS 1)

#skip ABI checks
SET (CMAKE_DETERMINE_C_ABI_COMPILED 1)
SET (CMAKE_DETERMINE_CXX_ABI_COMPILED 1)
SET (CMAKE_DETERMINE_ASM_ABI_COMPILED 1)

# where is the target environment
SET( CMAKE_FIND_ROOT_PATH "c:/Tools/ARM_Compiler_5/5.0.4.82" )

# search for programs in the build host directories
SET( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )

# for libraries and headers in the target directories
SET( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
SET( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

#Too long commandline in Windows (benefit in Linux too)
SET( CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
SET( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )

SET( CMAKE_ASM_COMPILER "c:/Tools/ARM_Compiler_5/5.0.4.82/bin64/armasm.exe"
)

SET( CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <SOURCE> <DEFINES>
<FLAGS> -
o <OBJECT>" )

SET( CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> <LINK_LIBRARIES>
<OBJE
CTS> -o <TARGET>" )

SET( CMAKE_C_RESPONSE_FILE_LINK_FLAG "--via=" )

SET( CMAKE_DEPFILE_FLAGS_ASM "--depend=<OBJECT>.d --depend_format=unix" )

SET( CMAKE_DEPFILE_FLAGS_C "--depend=<OBJECT>.d --depend_format=unix
--depend_si
ngle_line" )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180605/7a4f2894/attachment.html>


More information about the CMake mailing list