# TI CGT: How to stop cmake converting libc.a to c?

**URL:** https://discourse.cmake.org/t/ti-cgt-how-to-stop-cmake-converting-libc-a-to-c/8121
**Category:** Usage
**Tags:** comp:ti
**Created:** [May 13, 2023, 4:16pm UTC](https://discourse.cmake.org/t/ti-cgt-how-to-stop-cmake-converting-libc-a-to-c/8121 "2023-05-13T16:16:56Z")
**Posts on this page:** 6
**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, 4:16pm UTC](https://discourse.cmake.org/t/ti-cgt-how-to-stop-cmake-converting-libc-a-to-c/8121/1 "2023-05-13T16:16:56Z")

</div>

When I

```cmake
link_libraries(libc.a)

```

`cmake --build build` will run

```auto
/opt/ccstudio/ccs/tools/compiler/c6000_7.4.24/bin/cl6x --run_linker --output_file=x264 --map_file=x264.map -heap=0x1000000 -stack=0x1000000 CMakeFiles/XXX/X.c.obj ... -library=c

```

It will fail due to `error: cannot find file "c"`

the correct syntax is

```auto
/opt/ccstudio/ccs/tools/compiler/c6000_7.4.24/bin/cl6x --run_linker --output_file=x264 --map_file=x264.map -heap=0x1000000 -stack=0x1000000 CMakeFiles/XXX/X.c.obj ... -library=libc.a

```

Currently, I have to

```cmake
link_libraries(.../lib/libc.a)

```

to avoid cmake convert `libc.a` to `c`.

How to stop cmake converting?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 14, 2023, 12:26pm UTC](https://discourse.cmake.org/t/ti-cgt-how-to-stop-cmake-converting-libc-a-to-c/8121/2 "2023-05-14T12:26:04Z")

</div>

This seems like a behavior change? I don’t know how well-tested the TI compilers are, but maybe this is a hole that hadn’t been tested before?

@brad.king

---

<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 15, 2023, 6:21am UTC](https://discourse.cmake.org/t/ti-cgt-how-to-stop-cmake-converting-libc-a-to-c/8121/3 "2023-05-15T06:21:47Z")

</div>

So how can we stop cmake convert `libc.a` to `c`? And why cmake do this convert?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 15, 2023, 10:11am UTC](https://discourse.cmake.org/t/ti-cgt-how-to-stop-cmake-converting-libc-a-to-c/8121/4 "2023-05-15T10:11:52Z")

</div>

I’m not familiar enough with TI support to know; generally CMake prefers absolute paths for libraries already. I’m unsure if this logic lives in the CMake code or C++, but it feels like a C++ thing to me.

I suspect, based on your other questions, that newer TI compilers need some additional work to be supported in CMake.

---

<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 15, 2023, 10:20am UTC](https://discourse.cmake.org/t/ti-cgt-how-to-stop-cmake-converting-libc-a-to-c/8121/5 "2023-05-15T10:20:25Z")

</div>

The latest document of TI-CGT is [https://www.ti.com/lit/ug/sprui04e/sprui04e.pdf](https://www.ti.com/lit/ug/sprui04e/sprui04e.pdf). And usually it is installed as `/opt/ccstudio/ccs/tools/compiler/c6000_7.4.24` or `/opt/ccstudio/ccs/tools/compiler/ti-cgt-c6000_8.3.12`. Why not provide `CMAKE_TI_CGT` like `CMAKE_ANDROID_NDK`? And How about [https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html) add some document about how to use TI-CGT?

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [May 15, 2023, 3:13pm UTC](https://discourse.cmake.org/t/ti-cgt-how-to-stop-cmake-converting-libc-a-to-c/8121/6 "2023-05-15T15:13:13Z")

</div>

> how can we stop cmake convert `libc.a` to `c`? And why cmake do this convert?

`[target_]link_libraries(libc.a)`, without an absolute path, is treated as a cross-platform abstraction for “tell the linker to search for this library”. It is converted to just the library name, `c`, and then later converted to whatever the current linker expects for searching for a library by name. The default is `-lc` if CMake doesn’t know anything more about the current toolchain’s linker.

CMake’s knowledge of TI toolchains is maintained only by external contributors, and I do not know what level of maturity it has. There are [some issues](https://gitlab.kitware.com/cmake/cmake/-/issues/?state=opened&label_name%5B%5D=comp%3Ati) for it.
