# cmake error for ti cgt \>8

**URL:** https://discourse.cmake.org/t/cmake-error-for-ti-cgt-8/8120
**Category:** Development
**Tags:** comp:ti
**Created:** [May 13, 2023, 2:45pm UTC](https://discourse.cmake.org/t/cmake-error-for-ti-cgt-8/8120 "2023-05-13T14:45:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Freed-Wu](https://discourse.cmake.org/user_avatar/discourse.cmake.org/freed-wu/32/3347_2.png) [@Freed-Wu](https://discourse.cmake.org/u/Freed-Wu)
#### Post date: [May 13, 2023, 2:45pm UTC](https://discourse.cmake.org/t/cmake-error-for-ti-cgt-8/8120/1 "2023-05-13T14:45:51Z")

</div>

## Reproduce Procedures

`cmake/ti.cmake`:

```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})

```

```shell
$ 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

```shell
    /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`:

```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:

```shell
$ /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

```shell
$ /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`?

```shell
$ 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](https://github.com/Freed-Wu/x264-dsp). TI-CGT comes from [here](https://aur.archlinux.org/packages/ccstudio)

---

<div class="post-metadata">

### Author: ![Freed-Wu](https://discourse.cmake.org/user_avatar/discourse.cmake.org/freed-wu/32/3347_2.png) [@Freed-Wu](https://discourse.cmake.org/u/Freed-Wu)
#### Post date: [December 9, 2024, 11:58am UTC](https://discourse.cmake.org/t/cmake-error-for-ti-cgt-8/8120/2 "2024-12-09T11:58:12Z")

</div>

Same bug as [[feature] Support linear assembly of TI DSP · Issue #13670 · mesonbuild/meson · GitHub](https://github.com/mesonbuild/meson/issues/13670)
