[Openmp-commits] [openmp] [OpenMP][OMPD] Set plugin RUNPATH to identify LLVM Libs (PR #223691)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Sep 17 07:53:05 PDT 2026


================
@@ -48,7 +48,30 @@ set_target_properties (ompdModule PROPERTIES PREFIX "")
 set_target_properties (ompdModule PROPERTIES LINKER_LANGUAGE CXX)
 set_target_properties (ompdModule PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/python-module/ompd/")
 
+# ompdModule links LLVMSupport or libLLVM. GDB loads it from
+# share/gdb/python/ompd/, not from lib/. Set RUNPATH so the dynamic linker
+# finds those LLVM libs without LD_LIBRARY_PATH. 
+# install(DIRECTORY) copies files as-is and does not rewrite RPATH, so the
+# .so must be installed with install(TARGETS).
+if(UNIX AND NOT APPLE)
+  if(LLVM_LIBRARY_DIR)
+    set_property(TARGET ompdModule APPEND PROPERTY BUILD_RPATH "${LLVM_LIBRARY_DIR}")
+  endif()
+  set(_ompd_mod_install_dir "${CMAKE_INSTALL_PREFIX}/share/gdb/python/ompd")
----------------
jprotze wrote:

```suggestion
  set(_ompd_mod_install_dir "$<TARGET_FILE_DIR:ompdModule>")
```

https://github.com/llvm/llvm-project/pull/223691


More information about the Openmp-commits mailing list