From a31e9dcf4304bb036866fa4d2f4c3a4d99f7ced8 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 24 Aug 2021 13:53:37 +0530 Subject: [PATCH] gst-env: Don't set DYLD_LIBRARY_PATH on macOS This is not actually needed because everything we build is using @rpath already, and setting it causes dynamic linker path priority issues with macOS internals causing *all* programs to fail to run inside gst-env: ``` $ vim dyld: Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib Expected in: /Users/nirbheek/projects/repos/gst-build/_build_macos/subprojects/libjpeg-turbo-2.1.0/libJPEG.dylib in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib Abort trap: 6 ``` In this case it is caused by libjpeg.dylib, but it can happen with other dylibs that conflict with dylibs used by macOS internally. Part-of: --- gst-env.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst-env.py b/gst-env.py index 40d66e3572..df3e402332 100755 --- a/gst-env.py +++ b/gst-env.py @@ -72,6 +72,8 @@ def stringify(o): raise AssertionError('Object {!r} must be a string or a list'.format(o)) def prepend_env_var(env, var, value, sysroot): + if var is None: + return if value.startswith(sysroot): value = value[len(sysroot):] # Try not to exceed maximum length limits for env vars on Windows @@ -275,7 +277,8 @@ def get_subprocess_env(options, gst_version): if os.name == 'nt': lib_path_envvar = 'PATH' elif platform.system() == 'Darwin': - lib_path_envvar = 'DYLD_LIBRARY_PATH' + # RPATH is sufficient on macOS, and DYLD_LIBRARY_PATH can cause issues with dynamic linker path priority + lib_path_envvar = None else: lib_path_envvar = 'LD_LIBRARY_PATH'