This is an archive of the discontinued LLVM Phabricator instance.

[OPENMP] Adds <install_path>/lib to rpath to avoid need to set LD_LIBRARY_PATH to find plugins.
AbandonedPublic

Authored by gregrodgers on Apr 5 2023, 3:26 PM.

Details

Reviewers
jdoerfert
MaskRay
Summary

Currently, The user of an OpenMP application needs to set LD_LIBRARY_PATH to the directory
that contains the offload plugins. This change adds the rpath for OpenMP applications.

Diff Detail

Event Timeline

gregrodgers created this revision.Apr 5 2023, 3:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 3:26 PM
gregrodgers requested review of this revision.Apr 5 2023, 3:26 PM
Herald added a project: Restricted Project. · View Herald Transcript
ronlieb added a subscriber: ronlieb.Apr 5 2023, 6:13 PM
jhuber6 added a subscriber: jhuber6.Apr 5 2023, 6:13 PM

Using -rpath by default with OpenMP was removed after a long conversation in https://reviews.llvm.org/D143306. The way forward is most likely to have AOMP provide this in a resource file configuration. I think @ronlieb has a working version of that.

Sorry Greg, we can't have this back in trunk. It's now value add for the ROCm toolchain, and some llvm releases had this feature, but no longer.

The consensus in the OpenMP weekly meeting was to require users to hack around with linker flags or environment variables to get a working program. This makes Fedora's packaging scripts happy.

I do not like this but was comprehensively outvoted.

gregrodgers abandoned this revision.Apr 24 2023, 9:33 AM

Its ugly, but to avoid requirement to set LD_LIBRARY_PATH for end-users who may need LD_LIBRARY_PATH for their own application, we will modify the compiler installation with these bash commands where _INSTALL_DIR is the installation directory.

echo "-Wl,-rpath=${_INSTALL_DIR}/lib" > ${_INSTALL_DIR}/bin/rpath.cfg
echo "-L${_INSTALL_DIR}/lib" >> ${_INSTALL_DIR}/bin/rpath.cfg
ln -sf rpath.cfg ${_INSTALL_DIR}/bin/clang++.cfg
ln -sf rpath.cfg ${_INSTALL_DIR}/bin/clang.cfg
ln -sf rpath.cfg ${_INSTALL_DIR}/bin/flang.cfg
ln -sf rpath.cfg ${_INSTALL_DIR}/bin/flang-new.cfg

My apologies to linux distro packaging teams.