[PATCH] D13841: [CMake] Bug 25059 - CMake libllvm.so.$MAJOR.$MINOR shared object name not compatible with ldconfig

Andrew Wilkins via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 18:23:20 PST 2015


axw added a comment.

In an autoconf build I get:

  libLLVM-3.8.0svn.so -> libLLVM-3.8svn.so
  libLLVM-3.8svn.so
  (SONAME: libLLVM-3.8svn.so)

With this patch, in a CMake build I get:

  libLLVM-3.8.0svn.so
  libLLVM3.8.so -> libLLVM-3.8.0svn.so
  libLLVM.so -> libLLVM3.8.so
  (SONAME: libLLVM-3.8.0svn.so)

I think what you should do is

- change `api_name` to: `set(api_name ${name}-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}${LLVM_VERSION_SUFFIX})`
- set `OUTPUT_NAME` to `${api_name}`
- use `${api_name}` in the `-Wl,--soname` flag
- switch the order of `${api_name}` and `${library_name}` in the first `llvm_install_library_symlink`

Making these changes locally, I get:

  libLLVM-3.8.0svn.so -> libLLVM-3.8svn.so
  libLLVM-3.8svn.so
  libLLVM.so -> libLLVM-3.8svn.so
  (SONAME: libLLVM-3.8svn.so)

which is exactly the same as autoconf, but with the extra libLLVM.so symlink.

Do we still need to set SOVERSION/VERSION in llvm_add_library?


================
Comment at: cmake/modules/AddLLVM.cmake:554
@@ +553,3 @@
+            OUTPUT_NAME ${library_name}
+            LINK_FLAGS -Wl,--soname,${CMAKE_SHARED_LIBRARY_PREFIX}${library_name}${CMAKE_SHARED_LIBRARY_SUFFIX})
+          llvm_install_library_symlink(${api_name} ${library_name} SHARED
----------------
setting LINK_FLAGS needs a separate set_target_properties with APPEND_STRING


http://reviews.llvm.org/D13841





More information about the llvm-commits mailing list