LLVM libcxx build failed

Dear LLVM developers:

I am trying to build LLVM 11 & subprojects “clang;libcxx;libcxxabi” with gcc 8.2.0, but it failed with the following error messages:

…/build/libcxxabi/src/cxa_aux_runtime.cpp

In file included from .../build/libcxx/include/stdlib.h:94,
                  from .../build/libcxx/include/cstdlib:86,
                  from .../build/libcxx/include/exception:82,
                  from .../build/libcxx/include/new:85,
                  from .../build/libcxxabi/src/cxa_aux_runtime.cpp:14:
.../8.2.0/include/c++/8.2.0/stdlib.h:38:12: error: 'std::abort' has not been declared
  using std::abort;
             ^~~~~
.../8.2.0/include/c++/8.2.0/stdlib.h:39:12: error: 'std::atexit' has not been declared
  using std::atexit;
             ^~~~~~
.../8.2.0/include/c++/8.2.0/stdlib.h:40:12: error: 'std::exit' has not been declared
.......... a lot more on std::xxxx not declared errors ........

I try it on IBM power8 and X86_64 both produced the similar errors on cxa_aux_runtime.cpp
Any advice to fix the issue? Many thanks in advance!

Happy New Year!
Shelton

Ubuntu 20.10 x86_64

cd llvm-project

rm -rf build
mkdir build
cd build

cmake -G Ninja -DLLVM_ENABLE_PROJECTS=“clang;llvm;libcxx;libcxxabi” -DCMAKE_BUILD_TYPE=“Release” -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_LIBPFM=OFF -DRUN_HAVE_GNU_POSIX_REGEX=0 -DRUN_HAVE_THREAD_SAFETY_ATTRIBUTES=0 -Wno-dev …/llvm &> ~/Documents/cmake.log

In cmake.log

– The C compiler identification is GNU 10.2.0
– The CXX compiler identification is GNU 10.2.0
– The ASM compiler identification is GNU

– Linker detection: GNU ld

– Configuring done
– Generating done
CMake Warning:
Manually-specified variables were not used by the project:

RUN_HAVE_THREAD_SAFETY_ATTRIBUTES

– Build files have been written to: /home/nnelson/Documents/llvm-project/build

ninja -j 31 &> ~/Documents/ninja.log

Tail of ~/Documents/ninja.log

[3394/3395] Linking CXX executable bin/llvm-readobj
[3395/3395] Generating …/…/bin/llvm-readelf

cd bin
./clang --version
clang version 12.0.0 ( 76c0092665867a6defcd328ba0d0d976eb65d991) Target: x86_64-unknown-linux-gnu grep -n cxa_aux_runtime ~/Documents/ninja.log 462:[391/3395] Building CXX object projects/libcxxabi/src/CMakeFiles/cxxabi_static.dir/cxa_aux_runtime.cpp.o 546:[409/3395] Building CXX object projects/libcxxabi/src/CMakeFiles/cxxabi_shared.dir/cxa_aux_runtime.cpp.o sed -n 462,463p ~/Documents/ninja.log [391/3395] Building CXX object projects/libcxxabi/src/CMakeFiles/cxxabi_static.dir/cxa_aux_runtime.cpp.o [392/3395] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/LazyRandomTypeCollection.cpp.o sed -n 546,547p ~/Documents/ninja.log [409/3395] Building CXX object projects/libcxxabi/src/CMakeFiles/cxxabi_shared.dir/cxa_aux_runtime.cpp.o [410/3395] Building CXX object projects/libcxxabi/src/CMakeFiles/cxxabi_static.dir/cxa_thread_atexit.cpp.o The errors did not show on this run. Neil Nelson