[Mlir-commits] [mlir] [mlir] Don't set RPATH for libMLIR (PR #121180)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Dec 26 22:05:02 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Maksim Levental (makslevental)

<details>
<summary>Changes</summary>

By default [`llvm_add_library`](https://github.com/llvm/llvm-project/blob/94837c8b5761d20310947be5d2e1e568f67e8c0c/llvm/cmake/modules/AddLLVM.cmake#L681) calls `llvm_setup_rpath`, which has the strange effect that even libs inside of `install/lib` have non-empty self-referential `RPATH`s; e.g., on Mac


```
$ llvm-install/lib/libMLIR.dylib | grep RPATH -A4
          cmd LC_RPATH
      cmdsize 32
         path @<!-- -->loader_path/../lib (offset 12)
```

which is bad/awkward if you want to move `libMLIR` (like into a wheel...).

Now possibly we want to do this for all shlibs but I think we definitely want to do this for `libMLIR` because it should have no runtime lib deps (at least until [this](https://github.com/llvm/llvm-project/issues/108253) lands).

---
Full diff: https://github.com/llvm/llvm-project/pull/121180.diff


1 Files Affected:

- (modified) mlir/tools/mlir-shlib/CMakeLists.txt (+1) 


``````````diff
diff --git a/mlir/tools/mlir-shlib/CMakeLists.txt b/mlir/tools/mlir-shlib/CMakeLists.txt
index a33c70c5807bea..293409a51f27ef 100644
--- a/mlir/tools/mlir-shlib/CMakeLists.txt
+++ b/mlir/tools/mlir-shlib/CMakeLists.txt
@@ -35,6 +35,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
     MLIR
     SHARED
     EXCLUDE_FROM_LIBMLIR
+    NO_INSTALL_RPATH
     ${INSTALL_WITH_TOOLCHAIN}
     mlir-shlib.cpp
     ${_OBJECTS}

``````````

</details>


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


More information about the Mlir-commits mailing list