cmake error for ti cgt >8

Reproduce Procedures

cmake/ti.cmake:

set(CMAKE_SYSTEM_NAME Generic)
if(NOT DEFINED TOOLCHAIN_SUFFIX)
  set(TOOLCHAIN_SUFFIX 6x)
endif()
set(CMAKE_C_COMPILER cl${TOOLCHAIN_SUFFIX})
set(CMAKE_CXX_COMPILER cl${TOOLCHAIN_SUFFIX})
$ cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=cmake/ti.cmake --fresh -G Unix\ Makefiles
-- The C compiler identification is TI 8.3.12
-- The ASM compiler identification is TI
-- Found assembler: /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x
-- Check for working C compiler: /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/wzy/workspace_v12/x264-dsp/build/CMakeFiles/CMakeScratch/TryCompile-0ZIw3c

    Run Build Command(s):/usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_7f2eb/fast && /usr/bin/make  -f CMakeFiles/cmTC_7f2eb.dir/build.make CMakeFiles/cmTC_7f2eb.dir/build
    make[1]: Entering directory '/home/wzy/workspace_v12/x264-dsp/build/CMakeFiles/CMakeScratch/TryCompile-0ZIw3c'
    Building C object CMakeFiles/cmTC_7f2eb.dir/testCCompiler.c.obj
    /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x --compile_only --c_file=/home/wzy/workspace_v12/x264-dsp/build/CMakeFiles/CMakeScratch/TryCompile-0ZIw3c/testCCompiler.c    --output_file=CMakeFiles/cmTC_7f2eb.dir/testCCompiler.c.obj
    Linking C executable cmTC_7f2eb
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7f2eb.dir/link.txt --verbose=1
    /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x --run_linker --output_file=cmTC_7f2eb --map_file=cmTC_7f2eb.map CMakeFiles/cmTC_7f2eb.dir/testCCompiler.c.obj
    <Linking>
    error: no input section is linked in
    warning: no suitable entry-point found; setting to 0
    error: errors encountered during linking; "cmTC_7f2eb" not built

    >> Compilation failure
    make[1]: *** [CMakeFiles/cmTC_7f2eb.dir/build.make:99: cmTC_7f2eb] Error 1
    make[1]: Leaving directory '/home/wzy/workspace_v12/x264-dsp/build/CMakeFiles/CMakeScratch/TryCompile-0ZIw3c'
    make: *** [Makefile:127: cmTC_7f2eb/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!

I notice

    /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x --compile_only --c_file=/home/wzy/workspace_v12/x264-dsp/build/CMakeFiles/CMakeScratch/TryCompile-0ZIw3c/testCCompiler.c    --output_file=CMakeFiles/cmTC_7f2eb.dir/testCCompiler.c.obj
    Linking C executable cmTC_7f2eb
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7f2eb.dir/link.txt --verbose=1
    /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x --run_linker --output_file=cmTC_7f2eb --map_file=cmTC_7f2eb.map CMakeFiles/cmTC_7f2eb.dir/testCCompiler.c.obj

So I create testCCompiler.c:

#ifdef __cplusplus
# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"
#endif
#if defined(__CLASSIC_C__)
int main(argc, argv)
  int argc;
  char* argv[];
#else
int main(int argc, char* argv[])
#endif
{ (void)argv; return argc-1;}

Then:

$ /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x --compile_only --c_file=testCCompiler.c --output_file=testCCompiler.c.obj
$ /opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12/bin/cl6x --run_linker --output_file=cmTC_44cc7 --map_file=cmTC_44cc7.map testCCompiler.c.obj
<Linking>
error: no input section is linked in
warning: no suitable entry-point found; setting to 0
error: errors encountered during linking; "cmTC_44cc7" not built

>> Compilation failure

I get a error.

But

$ /opt/ccstudio/ccs/tools/compiler/c6000_7.4.24/bin/cl6x --compile_only --c_file=testCCompiler.c --output_file=testCCompiler.c.obj
$ /opt/ccstudio/ccs/tools/compiler/c6000_7.4.24/bin/cl6x --run_linker --output_file=cmTC_44cc7 --map_file=cmTC_44cc7.map testCCompiler.c.obj
<Linking>
warning: no suitable entry-point found; setting to 0

Although I get a warning, it can pass.

So I guess after 8.0.0, TI-CGT have different behaviour, but cmake only support < 8.0.0?

$ cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=cmake/ti.cmake
-- The C compiler identification is TI 7.4.24
-- The ASM compiler identification is TI
-- Found assembler: /opt/ccstudio/ccs/tools/compiler/c6000_7.4.24/bin/cl6x
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/ccstudio/ccs/tools/compiler/c6000_7.4.24/bin/cl6x - skipped
-- Detecting C compile features
-- Detecting C compile features - failed
-- Looking for logf in m
-- Looking for logf in m - not found
CMake Warning (dev) at /usr/lib/cmake/check/check-targets.cmake:63 (add_library):
  ADD_LIBRARY called with SHARED option but the target platform does not
  support dynamic linking.  Building a STATIC library instead.  This may lead
  to problems.
Call Stack (most recent call first):
  /usr/lib/cmake/check/check-config.cmake:36 (include)
  tests/CMakeLists.txt:1 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: XXX

So, cmake only support TI-CGT < 8.0.0 not > 8.0.0?

The entire code is here. TI-CGT comes from here