compiler-rt fails to find <stdarg.h> on FreeBSD

I'm unsure why this is failing this week, but when I build for FreeBSD
HEAD, I now get a failure to find <stdarg.h>. Very strange. Maybe its
missing a -I /usr/include somewhere?

[1950/2811] Building CXX object
projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors.cc.o
FAILED: /usr/bin/CC -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wnon-virtual-dtor -std=c++11
-fcolor-diagnostics -Wall -std=c++11 -g -Iprojects/compiler-rt/lib/tsan
-I/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan -Iinclude
-I/home/sbruno/clang/llvm/include -I/usr/local/include
-I/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan/.. -m64
-fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables
-fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden
-fvisibility-inlines-hidden -fno-function-sections -fno-lto -O3
-gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions
-Wno-non-virtual-dtor -fPIE -fno-rtti -msse3 -Wframe-larger-than=512
-Wglobal-constructors --sysroot=. -MMD -MT
projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors.cc.o
-MF
projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors.cc.o.d
-o
projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors.cc.o
-c
/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
In file included from
/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:2367:
/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:41:10:
fatal error: 'stdarg.h' file not found
#include <stdarg.h>
         ^
1 error generated.
[1950/2811] Building X86GenDAGISel.inc...
ninja: build stopped: subcommand failed.

I'm unsure why this is failing this week, but when I build for
FreeBSD HEAD, I now get a failure to find <stdarg.h>. Very
strange. Maybe its missing a -I /usr/include somewhere?

Yeah, adding a -I /usr/include is definitely allowing this to work.
How do I add that to the build?

sean

[1950/2811] Building CXX object
projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors.cc.o

FAILED: /usr/bin/CC -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS

-D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wnon-virtual-dtor -std=c++11
-fcolor-diagnostics -Wall -std=c++11 -g
-Iprojects/compiler-rt/lib/tsan
-I/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan -Iinclude
-I/home/sbruno/clang/llvm/include -I/usr/local/include
-I/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan/..
-m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer
-funwind-tables -fno-stack-protector -fno-sanitize=safe-stack
-fvisibility=hidden -fvisibility-inlines-hidden
-fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu
-Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor
-fPIE -fno-rtti -msse3 -Wframe-larger-than=512
-Wglobal-constructors --sysroot=. -MMD -MT
projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors.cc.o

- -MF

projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors.cc.o.d

- -o

projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors.cc.o

- -c

/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc

In file included from

/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:2367:

/home/sbruno/clang/llvm/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:41:10:

Clang provides stdarg.h as part of its builtin headers. Maybe that is what compiler-rt is expecting to find and somehow clang is not finding its builtin headers?

– Sean Silva

They clang std*.h headers are incompatible with FreeBSD's builtin ones
so FreeBSD users generally have to remove them (limits.h is also broken
in -ffreestating mode).

-- Brooks