[llvm-dev] Building SVN head with CMake - shared libraries?

Andrew Wilkins via llvm-dev
Thu, 14 Jan 2016 03:26:20 -0000

On Thu, 14 Jan 2016 at 11:02 David Jones via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Now that autoconf is going away soon, I figured I'd try building using
> CMake.
>
> I checked out llvm, cfe and lldb from the SVN server, and followed the
> basic build instructions.
>
> cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/tools/llvm/svn_head
> -DLLVM_TARGETS_TO_BUILD="X86;CppBackend"
-DCMAKE_BUILD_TYPE=Release
> -DLLVM_ENABLE_ASSERTIONS=ON ../llvm
>
> Everything worked well, and in the end I got the following shared
> libraries:
>
> /tools/llvm/svn_head/lib/BugpointPasses.so
> /tools/llvm/svn_head/lib/libclang.so
> /tools/llvm/svn_head/lib/libclang.so.3.9
> /tools/llvm/svn_head/lib/liblldb.so
> /tools/llvm/svn_head/lib/liblldb.so.3.9.0
> /tools/llvm/svn_head/lib/libLTO.so
> /tools/llvm/svn_head/lib/LLVMHello.so
>
> However, with an autoconf build, I am used to seeing a libLLVM.so. From a
> 3.7.1 autoconf build:
>
> /tools/llvm/3.7.1dbg/lib/BugpointPasses.so
> /tools/llvm/3.7.1dbg/lib/libclang.so
> /tools/llvm/3.7.1dbg/lib/liblldb.so
> /tools/llvm/3.7.1dbg/lib/libLLVM-3.7.1.so
> /tools/llvm/3.7.1dbg/lib/libLLVM-3.7.so
> /tools/llvm/3.7.1dbg/lib/libLTO.so
> /tools/llvm/3.7.1dbg/lib/LLVMHello.so
>
> I'd like to get libLLVM with the CMake build as well. But if I try
> -DBUILD_SHARED_LIBS=ON, lldb-server fails to link properly and I cannot
> install anything.
>
> Is this a bug in the make scripts for lldb-server?
> How can I get libLLVM.so in addition to liblldb.so?
>

-DBUILD_SHARED_LIBS=ON will give you shared libraries for each component
(libLLVMSupport.so instead of libLLVMSupport.a, etc.)

What you want to set is -DLLVM_BUILD_LLVM_DYLIB=ON. For this to work, you
must *not* set -DBUILD_SHARED_LIBS=ON.

If you also want all the tools (clang, llvm-*, etc.) to link against
libLLVM.so, you'll want to set -DLLVM_LINK_LLVM_DYLIB=ON, otherwise
you'll
have libLLVM.so but the tools will be linked against the static libraries.

HTH,
Andrew

_______________________________________________
> 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/20160114/ce5e0921/attachment.html>