[llvm] [offload] Give libLLVMOffloadKernel a working rpath in a shared-library build (PR #218629)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 01:18:38 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-offload
Author: Larry Meadows (lfmeadow)
<details>
<summary>Changes</summary>
libLLVMOffloadKernel links against libLLVMOffload and finds it through an
`$ORIGIN` rpath, which resolves only if the two land in the same directory.
`add_llvm_library` puts the kernel library in LLVM's `lib` while libLLVMOffload
is in `lib/<triple>`, so every test that loads it fails at startup with
libLLVMOffload.so: cannot open shared object file: No such file or directory
Set `LIBRARY_OUTPUT_DIRECTORY` the way `RUNTIME_OUTPUT_DIRECTORY` already is.
## Testing
Based on `main` at 65d6b72e5e12. CMake only, no test changes. With shared
libraries and `LLVM_ENABLE_RUNTIMES=...;openmp;offload`, the kernel library now
lands beside libLLVMOffload and loads.
---
Full diff: https://github.com/llvm/llvm-project/pull/218629.diff
1 Files Affected:
- (modified) offload/languages/kernel/CMakeLists.txt (+1)
``````````diff
diff --git a/offload/languages/kernel/CMakeLists.txt b/offload/languages/kernel/CMakeLists.txt
index ff0bb81c7f017..e2fef39a1b041 100644
--- a/offload/languages/kernel/CMakeLists.txt
+++ b/offload/languages/kernel/CMakeLists.txt
@@ -66,6 +66,7 @@ target_compile_definitions(LLVMOffloadKernel PRIVATE
set_target_properties(LLVMOffloadKernel PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${LLVM_LIBRARY_OUTPUT_INTDIR}/${OFFLOAD_TARGET_SUBDIR}"
+ LIBRARY_OUTPUT_DIRECTORY "${LLVM_LIBRARY_OUTPUT_INTDIR}/${OFFLOAD_TARGET_SUBDIR}"
POSITION_INDEPENDENT_CODE ON
INSTALL_RPATH "$ORIGIN"
BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
``````````
</details>
https://github.com/llvm/llvm-project/pull/218629
More information about the llvm-commits
mailing list