Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO_INSTALL_RPATH breaks in-tree builds with shared libs #2906

Open
hvdijk opened this issue Dec 3, 2024 · 2 comments · May be fixed by #2935
Open

NO_INSTALL_RPATH breaks in-tree builds with shared libs #2906

hvdijk opened this issue Dec 3, 2024 · 2 comments · May be fixed by #2935

Comments

@hvdijk
Copy link
Contributor

hvdijk commented Dec 3, 2024

The README states:

LLVM in-tree build

The translator can be built as a regular LLVM subproject. To do that you need to clone it into the llvm/projects or llvm/tools directory.

git clone https://github.com/llvm/llvm-project.git
cd llvm-project/llvm/projects
git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git

Run (or re-run) cmake as usual for LLVM. After that you should have llvm-spirv and check-llvm-spirv targets available.

Running CMake as usual for LLVM, for me, means including -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON.

Following these instructions, and installing LLVM, results in:

harald@noble:~/llvm-project/main/install/aarch64-linux$ bin/llvm-spirv --help
bin/llvm-spirv: error while loading shared libraries: libLLVM.so.20.0git: cannot open shared object file: No such file or directory

This is because of

# llvm_setup_rpath messes with the rpath making llvm-spirv not executable from the build directory
NO_INSTALL_RPATH
setting NO_INSTALL_RPATH. But in this LLVM configuration, setting the rpath is required to make things work, and if I comment out the NO_INSTALL_RPATH, things do work.

Would it be possible to only set NO_INSTALL_RPATH in those cases where it is necessary (I do not know which cases), or if that is not possible, to provide an option so that users can choose whether or not to set the rpath depending on what is best for their situation?

@svenvh
Copy link
Member

svenvh commented Dec 4, 2024

Would it be possible to only set NO_INSTALL_RPATH in those cases where it is necessary (I do not know which cases)

Looking at PR #3, I suspect NO_INSTALL_RPATH was added for supporting out-of-tree builds. Perhaps we should make this conditional on LLVM_SPIRV_BUILD_EXTERNAL then?

@hvdijk
Copy link
Contributor Author

hvdijk commented Dec 16, 2024

Looking at PR #3, I suspect NO_INSTALL_RPATH was added for supporting out-of-tree builds. Perhaps we should make this conditional on LLVM_SPIRV_BUILD_EXTERNAL then?

That would work for me, and it sounds like a trivial change to make. I will try to get a PR up for it, thanks.

hvdijk added a commit to hvdijk/SPIRV-LLVM-Translator that referenced this issue Dec 16, 2024
For in-tree builds with shared libraries, setting the rpath not only
works, but is required.

Fixes KhronosGroup#2906
@hvdijk hvdijk linked a pull request Dec 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants