<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">You can use LIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON CMake option to statically link libc++abi into libc++.a. You can also use LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF to disable statically linking libc++abi into libc++.so (i.e. libc++abi will only be merged into libc++.a, not libc++.so).</div><div dir="ltr"><br></div><div dir="ltr">Similarly, you can also use LIBCXXABI_ENABLE_STATIC_UNWINDER=ON and LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY=OFF to the same for libunwind. </div><div dir="ltr"><br></div><div>Alternatively, you could rename libc++.a to libc++_internal.a and then create a linker script named libc++.a with the following content:</div><div><br></div><div>INPUT(libc++_internal.a libc++abi.a)<br></div><div><br></div><div>There's no support to do so in CMake at the moment, but it's something we've already discussed within Fuchsia as it'd be also useful for sanitizer runtimes so I might start a (separate) discussion about adding such support.</div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 30, 2018 at 2:40 PM ardi via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi!<br>
<br>
I sometimes build LLVM with a static libc++.a in MacOS, so that I use<br>
the LLVM libc++ instead of the system-wide one. However, when doing<br>
so, I always get link errors when building LLVM, because the build<br>
system links with libc++.a, but not with libc++abi.a and so there are<br>
quite a few missing symbols that the linker cannot find.<br>
<br>
My workaround (which always seems to work) is to embed libc++abi<br>
inside of libc++ (with libtool, for example), but that's a hack for<br>
being in a hurry. BTW, note that I'm talking about building LLVM<br>
itself, not my programs (when you build your programs it doesn't hurt<br>
to add  -lc++abi to your link line, but when building LLVM, how are<br>
you supposed to do it? I've searched for a cleaner solution to this,<br>
but couldn't find any.<br>
<br>
Isn't there any LLVM build option for simply telling "hey! don't<br>
forget to add -lc++abi whenever you link to libc++" ?<br>
<br>
Thanks!<br>
<br>
ardi<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>