[PATCH] D101926: [amdgpu-arch] Fix rpath to run from build dir

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 5 11:15:03 PDT 2021


JonChesterfield created this revision.
JonChesterfield added reviewers: gregrodgers, pdhaliwal, tianshilei1992, jdoerfert.
Herald added subscribers: kerbowa, t-tye, tpr, dstuttard, yaxunl, mgorny, nhaehnle, jvesely, kzhuravl.
JonChesterfield requested review of this revision.
Herald added subscribers: cfe-commits, wdng.
Herald added a project: clang.

[amdgpu-arch] Fix rpath to run from build dir

Prior to this, amdgpu-arch has RUNPATH set to $ORIGIN/../lib which works
for some installs, but not from the build directory where clang executes
the tool from when running tests.

This cmake option adds the location of the rocr runtime to the RUNPATH
(note, it amends RUNPATH here, despite the cmake option referring to RPATH)
to create a binary that runs from build or install location.

Before:
RUNPATH [$ORIGIN/../lib]
After:
RUNPATH [$ORIGIN/../lib:$HOME/llvm-install/lib]

Credit to Greg for knowing this trick and pointing to examples of it in use
for the aomp build scripts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101926

Files:
  clang/tools/amdgpu-arch/CMakeLists.txt


Index: clang/tools/amdgpu-arch/CMakeLists.txt
===================================================================
--- clang/tools/amdgpu-arch/CMakeLists.txt
+++ clang/tools/amdgpu-arch/CMakeLists.txt
@@ -14,4 +14,6 @@
 
 add_clang_tool(amdgpu-arch AMDGPUArch.cpp)
 
+set_target_properties(amdgpu-arch PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
+
 clang_target_link_libraries(amdgpu-arch PRIVATE hsa-runtime64::hsa-runtime64)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101926.343111.patch
Type: text/x-patch
Size: 425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210505/c46aa883/attachment.bin>


More information about the cfe-commits mailing list