We're compiling libc++ with -nodefaultlibs, so we should also pass this
option during the configuration checks to ensure those checks are
consistent with the actual build.
The primary motivation here is to ease cross-compilation against a
non-standard set of C++ libraries. Previously, the configuration checks
would attempt to link against the standard C++ libraries, which would
cause link failures when cross-compiling, even though the actual library
link would go through correctly (because of the use of -nodefaultlibs
and explicitly specifying any needed libraries). This is more correct
even ignoring the motivation, however.
This redoes D23791 but fixes the configuration errors in sanitizer
builds by disabling the sanitizers for the configuration checks.
Test Plan:
- check-libcxx passes on OS X 10.11
- check-libcxx passes on Ubuntu 16.04
- libcxx configures correctly on Ubuntu 16.04 with LLVM_USE_SANITIZER Address, Memory, Thread, and Undefined
Did some additional testing on CentOS 7 against trunk clang:
- check-libcxx passes with -DLLVM_USE_SANITIZER=Address
- check-libcxx passes with -DLLVM_USE_SANITIZER=Memory
- check-libcxx passes with -DLLVM_USE_SANITIZER=MemoryWithOrigins
- check-libcxx passes with -DLLVM_USE_SANITIZER=Thread
- check-libcxx with -DLLVM_USE_SANITIZER=Undefined has 24 unexpected failures both with and without this diff. Seems to be related to LLVM bug 19302, except I don't know why it's passing on the buildbots and failing locally. I can reproduce the failures on Ubuntu 16.04
Can we not use CMAKE_SHARED_LINKER_FLAGS instead of CMAKE_REQUIRED_LIBRARIES? It is slightly misleading.