[compiler-rt] [Fuzzer] Enable custom libc++ for Android (PR #70407)

Ryan Prichard via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 00:25:10 PDT 2023


rprichard wrote:

I saw the same `unknown type name 'size_t'` errors when I turned on `COMPILER_RT_USE_LIBCXX` for the Android LLVM team's build of LLVM. The fix was to avoid including two copies of libc++ in the include search path:

https://android-review.googlesource.com/c/toolchain/llvm_android/+/2806864

Previously, the Android LLVM (llvm_build/build.py) sometimes passed `-nostdinc++` as an option for the compiler-rt runtimes, along with `-isystem` pointing at a copy of libc++'s headers. That doesn't work because, when `COMPILER_RT_USE_LIBCXX` is enabled, libFuzzer also adds `-nostdinc++` and `-isystem` pointing at libc++ headers. When both of these are active, there are two copies of libc++'s headers on the search path, which fails, because (from that Gerrit CL):

> The stddef.h in the first libc++ will delegate to the stddef.h in
the second, which will see that `_LIBCPP_STDDEF_H` is already defined,
and then not delegate to the stddef.h in the clang resource directory.
As a result, size_t/ptrdiff_t/etc aren't defined.

I don't see where the sanitizer buildbot is defining `COMPILER_RT_USE_LIBCXX`, but it looks like my attempt to reproduce the issue locally just finished, so I'll take a look.


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


More information about the llvm-commits mailing list