When I
link_libraries(libc.a)
cmake --build build
will run
/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
/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
link_libraries(.../lib/libc.a)
to avoid cmake convert libc.a
to c
.
How to stop cmake converting?
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
So how can we stop cmake convert libc.a
to c
? And why cmake do this convert?
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.
The latest document of TI-CGT is 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 add some document about how to use TI-CGT?
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 for it.