CLion 2025.1 does not find header files or symbols with CMake profile using custom compiler config and toolchain file
CLion 2025.1 does not find the header files (message of “Cannot find declaration to go to”) or symbols in a CMake project when using a CMake profile with custom compiler config yaml and CMake toolchain file for an embedded device. The CMake target in this case is a library rather than an executable. Also, in the bottom right corner of the status bar, “Context | Loading …” is perpetually present.
This is not the case in CLion 2024.3. Header file and symbol analysis work as expected. In the status bar, “Context | <no context>” is present.
I am using the Linux builds of both CLion 2025.1 and 2024.3
请先登录再写评论。
Hello!
Actually,
<no context>means that CLion failed to identify the proper resolve context for the file, which indicates that CLion doesn't understand your project.Hi Anna,
Thank you for your reply. I should mention that I am using a embeddded device cross-compiler (Microchip XC8). I believe this compiler is based on Clang.
Regarding your request, please see below.
1.
2.
Here is some output from the backend log file:
Here is the custom compiler config yaml file:
Also, please note that I manually set
CMAKE_C_COMPILER_WORKSequal to TRUE in my toolchain file in order to skip the CMake compiler checks. These checks fail as CMake does not have full platform/compiler support implemented for this target.Please note that this issue persists with CLion 2025.2.3.
Are there any other log files or debug log settings that may be useful in diagnosing this issue?
Krogozinski, do I understand correctly that the xc8-cc compiler isn't supported by CMake?
If so, then CLion won't be able to properly provide code insight features in this case.
Anna Falevskaya thanks for your reply.
This is correct. The xc8-cc is not supported by CMake by default. A custom toolchain file is required, which also includes the command
set(CMAKE_C_COMPILER_WORKS TRUE). This allows CMake to proceed with the build environment generation, but it bypasses C compiler determination, features etc (inModules/CMakeCompilerIdDetection.cmakeandModules/CMakeDetermineCompilerId.cmakeand other CMake modules).I am working on integrating xc8-cc support in CMake. If I manage to pass the Test CMake run without errors (see below), will code insight work? Are there any other tests that I should do, or log files that I should monitor?