[llvm-dev] LLVM static libs

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 20 22:07:00 PDT 2015


On 20 September 2015 at 13:32, Jauhien Piatlicki via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Is there any possibility to build LLVM both as static and shared libraries?

I suspect not. Doing that simultaneously is a bit of a niche endeavour.

> What I see currently is that our ebuild makes LLVM to build shared libs
> unconditionally. Is there a possibility (if it is impossible to build
> both lib types) to at least give to user control on what kind of libs he
> will have?

We're trying to kill autotools, so I'll only give the answer from the
CMake perspective (besides which, I have no idea how to get autotools
to do what you want).

You probably want to look at the "BUILD_SHARED_LIBS" CMake variable,
and I think LLVM_BUILD_LLVM_DYLIB too (that one decides whether a
unified libLLVM.so gets built as opposed to the dozens of smaller
shared libs, I believe). You might also want to look at
LLVM_ENABLE_PIC for the static builds (it defaults to on, but that can
negatively affect .a builds, depending on target).

Cheers.

Tim.


More information about the llvm-dev mailing list