LLVM build error

Hello,
I’m using cmake (3.16.5) to build the LLVM environment from source. However, the command

cmake -DLLVM_ENABLE_PROJECTS=“clang;clang-tools-extra;libcxx;libunwind;lldb;compiler-rt;lld” -G “Unix Makefiles” -DCMAKE_BUILD_TYPE=Release …

is returning the error message:

Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test HAVE_CXX_FLAG_WTHREAD_SAFETY failed with the following output:
Change Dir: /home/odyhpc/llvm-8.0.0.src/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_cbe17/fast && /usr/bin/make -f CMakeFiles/cmTC_cbe17.dir/build.make CMakeFiles/cmTC_cbe17.dir/build
make[1]: Entering directory ‘/home/odyhpc/llvm-8.0.0.src/build/CMakeFiles/CMakeTmp’
Building CXX object CMakeFiles/cmTC_cbe17.dir/src.cxx.o
/usr/bin/c++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -std=c++11 -Wall -Wextra -Wshadow -pedantic -pedantic-errors -Wfloat-equal -fstrict-aliasing -fno-exceptions -Wstrict-aliasing -DHAVE_CXX_FLAG_WTHREAD_SAFETY -Wthread-safety -Wthread-safety -o CMakeFiles/cmTC_cbe17.dir/src.cxx.o -c /home/odyhpc/llvm-8.0.0.src/build/CMakeFiles/CMakeTmp/src.cxx
c++: error: unrecognized command line option ‘-Wthread-safety’; did you mean ‘-fthread-jumps’?
c++: error: unrecognized command line option ‘-Wthread-safety’; did you mean ‘-fthread-jumps’?
CMakeFiles/cmTC_cbe17.dir/build.make:65: recipe for target ‘CMakeFiles/cmTC_cbe17.dir/src.cxx.o’ failed
make[1]: *** [CMakeFiles/cmTC_cbe17.dir/src.cxx.o] Error 1
make[1]: Leaving directory ‘/home/odyhpc/llvm-8.0.0.src/build/CMakeFiles/CMakeTmp’
Makefile:121: recipe for target ‘cmTC_cbe17/fast’ failed
make: *** [cmTC_cbe17/fast] Error 2

I don’t understand why of the error or how to fix it. Thank you.

This is more an LLVM problem than a CMake problem. I recommend asking in an LLVM forum. It looks like their flag handling is assuming things about the toolchain rather than testing for flag support.

Hi Ben,
I also posted the question in the LLVM forum. I’m running against a deadline so getting this up and running before the weekend is a priority.
Thanks.