<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/78721>78721</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc] unable to attempt fullbuild as a runtime library due to system headers
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          SchrodingerZhu
      </td>
    </tr>
</table>

<pre>
    My Vscode configuration for `cmake`:
```json
{
  "cmake.configureSettings": {
    "LLVM_ENABLE_RUNTIMES": [
      "libc",
      "compiler-rt"
    ],
    "LLVM_ENABLE_PROJECTS": [
      "clang",
      "lld"
    ],
    "LLVM_LIBC_FULL_BUILD": true,
    "CMAKE_EXPORT_COMPILE_COMMANDS": true,
    "LLVM_LIBC_INCLUDE_SCUDO": true,
    "LLVM_USE_LINKER": "lld",
    "CLANG_DEFAULT_LINKER": "lld",
    "CLANG_DEFAULT_RTLIB": "compiler-rt",
    "COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC": true,
    "COMPILER_RT_BUILD_GWP_ASAN": false,
    "COMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED": false,
    "CMAKE_CXX_COMPILER_LAUNCHER": "/usr/bin/sccache",
    "CMAKE_C_COMPILER_LAUNCHER": "/usr/bin/sccache"
  },
  "cmake.sourceDirectory": "${workspaceFolder}/llvm",
}
```
I cannot finish the fullbuild as the compiler somehow pulls in the system headers that undermine the libc's headers.
![image](https://github.com/llvm/llvm-project/assets/20108837/ab4c1920-74f0-4b50-b6af-cf3c2329182b)

The compilation command is as the following:
```bash
/home/schrodingerzy/Documents/llvm/llvm-project/build/bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_18_0_0_git -I/home/schrodingerzy/Documents/llvm/llvm-project/libc -isystem /home/schrodingerzy/Documents/llvm/llvm-project/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -std=gnu++17 -fpie -ffreestanding -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -MD -MT libc/src/sched/linux/CMakeFiles/libc.src.sched.linux.sched_rr_get_interval.dir/sched_rr_get_interval.cpp.o -MF libc/src/sched/linux/CMakeFiles/libc.src.sched.linux.sched_rr_get_interval.dir/sched_rr_get_interval.cpp.o.d -o libc/src/sched/linux/CMakeFiles/libc.src.sched.linux.sched_rr_get_interval.dir/sched_rr_get_interval.cpp.o -c /home/schrodingerzy/Documents/llvm/llvm-project/libc/src/sched/linux/sched_rr_get_interval.cpp
```
I can see the `-isystem` option, which does seemingly appear at the correct position. 

Inside the generated header directory:
```
 __llvm-libc-common.h   cmake_install.cmake   dirent.h   features.h   llvm-libc-macros   pthread.h   setjmp.h   stdlib.h    sys         time.h
 arpa                   CMakeFiles            errno.h    fenv.h       llvm-libc-types    sched.h     spawn.h    string.h    termios.h   unistd.h
 assert.h               ctype.h               fcntl.h    inttypes.h   math.h             search.h    stdio.h    strings.h   threads.h   wchar.h
```
It seems that `time.h`, `sched.h` are indeed there, not sure why `signal.h` is not generated.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.ll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