[cfe-dev] Building clang + libc++ + libc++abi

David A. Greene greened at obbligato.org
Tue Jul 7 21:55:21 PDT 2015


[Sorry about the crosspost.  Since this is a clang build question but
the build is invoked from the top-level LLVM directory I'm not sure
where the question should go.]

I've got a clang build against libstdc++ on Linux but I would really
like one built against libc++/libc++abi.  In other words I'd like to
rebuild clang/llvm with clang using libc++ and libc++abi on Linux.

I looked at the instructions on the libc++ page and for Linux it
recommends building with -stdlib=libc++ -lc++abi.

Encouraging!  Now, how do I get those options to a CMake build of
llvm/clang?  There's CMAKE_CXX_FLAGS but I'm not sure how to set it.
Will a simple -DCMAKE_CXX_FLAGS=-stdlib=libc++ suffice?  Will that
properly propagate from the command line without overriding all the
flags set by individual CMakeLists.txt files?  I don't want to, for
example, lose optimization flags on a release build.

And what about linker flags?  What CMake variable controls those?  The
Google tells me nothing.

I'm including lots of other LLVM projects in the build (lld, etc.) and
this is partially being driven by the fact that I have an outdated
libstdc++.  Some project sources won't build and I'm assuming libc++
will provide what I need.  It would be nice to get entirely away from
gcc/libstdc++ because I can't control when those packages are updated on
the machine.  I'd like to be able to completely bootstrap everything,
assuming the old gcc/libstdc++ can at least get a clang/llvm built
(which it can, because I've done it).

Thanks for your help!

                           -David



More information about the cfe-dev mailing list