[Lldb-commits] [PATCH] D71800: [CMake] Add $ORIGIN/../../../../lib to rpath if BUILD_SHARED_LIBS AND UNIX
Fangrui Song via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sat Dec 21 15:22:33 PST 2019
MaskRay created this revision.
MaskRay added reviewers: clayborg, JDevlieghere, jingham, labath.
Herald added subscribers: lldb-commits, kristof.beyls, mgorny.
Herald added a project: LLDB.
For -DBUILD_SHARED_LIBS=On builds, lib/liblldb.so depends on lib/*.so .
lib/python2.7/dist-packages/lldb/_lldb.so is a symlink to
lib/liblldb.so, which needs an additional rpath
`$ORIGIN/../../../../lib` to load. This fixes an import error from
lib/python2.7/dist-packages/lldb/__init__.py
from . import _lldb
ImportError: libLLVMAArch64CodeGen.so.10git: cannot open shared object file: No such file or directory
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71800
Files:
lldb/source/API/CMakeLists.txt
Index: lldb/source/API/CMakeLists.txt
===================================================================
--- lldb/source/API/CMakeLists.txt
+++ lldb/source/API/CMakeLists.txt
@@ -111,6 +111,19 @@
${option_install_prefix}
)
+# lib/pythonX.Y/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so .
+# Add an additional rpath \$ORIGIN/../../../../lib so that _lldb.so can be
+# loaded from Python.
+if(LLDB_ENABLE_PYTHON AND BUILD_SHARED_LIBS AND UNIX)
+ if(LLVM_INSTALL_PREFIX AND NOT (LLVM_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX))
+ set(extra_libdir ${LLVM_LIBRARY_DIR})
+ elseif(LLVM_BUILD_LIBRARY_DIR)
+ set(extra_libdir ${LLVM_LIBRARY_DIR})
+ endif()
+ set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" "\$ORIGIN/../../../../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set_target_properties(liblldb PROPERTIES INSTALL_RPATH "${_install_rpath}")
+endif()
+
if (MSVC)
set_source_files_properties(SBReproducer.cpp PROPERTIES COMPILE_FLAGS /bigobj)
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71800.235031.patch
Type: text/x-patch
Size: 998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191221/eed07de1/attachment.bin>
More information about the lldb-commits
mailing list