bootstrapping llvm with advanced configuration

I can build llvm and associated tools in a 1 shot go using gcc and g++ but trying to use only gcc and bootstrap clang to build and link with libc++ and libc++abi

on the second phase of the build, the compilation fails

I have svn cloned

LLVM
CLANG
CLANG_XTRA_TOOLS
LLD
LLDB
POLLY
COMPILER_RT
OPENMP
LIBCXX
LIBCXXABI

cmake command below

cmake -DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ASSERTIONS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local -GNinja
-DCLANG_ENABLE_BOOTSTRAP=ON …/toolchain70/llvm/

after that cmake command I run ninja stage2 which compiles about 3700 objects then it proceeds to try and compile the full 5000 plus objects but fails with errors like these:

_toolchain70/llvm/projects/libcxx/include/cstdlib:114:9: error: no member named ‘strtold’ in the global namespace
using ::strtold;
~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

I’d like to bootstrap clang and build libc++ and libc++abi, then use the compiled clang to build clang++ and link against libc++ instead of libstdc++

I’ve read: https://llvm.org/docs/AdvancedBuilds.html
but maybe I’m missing something.

I’m slightly confused. Are you saying you’re trying to build clang using gcc and not g++ to bootstrap? If so, that isn’t going to work. We don’t support bootstrapping clang with only a C compiler. You need a full C++ compiler and C++11 runtime.

It also looks like you’re putting libc++ in llvm/projects. Try putting libc++, libc++abi, compiler-rt, and openmp under llvm/runtimes.

-Chris

Chris Bieneman via llvm-dev <llvm-dev@lists.llvm.org> writes:

It also looks like you're putting libc++ in llvm/projects. Try putting
libc++, libc++abi, compiler-rt, and openmp under llvm/runtimes.

I wasn't aware of this capability. How will it work in the new monorepo
scheme?

                                 -David

If you exclude the runtimes from `LLVM_ENABLE_PROJECTS` and instead specify `LLVM_ENABLE_RUNTIMES=all`, the mono-repo will do the right thing.

-Chris