Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-27623

clangd says it can't find stddef.h

    XMLWordPrintable

    Details

    • Commits:
      0978d16093 (qt-creator/qt-creator/8.0) 0978d16093 (qt-creator/qt-creator/master)

      Description

      In the following file:

      #include <stddef.h>
      #include <cstddef>
      

      (no project required)

      If you open this in Qt Creator (current master, LLVM 14.0.4, GCC 12), the first line is highlighted with an error and it says it can't find stddef.h with "Source: clangd". The next line shows no error, indicating that Qt Creator and Clangd can find headers.

      strace'ing the two processes, here are the references to "stddef":

      130243 access("/usr/include/c++/12/cstddef", F_OK) = 0
      130243 statx(AT_FDCWD, "/usr/include/c++/12/cstddef", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=6258, ...}) = 0
      130243 access("/usr/lib64/gcc/x86_64-suse-linux/12/include/stddef.h", F_OK) = 0
      130243 statx(AT_FDCWD, "/usr/lib64/gcc/x86_64-suse-linux/12/include/stddef.h", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=13275, ...}) = 0
      130243 access("/usr/include/linux/stddef.h", F_OK) = 0
      130243 statx(AT_FDCWD, "/usr/include/linux/stddef.h", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=1476, ...}) = 0
      130313 openat(AT_FDCWD, "/tmp/QtCreator-rCCifz/clang-uiheader-vkoNiu/stddef.h", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      130313 openat(AT_FDCWD, "/home/tjmaciei/obj/qt/installed/share/qtcreator/cplusplus/wrappedQtHeaders/stddef.h", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      130313 openat(AT_FDCWD, "/home/tjmaciei/obj/qt/installed/share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/stddef.h", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      130313 openat(AT_FDCWD, "/tmp/stddef.h", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      130313 openat(AT_FDCWD, "/tmp/QtCreator-rCCifz/clang-uiheader-vkoNiu/cstddef", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      130313 openat(AT_FDCWD, "/home/tjmaciei/obj/qt/installed/share/qtcreator/cplusplus/wrappedQtHeaders/cstddef", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      130313 openat(AT_FDCWD, "/home/tjmaciei/obj/qt/installed/share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/cstddef", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      130313 openat(AT_FDCWD, "/tmp/cstddef", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      130313 newfstatat(AT_FDCWD, "/tmp/stddef.h", 0x7f05a3f9f5d8, 0) = -1 ENOENT (No such file or directory)
      130313 newfstatat(AT_FDCWD, "/tmp/cstddef", 0x7f05a3f9f5d8, 0) = -1 ENOENT (No such file or directory)
      

      To note:

      • PID 130243 is Qt Creator
      • PID 130313 is a thread of clangd
      • Qt Creator on the third line found the right file (/usr/lib64/gcc/x86_64-suse-linux/12/include/stddef.h)
      • clangd couldn't open either file

      I don't understand what's wrong and I don't know how to debug this. I've rebuild everything from clean sources today.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            thiago Thiago Macieira
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes