GNOME Bugzilla – Bug 784954
Private library pkg-config files should set RPATH
Last modified: 2021-07-05 13:46:03 UTC
Mutter distributes forked clutter and cogl libraries, but they're installed to a non-standard ${libdir}/mutter directory. Because of this, consumers of mutter (e.g., gnome-shell) need to know to set an RPATH to this directory or the libraries won't be found at runtime. Mutter should handle this in it's .pc files so that consumers don't need to know to do that.
Created attachment 355603 [details] [review] Pass RPATH info in private library pkg-config files The private mutter libraries (e.g., libmutter-clutter) are installed to a non-standard path but expected to be used as public API. Because of this, consumers of mutter (e.g., gnome-shell) need to know to set an RPATH to this directory or the libraries won't be found at runtime. Pass the -R${libdir} option in the Libs settings in the pkg-config files for the private libraries. This allows consumers to get the needed RPATH info without special casing mutter. Using -R is more portable than the binutils ld's -rpath option.
BTW, I tested this with a gnome-shell build. It was able to build correctly even after I removed all the special rpath handling it does for mutter.
(In reply to Dan Nicholson from comment #1) > Using -R is more portable than the binutils ld's -rpath option. -R isn't a linker flag, is it? So I suspect that this will break when not using libtool. (In reply to Dan Nicholson from comment #2) > BTW, I tested this with a gnome-shell build. It was able to build correctly > even after I removed all the special rpath handling it does for mutter. It would be good to test with wip/fmuellner/meson as well.
It is a linker flag. From ld(1): For compatibility with other ELF linkers, if the -R option is followed by a directory name, rather than a file name, it is treated as the -rpath option. However, if you pass it straight to gcc, it doesn't like it. So, I guess you do need a -Wl prefixed option there. I can just change it to -Wl,-rpath even though that's not really portable. I guess the most correct thing would be to figure it out in configure and then substitute it. I don't know. BTW, why does mutter install the libraries to a private directory when all the libraries are namespaced with mutter prefixes and there's a public pkg-config file? > It would be good to test with wip/fmuellner/meson as well. OK. I'll try when I get a chance.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/mutter/-/issues/ Thank you for your understanding and your help.