Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Symbols parsing and finding stops working Qtcreator v4.11.0 + CMAKE on linux x64



  • QtCreator + CMAKE C/C++ project with gcc, or clang on linux x64 stops parsing and finding code symbols in the editor.

    Version dev env: Qtcreatorv4.11.0 on linux x64 ubuntu18

    Happens in C/C++ with CMAKE and gcc or clang btw, the symbols parsing i.e. finding functions or type definitions does not work :

    1. Happens 100% of the time when if not starting qtCreator in the actual CMAKE project source directory
    2. Stops working regardless after a few minutes to about 1hours, requires a restart of Qtcreator after which it usually works again.

    It's not a small bug please have a look whenever possible. Used to never happen with previous versions of QtCreator on the same machine, same cmake version and gcc or clang toolchain. I went from QtCreator v4.5 to v4.11.0 recently.

    Regards

    Evidence:
    This is the log trace that QtCreator gives when it starts to not find the symbols any more:
    ~/qtcreator-4.11.0/bin/qtcreator\

    org.kde.ksyntaxhighlighting: Unable to resolve external include rule for definition "reStructuredText" in "CMake"
    "ClangCodeModelConnectionClient" LocalSocket Error: "QLocalSocket: Remote closed"
    2020-01-28T16:26:43 Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted.
    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/include/modem_helpers.h' does not exists!
    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/include/ppp_ctrl.h' does not exists!
    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/modem_helpers.c' does not exists!
    "ClangCodeModelConnectionClient" LocalSocket Error: "QLocalSocket: Remote closed"
    2020-01-28T16:26:43 Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted.
    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/modem_helpers.c' does not exists!
    "ClangCodeModelConnectionClient" LocalSocket Error: "QLocalSocket: Remote closed"
    2020-01-28T16:26:43 Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted.
    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/modem_helpers.c' does not exists!
    "ClangCodeModelConnectionClient" LocalSocket Error: "QLocalSocket: Remote closed"
    2020-01-28T16:26:44 Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted.
    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/modem_helpers.c' does not exists!
    message lost: 0 894293795405824
    Unknown Message
    MessageEnvelop()

    Circumstances: This happened as the source code was parsed ok by CMAKE using Ninja, then the actual executable (C/ARM-GCC) was compiled ok without error with GCC from a yocto linux ARM toolchain (Yocto Poky toolchain 2.2.4).

    The only way to get out of this situation is to restart QtCreator, trying to re-run Cmake, clear cmake configuration, rebuild the executable does not fix it, so it seems that the clang codemodel process/thread/tasks crashed or get in a blocked state somehow and is not being restarted until QtCreator itself restarts.


  • Lifetime Qt Champion

    @rsacchettini said in Symbols parsing and finding stops working Qtcreator v4.11.0 + CMAKE on linux x64:

    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/include/modem_helpers.h' does not exists!
    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/include/ppp_ctrl.h' does not exists!
    Error in ClangCodeModelServer::documentsClosed: Document '/home/romain/Projects/dzmx/src/modem/modem_helpers.c' does not exists!

    Are these error messages valid?

    Happens 100% of the time when if not starting qtCreator in the actual CMAKE project source directory

    What do you mean with that? Please elaborate.

    Also, as I told you in the other thread, you might want to downgrade Creator as the CMake integration is currently in the flow (migrates from the server mode to the file API of CMake).

    Regards

    Edit: As you already used an older Qt Creator before, try running the new one with -settingspath </some/empty/folder>. That solved lot's of my Clang problems when upgrading over several versions.



  • @aha_1980

    • You are right these logs appear systematically when not running qtCreator inside the cmake dir source. Again used to be no problems with previous versions.
      -In this current case with v4.11.0, these logs appear when running it from the cmake source dir, and then "xxxx.h/.c does not exists" appeared specifically after compiling, with success, the cmake c/c++ application.
      Before then, the terminal would remain clear of any error. i will video screencast this and then post it here so you can see exactly what's happening in terms of the timeline.

    • Happens 100% of the time... I mean by this that, when not running QtC v4.11.0 from the cmake source dir, then these error messages appear as soon as the project is opened without doing anything further. And these error messages also appear after each and every (successful) compilation.

    • I can revert back to previous versions of QtCreator of course get back to v4.5 until these issues are resolved, no problems, but I simply wanted to raise a ticket on this issue if it needs to be fixed.

    Thanks for your help!



  • I have the same issue in the same scenario (v4.11.1, Cmake, linux64) here with ClangCodeModel enabled. Symbols parsing is not working.
    If I disable ClangCodeModel, the semantic highlighting is fine.
    My distro is ArchLinux. I tried also Qt official QtCreator with the same result.

    I get this error at boot:
    "PchManagerConnectionClient" LocalSocket Error: "QLocalSocket: Remote closed"

    I tried passing "-settingspath" with a new folder, everything is loaded with default values, but the issue still persists.



  • @enricop said in Symbols parsing and finding stops working Qtcreator v4.11.0 + CMAKE on linux x64:

    ClangCodeModel

    Managed to resolve this issue which was:
    Although the cmake Cmakelists.txt file was correctly setting the CMAKE_SYSROOT variable, it was not picking it up.
    Same thing when using a toolchain file that specified it.

    Instead the sysroot has to be specified in double in the kit settings "Sysroot:"

    For a number of things the clang model is highly sensitive to the cmake configuration and what's generated in the current build dir.
    But in this case the sysroot variable kit setting line is compulsory.

    This issue can be closed.


Log in to reply