[llvm-dev] How to build LLVM linked to libc++abi? (original) (raw)
Petr Hosek via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 30 22:42:23 PDT 2018
- Previous message: [llvm-dev] How to build LLVM linked to libc++abi?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
See https://reviews.llvm.org/D8017 for reason why this is not supported. I have a change https://reviews.llvm.org/D44671 that removes this restriction, but I haven't yet convinced libc++ maintainers to get an approval to merge this change.
On Sun, Sep 30, 2018 at 10:24 PM ardi <ardillasdelmonte at gmail.com> wrote:
Thanks a lot, but tried it and I get this:
CMake Error at projects/libcxx/CMakeLists.txt:361 (message): LIBCXXENABLESTATICABILIBRARY is not supported on OS X Why is it not supported? If I manually embed libc++abi.a inside libc++.a it seems to work. Thanks! ardi On Mon, Oct 1, 2018 at 4:20 AM Petr Hosek <phosek at chromium.org> wrote: > > You can use LIBCXXENABLESTATICABILIBRARY=ON CMake option to statically link libc++abi into libc++.a. You can also use LIBCXXSTATICALLYLINKABIINSHAREDLIBRARY=OFF to disable statically linking libc++abi into libc++.so (i.e. libc++abi will only be merged into libc++.a, not libc++.so). > > Similarly, you can also use LIBCXXABIENABLESTATICUNWINDER=ON and LIBCXXABISTATICALLYLINKUNWINDERINSHAREDLIBRARY=OFF to the same for libunwind. > > Alternatively, you could rename libc++.a to libc++internal.a and then create a linker script named libc++.a with the following content: > > INPUT(libc++internal.a libc++abi.a) > > 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. > > On Sun, Sep 30, 2018 at 2:40 PM ardi via llvm-dev <_ _llvm-dev at lists.llvm.org> wrote: >> >> Hi! >> >> I sometimes build LLVM with a static libc++.a in MacOS, so that I use >> the LLVM libc++ instead of the system-wide one. However, when doing >> so, I always get link errors when building LLVM, because the build >> system links with libc++.a, but not with libc++abi.a and so there are >> quite a few missing symbols that the linker cannot find. >> >> My workaround (which always seems to work) is to embed libc++abi >> inside of libc++ (with libtool, for example), but that's a hack for >> being in a hurry. BTW, note that I'm talking about building LLVM >> itself, not my programs (when you build your programs it doesn't hurt >> to add -lc++abi to your link line, but when building LLVM, how are >> you supposed to do it? I've searched for a cleaner solution to this, >> but couldn't find any. >> >> Isn't there any LLVM build option for simply telling "hey! don't >> forget to add -lc++abi whenever you link to libc++" ? >> >> Thanks! >> >> ardi _>> ________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180930/df158588/attachment.html>
- Previous message: [llvm-dev] How to build LLVM linked to libc++abi?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]