<div dir="ltr">I am running a builder; <a href="http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-linux">http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-linux</a><div>(Note, it's not i686 but actually x86-64 due to issues atm)</div><div>It is doing;</div><div>- Build stage1-clang with g++-4.8</div><div>- Build stage2-libcxx (and libcxxabi) with stage1-clang</div><div>- Build stage2-clang with just-built in-tree libcxx (and libcxxabi) with stage1-clang</div><div><br></div><div>At the moment, its buildsteps are hacky and hairy.</div><div>I noticed they could be simplified and useful.</div><div><br></div><div>I propose an option like LLVM_ENABLE_INTREE_LIBCXX.</div><div>(Or enhance LLVM_ENABLE_LIBCXX)</div><div><br></div><div>Pros:</div><div>  Clang (and other executables) can be linked to in-tree libc++.so.</div><div><br></div><div>Cons:</div><div>  Let me know.  </div><div><br></div><div>Prerequisites:</div><div>- CMAKE_CXX_COMPILER is capable to build libcxx</div><div>- libcxx (and libcxxabi etc.) is checked out</div><div><br></div><div>What to be tweaked:</div><div>1) Omit testing functionality of C++ in config-ix.cmake.</div><div>  Most of tests wouldn't make sense, since they are about to be built in-tree.</div><div>  I think just to detect compiler id, or check functionality without headers nor libraries.</div><div>2) Use in-tree headers to build all C++ source files.</div><div>  Add -I (BUILD_ROOT)/projects/libcxx/include -I $(LIBCXX_ROOT)/include.</div><div>  Then, -stdlib=libc++ might confuse #include_next.</div><div>  It'd be better to add -stdlib=other_but_libc++.</div><div>3) Link all libraries (not just LLVMSupport) and executables to libc++.</div><div>  It'd be easy simply to specify -L $(BUILD_ROOT)/lib.</div><div>  But I suggest to add libcxx for each library and executable with target_link_libraries(cxx).</div><div>4) Make sure libc++ is built in advance of others.</div><div>  As I mentioned in (3), target_link_libraries(cxx) should do.</div><div>  Surprisingly, object files in libcxx, libcxxabi, and LLVMSupport can be built in parallel! (with ninja)</div><div><br></div><div>Thanks,</div><div>Takumi</div></div>