Missing GCC include - bug or feature?


Clang by default uses the headers from the GCC installation, to find e.g. libstdc++. I notice however the following message when in verbose mode:

ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include"

At the same time, I notice that the following GCC include path is not added:


Therefore I wonder, is this a bug, or a feature?

The driver scans many different directories because the layout can differ between distributions. I don’t think you need to worry about it unless you have any specific problems.

I do actually have problems - that missing include path leads to my libtool-based tool not finding stddef.h, stdarg.h which exist in the GCC toolchain. My setup is a bit non-standard (Bazel-based) so I understand why this would not have been caught earlier.

Would it be OK if I added that directory to the list of search directories? I believe that would solve my problem.

stddef/stdarg are compiler-specific headers, you shouldn’t use GCC’s version for clang. These headers are usually installed into <clang path>/lib/clang/<version>/include, and if not, you can point to clang’s headers with --resource-dir=<path> argument.

1 Like

Sounds great, I will use --resource-dir then. Thanks a lot for the quick help!