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

Compilation Database pulls include from wrong directory.

    XMLWordPrintable

Details

    • All
    • 3046c83f85d037d5686e625f615a1a45f675ed87 (qt-creator/qt-creator/4.10)

    Description

      I'm building Chromium, which is bundled with its own copy of libc++, passed to clang on the command line: -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include

      Naturally, the build also passes -nostdinc++ to prevent the system libstdc++ from getting pulled in. However, it doesn't appear that the Compilation Database handles this properly. As a result, when the libc++ stdlib.h does `#include_next <stdlib.h>`, it gets the libstdc++ stdlib.h, not the C version as it should, leading to a "Warning: The code model could not parse an included fileā€¦" message.

      There are a couple of other oddities here:

      First, the command-line also specifies a sysroot, but the libstdc++ header that's erroneously pulled in appears to be from /usr/include/c++/6, not from the sysroot. If I leave omit -nostdinc++ on the command line, I get the same error, but instead pointing to libstdc++ in the sysroot like I'd expect, not /usr/include like in Qt Creator.

      Second, while the error's the same, the include trace is a little different.

      On the command line:

      In file included from ../../buildtools/third_party/libc++/trunk/include/memory:653:
      In file included from ../../buildtools/third_party/libc++/trunk/include/typeinfo:60:
      In file included from ../../buildtools/third_party/libc++/trunk/include/exception:81:
      In file included from ../../buildtools/third_party/libc++/trunk/include/cstdlib:85:
      In file included from ../../buildtools/third_party/libc++/trunk/include/stdlib.h:97:

      In Qt Creator:

      In file included from ../../buildtools/third_party/libc++/trunk/include/memory:653:
      In file included from ../../buildtools/third_party/libc++/trunk/include/typeinfo:60:
      In file included from ../../buildtools/third_party/libc++/trunk/include/exception:81:
      In file included from ../../buildtools/third_party/libc++/trunk/include/cstdlib:85:
      In file included from ../../buildtools/third_party/libc++/trunk/include/stdlib.h:100:
      In file included from ../../buildtools/third_party/libc++/trunk/include/math.h:301:
      In file included from ../../buildtools/third_party/libc++/trunk/include/stdlib.h:20:

      Happy to collect whatever additional information might be helpful to see what's going on. Is there an easy way to see what command-line is being passed to clang internally?

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-22760
        # Subject Branch Project Status CR V

        Activity

          People

            kandeler Christian Kandeler
            erikjensen Erik Jensen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes