[libc-commits] [libc] [libc] fixup missing include for fullbuild (PR #87266)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Apr 1 10:32:36 PDT 2024


nickdesaulniers wrote:

> But I am at a loss at to why without the include statement, the implementation gave no error in pre-build?

If we look [at the presubmit build](https://buildkite.com/llvm-project/github-pull-requests/builds/51350#018e86ae-0402-4091-b77f-d82e79d87390)'s CI run, the `cmake` invocation was:

```
cmake -S /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-6mhbj-1/llvm-project/github-pull-requests/llvm -B /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-6mhbj-1/llvm-project/github-pull-requests/build -D 'LLVM_ENABLE_PROJECTS=clang;lld;libc' -G Ninja -D CMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_ASSERTIONS=ON -D LLVM_BUILD_EXAMPLES=ON -D COMPILER_RT_BUILD_LIBFUZZER=OFF -D 'LLVM_LIT_ARGS=-v --xunit-xml-output /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-6mhbj-1/llvm-project/github-pull-requests/build/test-results.xml --timeout=1200 --time-tests' -D LLVM_ENABLE_LLD=ON -D CMAKE_CXX_FLAGS=-gmlt -D BOLT_CLANG_EXE=/usr/bin/clang -D LLVM_CCACHE_BUILD=ON -D MLIR_ENABLE_BINDINGS_PYTHON=ON
```

The lack of `-DLLVM_LIBC_FULL_BUILD=ON` shows that we're only testing [overlay mode](https://libc.llvm.org/overlay_mode.html) in presubmit, and not [fullbuild mode](https://libc.llvm.org/fullbuild_mode.html).

What I suspect was happening is that you're testing locally with overlay mode, and thus `#include <stdio.h>` ends up including glibc's `stdio.h` which likely must have a transitive dependency on `unistd.h` (or some other header that defines `off_t`).  For fullbuild mode `<stdio.h>` will be our generated `stdio.h`, which does not have such transitive includes.

We can always move more things from post submit to presubmit, and to improve source level compatibility for users, we may end up setting up similar transitive includes.  In fact, looking at `man off_t`, it looks like this type should be provided by quite a few different headers...

https://github.com/llvm/llvm-project/pull/87266


More information about the libc-commits mailing list