macOS: BootstrapTest fails with open source clang
On the RogueResearch17 Mac10.15-clang-dbg
nightly build, BootstrapTest
fails.
The log file at /Users/builder/external/CMake-clang-dbg/Tests/BootstrapTest/Bootstrap.cmk/cmake_bootstrap.log
shows:
Checking whether '/usr/local/latestclang/bin/clang -Wall -Wextra -Wformat=2 -Wno-format-nonliteral -Wunused -Wpointer-arith -Winvalid-pch -Wcast-align -Wdisabled-optimization -Wnewline-eof -g -ftrivial-auto-var-init=pattern -fstack-protector-all -ftrapv -framework CoreFoundation ' works.
Try: /usr/local/latestclang/bin/clang
Line: /usr/local/latestclang/bin/clang -Wall -Wextra -Wformat=2 -Wno-format-nonliteral -Wunused -Wpointer-arith -Winvalid-pch -Wcast-align -Wdisabled-optimization -Wnewline-eof -g -ftrivial-auto-var-init=pattern -fstack-protector-all -ftrapv -framework CoreFoundation cmake_bootstrap_19993_test.c -o cmake_bootstrap_19993_test
---------- file -----------------------
#ifdef __cplusplus
# error "The CMAKE_C_COMPILER is set to a C++ compiler"
#endif
#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
#error "On AIX with GNU we need the -pthread flag."
#endif
#if defined(__sun) && __STDC_VERSION__ < 199901L
#error "On Solaris we need C99."
#endif
#if defined(__hpux) && !(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 409)
#error "On HP-UX we need GCC 4.9 or higher."
#endif
#include <stdio.h>
int main(int argc, char* argv[])
{
printf("%d%c", (argv != 0), (char)0x0a);
return argc - 1;
}
------------------------------------------
cmake_bootstrap_19993_test.c:18:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
Test failed to compile
Note that this is not using Clang from Xcode, but open source Clang installed from the official binaries from their github project:
builder17:~ builder$ which clang
/usr/local/latestclang/bin/clang
builder17:~ builder$ clang --version
clang version 13.0.0
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /usr/local/latestclang/bin
I suspect this is strongly related to https://bugs.llvm.org/show_bug.cgi?id=45880 The last few comments there are the most relevant.
Basically, they expect/require you to point clang to where headers like stdio.h
are, for example by prepending xcrun
.
There is a patch to reconsider the behaviour though, which you might want to comment on.
Edited by Sean McBride