<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [CMake] Build failure with GCC 6 (fatal error: stdlib.h: No such file or directory)"
   href="https://bugs.webkit.org/show_bug.cgi?id=161697#c8">Comment # 8</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [CMake] Build failure with GCC 6 (fatal error: stdlib.h: No such file or directory)"
   href="https://bugs.webkit.org/show_bug.cgi?id=161697">bug 161697</a>
              from <span class="vcard"><a class="email" href="mailto:clopez&#64;igalia.com" title="Carlos Alberto Lopez Perez &lt;clopez&#64;igalia.com&gt;"> <span class="fn">Carlos Alberto Lopez Perez</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=161697#c6">comment #6</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=161697#c5">comment #5</a>)
&gt; &gt; The problem seems to be adding -isystem $DEFAULTINCLUDEPATH before the
&gt; &gt; others -isystems. Removing that one it builds.
&gt; 
&gt; It's what I suspected, so the question now is: why is it happening? Or
&gt; rather: why ISN'T it happening with /usr/include, when surely many
&gt; pkg-config files put /usr/include in their CFLAGS? Is /usr/include being
&gt; stripped out by pkg-config, or by CMake?
&gt; 
&gt; This might be a tough issue. :(</span >

Seems that CMake ignores some directories on the include_directories list when passing the -I/-isystem arguments to the compiler. /usr/include is one of this directories
That explains why is working on the 99% of the cases, but this is broken when cross-compiling or when using a non default system include path.

The list of directories to remove is defined on the CMakes variables CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES and CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES.

So I understand that if we find a way of getting the default include directory, is a matter of appending it to this variables.

However this feels like we are work-arounding the bugs of others (GCC: i'm looking at you)

More info at <a href="https://public.kitware.com/Bug/view.php?id=8598">https://public.kitware.com/Bug/view.php?id=8598</a> and CMake commits 39f8b91, cb788e8 and 8c3290b</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>