[cfe-dev] [PROPOSAL] Add an option to build Clang with in-tree libcxx

NAKAMURA Takumi via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 6 06:28:25 PDT 2017


I am running a builder;
http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-linux
(Note, it's not i686 but actually x86-64 due to issues atm)
It is doing;
- Build stage1-clang with g++-4.8
- Build stage2-libcxx (and libcxxabi) with stage1-clang
- Build stage2-clang with just-built in-tree libcxx (and libcxxabi) with
stage1-clang

At the moment, its buildsteps are hacky and hairy.
I noticed they could be simplified and useful.

I propose an option like LLVM_ENABLE_INTREE_LIBCXX.
(Or enhance LLVM_ENABLE_LIBCXX)

Pros:
  Clang (and other executables) can be linked to in-tree libc++.so.

Cons:
  Let me know.

Prerequisites:
- CMAKE_CXX_COMPILER is capable to build libcxx
- libcxx (and libcxxabi etc.) is checked out

What to be tweaked:
1) Omit testing functionality of C++ in config-ix.cmake.
  Most of tests wouldn't make sense, since they are about to be built
in-tree.
  I think just to detect compiler id, or check functionality without
headers nor libraries.
2) Use in-tree headers to build all C++ source files.
  Add -I (BUILD_ROOT)/projects/libcxx/include -I $(LIBCXX_ROOT)/include.
  Then, -stdlib=libc++ might confuse #include_next.
  It'd be better to add -stdlib=other_but_libc++.
3) Link all libraries (not just LLVMSupport) and executables to libc++.
  It'd be easy simply to specify -L $(BUILD_ROOT)/lib.
  But I suggest to add libcxx for each library and executable with
target_link_libraries(cxx).
4) Make sure libc++ is built in advance of others.
  As I mentioned in (3), target_link_libraries(cxx) should do.
  Surprisingly, object files in libcxx, libcxxabi, and LLVMSupport can be
built in parallel! (with ninja)

Thanks,
Takumi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170706/fee84519/attachment.html>


More information about the cfe-dev mailing list