From eb084860396cfd2eca865cbf1979672600a75d39 Mon Sep 17 00:00:00 2001 From: Brandon Parsons Date: Thu, 25 Aug 2022 20:17:16 -0500 Subject: [PATCH] [build] Fix MacOS binary rpath generation (#4376) For RPATH on MacOS use '@loader_path' instead of '$ORIGIN' to reference the directory where the executable is located. The latter is the mechanism used on Linux. I think this was exposed due to newer OS X ignoring $DYLD_LIBRARY_PATH for security reasons. --- shared/config.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/config.gradle b/shared/config.gradle index 611c6ffb63..3ee7618fac 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -37,9 +37,11 @@ nativeUtils.platformConfigs.each { if (it.name.contains('windows')) { return } - it.linker.args << '-Wl,-rpath,\'$ORIGIN\'' if (it.name.contains('osx')) { + it.linker.args << '-Wl,-rpath,\'@loader_path\'' it.linker.args << "-headerpad_max_install_names" + } else { + it.linker.args << '-Wl,-rpath,\'$ORIGIN\'' } }