[llvm-dev] how to avoid linking with libLTO?
Jonas Devlieghere via llvm-dev
llvm-dev at lists.llvm.org
Fri Feb 9 07:59:15 PST 2018
Hi Dominique,
> On Feb 6, 2018, at 12:13 PM, Dominique Fober via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hi,
>
> Is there a way to avoid linking with the dynamic LTO library.
> I’m using llvm 5.0.0 on various platforms (linux, windows, macOS), this library is not required by my application and I keep having trouble with it. My project is cmake based and makes use of LLVMConfig.cmake or llvm-config output (depending on the platform - there is no LLVMConfig.cmake with the windows package).
I don’t know about Windows, but with Cmake you should be able to only link against the libs you need, e.g. something like
llvm_map_components_to_libnames(LLVM_LINK_LIBRARIES
support
object)
target_link_libraries(target
${LLVM_LINK_LIBRARIES})
> On windows the LTO lib resolves to LTO-NOTFOUND, which obviously triggers an error at link time.
> On linux and MacOS, everything runs smoothly up to the install step: then I get an "error while loading shared libraries libLTO (.dylib or .so)” when running my application. I’m actually linking with llvm installed within my $HOME hierarchy.
> This library (useless in my case) unnecessarily complicates my life.
> If there's a way not to link with LTO, I'm a taker.
> Thanks in advance for your help.
> —
> Dominique
>
> ps: why is it not available as a static library (that could be a solution too)
It’s a shared object because it’s used by the linker to perform interprocedural optimizations.
https://llvm.org/docs/LinkTimeOptimization.html#liblto
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list