[cfe-dev] libc++ fails to link

Shoaib Meenai via cfe-dev cfe-dev at lists.llvm.org
Fri Apr 27 10:18:57 PDT 2018

The easiest way to fix this would be to also check out libc++abi. An alternative would be to configure libc++ to use an alternative ABI library (either -DLIBCXX_CXX_ABI=libstdc++ or -DLIBCXX_CXX_ABI=libsupc++ ought to work), but I think libc++abi is the simplest route to go.

From: cfe-dev <cfe-dev-bounces at lists.llvm.org> on behalf of cfe-dev <cfe-dev at lists.llvm.org>
Reply-To: Csaba Raduly <rcsaba at gmail.com>
Date: Friday, April 27, 2018 at 7:09 AM
To: cfe-dev <cfe-dev at lists.llvm.org>
Subject: [cfe-dev] libc++ fails to link

Hi all,

I have LLVM + clang + clang extra tools + compiler-rt + libc++ checked
out as suggested by https://urldefense.proofpoint.com/v2/url?u=https-3A__clang.llvm.org_get-5Fstarted.html&d=DwIBaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=h1o5qmlDkLVbiL5yi4QdDFvsAnb-Mcm-C6ZFQyqk-1o&s=IddzUvTcPKuDha4YLYwQ3NXE1tC-3h0oBw1mcNstI5E&e=

After configuring with

cmake -G Ninja \
                -DCMAKE_BUILD_TYPE=Release \
                -DCMAKE_C_COMPILER=gcc \
                -DCMAKE_CXX_COMPILER=g++ \
                -DLLVM_INCLUDE_GO_TESTS=OFF \
                -DLLVM_TARGETS_TO_BUILD=X86 \

and running "ninja all check-all" , I get a bunch of errors like:

projects/libcxx/lib/CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In
function `std::__1::(anonymous
std::__1::char_traits<char>, std::__1::allocator<char> > const&)':
undefined reference to `__cxa_allocate_exception'
undefined reference to `__cxa_throw'
undefined reference to `__cxa_free_exception'
projects/libcxx/lib/CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In
function `std::__1::ctype_byname<wchar_t>::do_widen(char) const':
undefined reference to `__cxa_call_unexpected'

(see the attachment)

This used to work 2-3 months ago ; the build would finish with the
unittests (of which five used to fail ; one got fixed since then).

Platform: Ubuntu 17.10
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3.2)

You can get very substantial performance improvements by not doing the
right thing.
   - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformat way
to get the wrong information: this is what you want. - Scott Meyers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180427/a10316f8/attachment.html>

More information about the cfe-dev mailing list