WIP: modules/gnome: Set PATH environment variables for dependencies - #16140
WIP: modules/gnome: Set PATH environment variables for dependencies#16140lb90 wants to merge 1 commit into
Conversation
… target We set: * LD_LIBRARY_PATH on all UNIX systems (macOS included) * DYLD_LIBRARY_PATH in addition for macOS * PATH on Windows On UNIX systems the rpath also works, but it it's not very reliable outside of controlled systems. Basicaly, users can set arbitrary LD_LIBRARY_PATHs on their systems, which has precedence over rpaths stored in binaries. By setting LD_LIBRARY_PATH we avoid accidentally picking up the wrong library. See mesonbuild#11119 On Windows there's no rpath, so we have to set PATH to make things work. Fixes mesonbuild#12850
|
This is all it takes, but ideally we should make a small modification: rather than setting |
|
/cc @amyspark |
I have definitely seen this happen when building the GStreamer SDK for Linux without a wrapping Docker container, the system Glib takes precedence over the (older) one provided by the SDK. |
| else: | ||
| kwargs['env'].prepend('LD_LIBRARY_PATH', list(libs_paths), ':') | ||
| if machine.is_darwin(): | ||
| kwargs['env'].prepend('DYLD_LIBRARY_PATH', list(libs_paths), ':') |
There was a problem hiding this comment.
| else: | |
| kwargs['env'].prepend('LD_LIBRARY_PATH', list(libs_paths), ':') | |
| if machine.is_darwin(): | |
| kwargs['env'].prepend('DYLD_LIBRARY_PATH', list(libs_paths), ':') | |
| elif machine.is_darwin(): | |
| kwargs['env'].prepend('DYLD_LIBRARY_PATH', list(libs_paths), ':') | |
| else: | |
| kwargs['env'].prepend('LD_LIBRARY_PATH', list(libs_paths), ':') |
?
There was a problem hiding this comment.
Yeah, turns out macOS has both LD_LIBRARY_PATH and DYLD_LIBRARY_PATH, see https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlopen.3.html. However they are not quite equivalent; test https://github.com/mesonbuild/meson/tree/1.12.0/test%20cases/common/284%20test%20args%20and%20depends%20in%20path fails without 287d0e8 🤷
Hey, it's already supported! 😊 https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/1.86.0/giscanner/scannermain.py?ref_type=tags#L177. Added precisely for cross compilation in https://gitlab.gnome.org/GNOME/gobject-introspection/-/commit/48f41930 |
We set:
On UNIX systems the rpath also works, but it it's not very reliable outside of controlled systems. Basically, users can set arbitrary LD_LIBRARY_PATHs on their systems, and that takes precedence over rpaths stored in binaries. By setting LD_LIBRARY_PATH we avoid accidentally picking up wrong libraries. See #11119
On Windows there's no rpath, so we have to set PATH to make things work.
Fixes #12850