Hi, the first question is addressed both to llvm-dev and gentoo-dev. The second one is Gentoo specific. Is there any possibility to build LLVM both as static and shared libraries? 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? -- Jauhien Piatlicki -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150920/9723b91d/attachment.sig>
Dnia 2015-09-20, o godz. 22:32:54 Jauhien Piatlicki <jauhien at gentoo.org> napisał(a):> Hi, > > the first question is addressed both to llvm-dev and gentoo-dev. The > second one is Gentoo specific. > > Is there any possibility to build LLVM both as static and shared libraries? > > 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?No, static libraries are security flaw and waste of time. The old Makefile-based build system used to build all LLVM libraries as static, then link it all into one big .so which required special handling. These days we use CMake which supports building only one type of libraries. Of course, some upstreams hack CMake to create duplicate library entries for this. But we're certainly not going to do that for the common Gentoo sake of 'choice' to shot yourself in the foot. -- Best regards, Michał Górny <http://dev.gentoo.org/~mgorny/> -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 949 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150921/fe3ad07a/attachment.sig>
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.
On Mon, 21 Sep 2015 at 13:07 Tim Northover via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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. >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.> > 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). >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. Cheers, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150921/d1b2fe76/attachment.html>