[clang] [Clang] Add 'CLANG_ALLOW_IMPLICIT_RPATH' to enable toolchain use of -rpath (PR #82004)

Jon Chesterfield via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 16 08:46:43 PST 2024


JonChesterfield wrote:

> IMHO I prefer to ask/request users to do the right thing.

One of the drawbacks to asking users to do the "right thing" is that it goes something like:
- you must use global state to tell the compiler where the compiler libraries are
- you should do this using clang configuration files which are like commandline flags only different
- the flag is called rpath, which means runpath, but used to mean rpath, because of this historic context from glibc
- plus you need to work out what the (multiple) openmp libraries are called and where they are
- and some of them are bitcode, found using this different mechanism
- and if you don't get it totally right, things won't work

which means we've chosen "right" to mean "trivially convenient for compiler developers who don't like changing things", which is not likely to be what the user had in mind. They should look at this pile of spurious complexity and conclude they don't want to be an openmp user after all.

We really don't have a good answer to "why can't my compiler find it's own libraries?", since the best we've got is a reference to a build script Fedora deploy for reasons that they don't really go into in their docs, and where I still haven't managed to find the script itself to reverse engineer what exactly it's rejecting.

I'm still happy with a heuristic that amounts to "if the compiler libs are being installed under /usr or /lib, assume the system can find them, and otherwise set rpath on the executable", especially if it's tied to a command line flag or cmake control which lets the user override whichever default we picked for them.

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


More information about the cfe-commits mailing list