From b264d2e913ea2291888e71000f8dd192b0f33e2c Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 26 Jun 2023 09:16:09 +0200 Subject: [PATCH] CONFIG: reinstate FOAM_LD_LIBRARY_PATH adjustments (#2801) - the special MacOS dlopen handling (commit f584ec97d097) did not fully solve the problem with SIP clearing. Eg, sourcing the RunFunctions (for runParallel) triggers SIP and clears DYLD_LIBRARY_PATH. With the cleared path it finds the dummy libraries: the dummy Pstream::init() fails. --- bin/foamJob | 7 +++++++ bin/tools/RunFunctions | 7 +++++++ etc/config.csh/unset | 4 ++-- etc/config.sh/unset | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/foamJob b/bin/foamJob index 6221eb67df..75a963e93c 100755 --- a/bin/foamJob +++ b/bin/foamJob @@ -23,6 +23,13 @@ # If dispatching via foamExec foamExec="$WM_PROJECT_DIR/bin/tools/foamExec" +# Darwin workaround - SIP clearing DYLD_LIBRARY_PATH variable +if [ -n "$FOAM_LD_LIBRARY_PATH" ] && [ -z "$DYLD_LIBRARY_PATH" ] +then + export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH" +fi + + #------------------------------------------------------------------------------ usage() { diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions index 68364b7738..f8482f63f2 100644 --- a/bin/tools/RunFunctions +++ b/bin/tools/RunFunctions @@ -25,6 +25,13 @@ # Basic sanity checks [ -d "$FOAM_TUTORIALS" ] || echo "No OpenFOAM tutorials? : $FOAM_TUTORIALS" 1>&2 +# Darwin workaround - SIP clearing DYLD_LIBRARY_PATH variable +if [ -n "$FOAM_LD_LIBRARY_PATH" ] && [ -z "$DYLD_LIBRARY_PATH" ] +then + export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH" +fi + + #------------------------------------------------------------------------------ # diff --git a/etc/config.csh/unset b/etc/config.csh/unset index 2c17414c68..904fc51e9e 100644 --- a/etc/config.csh/unset +++ b/etc/config.csh/unset @@ -189,8 +189,8 @@ if ($?DYLD_LIBRARY_PATH) then if ("${DYLD_LIBRARY_PATH}" == "") unsetenv DYLD_LIBRARY_PATH endif -# Remove any shadow env variables -unsetenv FOAM_DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH +# Remove shadow env variables +unsetenv FOAM_LD_LIBRARY_PATH #------------------------------------------------------------------------------ # Cleanup aliases diff --git a/etc/config.sh/unset b/etc/config.sh/unset index 318291b0d2..a2ff864ec1 100644 --- a/etc/config.sh/unset +++ b/etc/config.sh/unset @@ -173,8 +173,8 @@ fi [ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH [ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH -# Remove any shadow env variables -unset FOAM_DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH +# Remove shadow env variables +unset FOAM_LD_LIBRARY_PATH #------------------------------------------------------------------------------ # Cleanup aliases and functions