<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, 21 Sep 2015 at 13:07 Tim Northover via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">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">On 20 September 2015 at 13:32, Jauhien Piatlicki via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Is there any possibility to build LLVM both as static and shared libraries?<br>
<br>
I suspect not. Doing that simultaneously is a bit of a niche endeavour.<br></blockquote><div><br></div><div>This is possible, but currently the only option is to get the monolithic shared library (libLLVM.so) and individual static archives. Shared+static everything is possible (I think there are options for this in Clang's build?), but would require additional CMake changes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> What I see currently is that our ebuild makes LLVM to build shared libs<br>
> unconditionally. Is there a possibility (if it is impossible to build<br>
> both lib types) to at least give to user control on what kind of libs he<br>
> will have?<br>
<br>
We're trying to kill autotools, so I'll only give the answer from the<br>
CMake perspective (besides which, I have no idea how to get autotools<br>
to do what you want).<br>
<br>
You probably want to look at the "BUILD_SHARED_LIBS" CMake variable,<br>
and I think LLVM_BUILD_LLVM_DYLIB too (that one decides whether a<br>
unified libLLVM.so gets built as opposed to the dozens of smaller<br>
shared libs, I believe). You might also want to look at<br>
LLVM_ENABLE_PIC for the static builds (it defaults to on, but that can<br>
negatively affect .a builds, depending on target).<br></blockquote><div><br></div><div>With BUILD_SHARED_LIBS=OFF (the default), and LLVM_BUILD_LLVM_DYLIB=ON, you'll indeed get static archives and one libLLVM.so. If you want to link executables and shared libraries to libLLVM.so, but also provide the static archives, you can set LLVM_LINK_LLVM_DYLIB=ON.</div><div><br></div><div>Cheers,</div><div>Andrew</div></div></div>