Hello,
we are working currently mostly with CMake versions 3.22, 3.25 and 3.27. One colleague updated to 3.31 and couldn’t build its application anymore with the TI CLang (LTS 3.2.2).
When linking it threw an error
“file not found: stdc++”
and when checking the link-command it adds a suspicious --library=libstdc++. This is nowhere in the project added by us and does not occure with versions 3.22, 3.25 and 3.27.
TIClang does NOT use the stdlibc++ but the libc++, which is documented in their compiler manual.
We did not check version by version, but we suspect the CMake 3.29 which got TIClang-support as the reason.
We use a toolchain-file to define any needed variables. This was created before TI CLang-support. It looks like this:
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) #Skip compiler tests...
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
######## Checking Environment Variables ########
if("$ENV{TI_HOME_DIR}" STREQUAL "")
message(FATAL_ERROR "Please setup the environment variable TI_HOME_DIR, e.g. /home/$(USER)/ti or c:\\ti")
endif()
set(TI_COMPILER_PATH $ENV{TI_HOME_DIR}/ti-cgt-armllvm_3.2.2.LTS)
# Find the compiler, linker and archiver...
find_program(CMAKE_C_COMPILER
NAMES tiarmclang
HINTS ${TI_COMPILER_PATH}/bin
)
find_program(CMAKE_CXX_COMPILER
NAMES tiarmclang
HINTS ${TI_COMPILER_PATH}/bin
)
find_program(CMAKE_ASM_COMPILER
NAMES tiarmclang
HINTS ${TI_COMPILER_PATH}/bin
)
find_program(CMAKE_AR
NAMES tiarmar
HINTS ${TI_COMPILER_PATH}/bin
)
find_program(CMAKE_ARMCC_LINKER
NAMES tiarmclang
HINTS ${TI_COMPILER_PATH}/bin
)
find_program(CMAKE_ARMCC_AR
NAMES tiarmar
HINTS ${TI_COMPILER_PATH}/bin
)
find_program(CMAKE_ARMCC_SIZE
NAMES tiarmsize
HINTS ${TI_COMPILER_PATH}/bin
)
find_program(CMAKE_ARMOBJCOPY
NAMES tiarmobjcopy
HINTS ${TI_COMPILER_PATH}/bin
)
find_program(CMAKE_ARMREADELF
NAMES tiarmreadelf
HINTS ${TI_COMPILER_PATH}/bin
)
# enable_language(ASM)
if(NOT (CMAKE_C_COMPILER) OR NOT (CMAKE_CXX_COMPILER) OR NOT (CMAKE_ASM_COMPILER) OR NOT (CMAKE_ARMCC_LINKER) OR NOT(CMAKE_ARMCC_AR) OR NOT(CMAKE_AR))
message(FATAL_ERROR "tiarmclang or tiarmar could not be found!")
endif()
# Removes the default compiler options
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE STRING "")
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_C_FLAGS_RELEASE "" CACHE STRING "")
set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY} CACHE STRING "")
set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_ASM_COMPILER} -x assembler -mcpu=cortex-r5 -c <SOURCE> -o <OBJECT>" CACHE STRING "")
From where is this magic linker-option “–library=stdc++” occuring and how can we suppress this?