CONFIG: fixes for MacOS (#2555)

- introduce a FOAM_LD_LIBRARY_PATH variable to shadow
  DYLD_LIBRARY_PATH on MacOS.

  The DYLD_LIBRARY_PATH and LD_LIBRARY_PATH cannot be modified via sub
  shells etc when SIP is active. This helps circumvent these
  restrictions, which is obviously a hack, but seems to be required.

COMP: disable -ftrapping-math in geompack for MacOS
This commit is contained in:
Alexey Matveichev
2022-08-16 15:50:12 +02:00
committed by Mark Olesen
parent 5218bfd721
commit e827c117e3
14 changed files with 161 additions and 87 deletions

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2021 OpenCFD Ltd. # Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -48,26 +48,29 @@
# - Similarly for c-shell # - Similarly for c-shell
# eval `foamCleanPath -csh-path dir1:dir2` # eval `foamCleanPath -csh-path dir1:dir2`
# #
# For library paths, it is suggested to use -sh-lib, or -csh-lib. # For library paths, it is suggested to use -sh-lib, -env=-lib etc.
# The will use DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH on Darwin. #
# On Darwin it uses FOAM_LD_LIBRARY_PATH instead of LD_LIBRARY_PATH.
# This should actually be DYLD_LIBRARY_PATH on Darwin, but setting that
# or LD_LIBRARY_PATH via a shell-script is disallowed when SIP is active.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
printHelp() { printHelp() {
cat<<USAGE cat<<USAGE
Usage: foamCleanPath [OPTION] ENV [filter] .. [filter] Usage: foamCleanPath [OPTION] ENVNAME [filter] .. [filter]
foamCleanPath [OPTION] -env=name [filter] .. [filter] foamCleanPath [OPTION] -env=name [filter] .. [filter]
options: options:
-env=NAME Evaluate NAME to obtain initial content, -env=NAME Evaluate NAME to obtain initial content,
Accepts "-env=-path", "-env=-lib" shortcuts for PATH Accepts "-env=-path", "-env=-lib" shortcuts for PATH
and LD_LIBRARY_PATH (DYLD_LIBRARY_PATH on Darwin) and LD_LIBRARY_PATH (FOAM_LD_LIBRARY_PATH on Darwin)
-sh=NAME Produce 'NAME=...' output for sh eval -sh=NAME Produce 'NAME=...' output for sh eval
-csh=NAME Produce 'setenv NAME ...' output for csh eval -csh=NAME Produce 'setenv NAME ...' output for csh eval
-sh-env=NAME Same as -sh=NAME -env=NAME -sh-env=NAME Same as -sh=NAME -env=NAME
-csh-env=NAME Same as -csh=NAME -env=NAME -csh-env=NAME Same as -csh=NAME -env=NAME
-sh-path | -csh-path Same as -[c]sh-env=PATH -sh-path | -csh-path Same as -[c]sh-env=PATH
-sh-lib | -csh-lib Same as -[c]sh-env=LD_LIBRARY_PATH -sh-lib | -csh-lib Same as -[c]sh-env=LD_LIBRARY_PATH
or DYLD_LIBRARY_PATH on Darwin (FOAM_LD_LIBRARY_PATH on Darwin)
-debug Print debug information to stderr -debug Print debug information to stderr
-strip Remove inaccessible directories -strip Remove inaccessible directories
-verbose Report some progress (input, output, ...) -verbose Report some progress (input, output, ...)
@ -81,7 +84,7 @@ Prints its argument (which should be a ':' separated list) cleansed from
Exit status Exit status
0 on success 0 on success
1 general error 1 general error
2 initial value of 'path' is empty 2 initial value of ENVNAME is empty
USAGE USAGE
exit 0 # A clean exit exit 0 # A clean exit
@ -103,63 +106,69 @@ die()
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Input and outputs # Input and outputs
unset dirList shellOutput shellFlavour unset dirList shellFlavour shellOutput
unset optDebug optEnvName optStrip optVerbose unset optDebug optEnvName optStrip optVerbose
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
-h | -help*) (-h | -help*)
printHelp printHelp
;; ;;
-env=*) (-csh-lib | -csh-path | -sh-lib | -sh-path)
name="${1#*=}" shellFlavour="$1"
[ -n "$name" ] || die "Option '$1' missing an ENVNAME" case "$1" in
(*-lib)
# Accept aliases name='LD_LIBRARY_PATH'
case "$name" in if [ "$(uname -s 2>/dev/null)" = Darwin ]
(-path) name='PATH';; then
(-lib) name='FOAM_LD_LIBRARY_PATH' # Shadow DYLD_LIBRARY_PATH
case "$(uname -s 2>/dev/null)" in fi
(Darwin) name='DYLD_LIBRARY_PATH';; ;;
(*) name='LD_LIBRARY_PATH';; (*-path)
esac name='PATH'
;; ;;
esac
optEnvName="$name" # Use for input evaluation
;;
-csh-path | -sh-path)
shellFlavour="$1"
name='PATH'
optEnvName="$name" # Use for input evaluation
shellOutput="$name" # Use for output
;;
-csh-lib | -sh-lib)
shellFlavour="$1"
case "$(uname -s 2>/dev/null)" in
(Darwin) name='DYLD_LIBRARY_PATH';;
(*) name='LD_LIBRARY_PATH';;
esac esac
optEnvName="$name" # Use for input evaluation optEnvName="$name" # Use for input evaluation
shellOutput="$name" # Use for output shellOutput="$name" # Use for output
;; ;;
-csh=* | -sh=* | -csh-env=* | -sh-env=*) (-env=*)
name="${1#*=}"
[ -n "$name" ] || die "Option '$1' missing an ENVNAME"
# Handle (-lib | -path) aliases
case "$1" in
(*=-lib)
name='LD_LIBRARY_PATH'
if [ "$(uname -s 2>/dev/null)" = Darwin ]
then
name='FOAM_LD_LIBRARY_PATH' # Shadow DYLD_LIBRARY_PATH
fi
;;
(*=-path)
name='PATH'
;;
esac
optEnvName="$name" # Use for input evaluation
;;
(-csh=* | -csh-env=* | -sh=* | -sh-env=*)
shellFlavour="$1" shellFlavour="$1"
name="${1#*=}" name="${1#*=}"
[ -n "$name" ] || die "Option '$1' missing an ENVNAME" [ -n "$name" ] || die "Option '$1' missing an ENVNAME"
# Accept aliases # Handle (-lib | -path) aliases
case "$name" in case "$1" in
(-path) name='PATH';; (*=-lib)
(-lib) name='LD_LIBRARY_PATH'
case "$(uname -s 2>/dev/null)" in if [ "$(uname -s 2>/dev/null)" = Darwin ]
(Darwin) name='DYLD_LIBRARY_PATH';; then
(*) name='LD_LIBRARY_PATH';; name='FOAM_LD_LIBRARY_PATH' # Shadow DYLD_LIBRARY_PATH
esac fi
;;
(*=-path)
name='PATH'
;; ;;
esac esac
shellOutput="$name" # Use for output shellOutput="$name" # Use for output
@ -167,16 +176,16 @@ do
case "$1" in (*-env=*) optEnvName="$name";; esac case "$1" in (*-env=*) optEnvName="$name";; esac
;; ;;
-debug) (-debug)
optDebug=true optDebug=true
;; ;;
-strip) (-strip)
optStrip=true optStrip=true
;; ;;
-verbose) (-verbose)
optVerbose=true optVerbose=true
;; ;;
*) (*)
break break
;; ;;
esac esac

View File

@ -26,9 +26,9 @@
[ -d "$FOAM_TUTORIALS" ] || echo "No OpenFOAM tutorials? : $FOAM_TUTORIALS" 1>&2 [ -d "$FOAM_TUTORIALS" ] || echo "No OpenFOAM tutorials? : $FOAM_TUTORIALS" 1>&2
# Darwin workaround - SIP clearing DYLD_LIBRARY_PATH variable # Darwin workaround - SIP clearing DYLD_LIBRARY_PATH variable
if [ -n "$FOAM_DYLD_LIBRARY_PATH" ] && [ -z "$DYLD_LIBRARY_PATH" ] if [ -n "$FOAM_LD_LIBRARY_PATH" ] && [ -z "$DYLD_LIBRARY_PATH" ]
then then
export DYLD_LIBRARY_PATH="$FOAM_DYLD_LIBRARY_PATH" export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi fi

View File

@ -49,8 +49,8 @@ then
foamClean="$WM_PROJECT_DIR/bin/foamCleanPath" foamClean="$WM_PROJECT_DIR/bin/foamCleanPath"
if [ -x "$foamClean" ] if [ -x "$foamClean" ]
then then
cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned" cleaned=$($foamClean -env=PATH "$foamOldDirs") && PATH="$cleaned"
cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \ cleaned=$($foamClean -env=LD_LIBRARY_PATH "$foamOldDirs") \
&& LD_LIBRARY_PATH="$cleaned" && LD_LIBRARY_PATH="$cleaned"
fi fi

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2020 OpenCFD Ltd. # Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -49,8 +49,8 @@ then
foamClean="$WM_PROJECT_DIR/bin/foamCleanPath" foamClean="$WM_PROJECT_DIR/bin/foamCleanPath"
if [ -x "$foamClean" ] if [ -x "$foamClean" ]
then then
cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned" cleaned=$($foamClean -env=PATH "$foamOldDirs") && PATH="$cleaned"
cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \ cleaned=$($foamClean -env=LD_LIBRARY_PATH "$foamOldDirs") \
&& LD_LIBRARY_PATH="$cleaned" && LD_LIBRARY_PATH="$cleaned"
fi fi

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2020 OpenCFD Ltd. # Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -46,10 +46,10 @@ alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
# Special treatment for Darwin # Special treatment for Darwin
# - DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH # - DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH
if ("${_foam_uname_s}" == "Darwin") then if ("${_foam_uname_s}" == 'Darwin') then
alias _foamAddLib 'setenv DYLD_LIBRARY_PATH \!*\:${DYLD_LIBRARY_PATH}' alias _foamAddLib 'if (-e \!*) setenv DYLD_LIBRARY_PATH \!*\:${DYLD_LIBRARY_PATH}; if (-e \!*) setenv FOAM_LD_LIBRARY_PATH \!*\:${FOAM_LD_LIBRARY_PATH}'
else else
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}' alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
endif endif
# Prefix to LD_LIBRARY_PATH with additional checking # Prefix to LD_LIBRARY_PATH with additional checking

View File

@ -69,6 +69,13 @@ set archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-path "$ParaView_DIR $archDir/ParaView- $archDir/qt-"` eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-path "$ParaView_DIR $archDir/ParaView- $archDir/qt-"`
eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-lib "$ParaView_DIR $archDir/ParaView- $archDir/qt-"` eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-lib "$ParaView_DIR $archDir/ParaView- $archDir/qt-"`
# Darwin
switch ("$WM_ARCH")
case darwin*:
setenv DYLD_LIBRARY_PATH "${FOAM_LD_LIBRARY_PATH}"
breaksw
endsw
# Evaluate command-line parameters for ParaView # Evaluate command-line parameters for ParaView
while ( $#argv > 0 ) while ( $#argv > 0 )
switch ($argv[1]) switch ($argv[1])
@ -206,10 +213,11 @@ default:
if ( "$pv_libdirs" != "" ) then if ( "$pv_libdirs" != "" ) then
switch ("$WM_ARCH") switch ("$WM_ARCH")
case darwin*: case darwin*:
setenv DYLD_LIBRARY_PATH "${pv_libdirs}:$DYLD_LIBRARY_PATH" setenv FOAM_LD_LIBRARY_PATH "${pv_libdirs}:${FOAM_LD_LIBRARY_PATH}"
setenv DYLD_LIBRARY_PATH "${FOAM_LD_LIBRARY_PATH}"
breaksw breaksw
default: default:
setenv LD_LIBRARY_PATH "${pv_libdirs}:$LD_LIBRARY_PATH" setenv LD_LIBRARY_PATH "${pv_libdirs}:${LD_LIBRARY_PATH}"
breaksw breaksw
endsw endsw
endif endif

View File

@ -148,16 +148,21 @@ endif
# Clean standard environment variables (PATH, MANPATH, [DY]LD_LIBRARY_PATH) # Clean standard environment variables (PATH, MANPATH, [DY]LD_LIBRARY_PATH)
# - avoid local variables shadowing setenv variables # - avoid local variables shadowing setenv variables
unset PATH MANPATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH unset PATH MANPATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
if (! $?MANPATH ) setenv MANPATH if (! $?MANPATH ) setenv MANPATH
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH if ("${_foam_uname_s}" == 'Darwin') then
if ("${_foam_uname_s}" == "Darwin" ) then
if (! $?DYLD_LIBRARY_PATH ) setenv DYLD_LIBRARY_PATH if (! $?DYLD_LIBRARY_PATH ) setenv DYLD_LIBRARY_PATH
if (! $?FOAM_LD_LIBRARY_PATH ) setenv FOAM_LD_LIBRARY_PATH
else
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH
endif endif
_foamClean PATH "$foamOldDirs" _foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs" _foamClean MANPATH "$foamOldDirs"
_foamClean -lib "$foamOldDirs" _foamClean -lib "$foamOldDirs"
if ("${_foam_uname_s}" == 'Darwin') then
setenv DYLD_LIBRARY_PATH "${FOAM_LD_LIBRARY_PATH}"
endif
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -213,6 +218,9 @@ endif
_foamClean PATH _foamClean PATH
_foamClean MANPATH _foamClean MANPATH
_foamClean -lib _foamClean -lib
if ("${_foam_uname_s}" == 'Darwin') then
setenv DYLD_LIBRARY_PATH "${FOAM_LD_LIBRARY_PATH}"
endif
# Add trailing ':' for system manpages # Add trailing ':' for system manpages
if ( $?MANPATH ) then if ( $?MANPATH ) then
@ -224,8 +232,8 @@ if ($?LD_LIBRARY_PATH) then
endif endif
# Darwin # Darwin
if ($?DYLD_LIBRARY_PATH) then if ($?FOAM_LD_LIBRARY_PATH) then
if ("${DYLD_LIBRARY_PATH}" == "") unsetenv DYLD_LIBRARY_PATH if ("${FOAM_LD_LIBRARY_PATH}" == "") unsetenv DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
endif endif

View File

@ -6,7 +6,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd. # Copyright (C) 2016-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -172,8 +172,10 @@ if ( $?foamClean ) then
if ($?LD_LIBRARY_PATH) then if ($?LD_LIBRARY_PATH) then
eval `$foamClean -csh-env=LD_LIBRARY_PATH "$foamOldDirs"` eval `$foamClean -csh-env=LD_LIBRARY_PATH "$foamOldDirs"`
endif endif
if ($?DYLD_LIBRARY_PATH) then # Darwin
eval `$foamClean -csh-env=DYLD_LIBRARY_PATH "$foamOldDirs"` if ($?FOAM_LD_LIBRARY_PATH) then
eval `$foamClean -csh-env=FOAM_LD_LIBRARY_PATH "$foamOldDirs"`
setenv DYLD_LIBRARY_PATH ${FOAM_LD_LIBRARY_PATH}
endif endif
endif endif
@ -188,7 +190,7 @@ if ($?DYLD_LIBRARY_PATH) then
endif endif
# Remove any shadow env variables # Remove any shadow env variables
unsetenv FOAM_DYLD_LIBRARY_PATH unsetenv FOAM_DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Cleanup aliases # Cleanup aliases

View File

@ -6,7 +6,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2021 OpenCFD Ltd. # Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -31,7 +31,7 @@
# _foamEtc : resolve etc files (silent or verbose) # _foamEtc : resolve etc files (silent or verbose)
# _foamAddPath : prepend to PATH # _foamAddPath : prepend to PATH
# _foamAddMan : prepend to MANPATH # _foamAddMan : prepend to MANPATH
# _foamAddLib : prepend to [DY]LD_LIBRARY_PATH # _foamAddLib : prepend to {DY,FOAM_}LD_LIBRARY_PATH
# _foamAddLibAuto: prepend to lib64/lib resolved name # _foamAddLibAuto: prepend to lib64/lib resolved name
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -56,7 +56,7 @@ then
foamVar_name="$1" foamVar_name="$1"
shift shift
eval "$($foamClean -sh-env="$foamVar_name" "$@")" eval "$($foamClean -sh-env="$foamVar_name" "$@")"
unset "foamVar_name" unset foamVar_name
} }
# Echo values to stderr when FOAM_VERBOSE is on, no-op otherwise # Echo values to stderr when FOAM_VERBOSE is on, no-op otherwise
@ -94,14 +94,18 @@ then
_foamAddLib() _foamAddLib()
{ {
case "$1" in (/?*) case "$1" in (/?*)
export DYLD_LIBRARY_PATH="${1}${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}" ;; if [ -e "$1" ]
then
export FOAM_LD_LIBRARY_PATH="${1}${FOAM_LD_LIBRARY_PATH:+:}${FOAM_LD_LIBRARY_PATH}"
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi
esac esac
} }
else else
_foamAddLib() _foamAddLib()
{ {
case "$1" in (/?*) case "$1" in (/?*)
export LD_LIBRARY_PATH="${1}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}" ;; export LD_LIBRARY_PATH="${1}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
esac esac
} }
fi fi

View File

@ -76,6 +76,12 @@ eval \
"$($WM_PROJECT_DIR/bin/foamCleanPath -sh-lib \ "$($WM_PROJECT_DIR/bin/foamCleanPath -sh-lib \
$ParaView_DIR $archDir/ParaView- $archDir/qt-)" $ParaView_DIR $archDir/ParaView- $archDir/qt-)"
# Darwin
case "$WM_ARCH" in
(darwin*)
export DYLD_LIBRARY_PATH="${FOAM_LD_LIBRARY_PATH}" ;;
esac
# Evaluate command-line parameters for ParaView # Evaluate command-line parameters for ParaView
for i for i
do do
@ -186,8 +192,12 @@ case "$ParaView_VERSION" in
then then
case "$WM_ARCH" in case "$WM_ARCH" in
(darwin*) (darwin*)
export DYLD_LIBRARY_PATH="${pv_libdirs}:$DYLD_LIBRARY_PATH" ;; export FOAM_LD_LIBRARY_PATH="${pv_libdirs}:${FOAM_LD_LIBRARY_PATH}"
(*) export LD_LIBRARY_PATH="${pv_libdirs}:$LD_LIBRARY_PATH" ;; export DYLD_LIBRARY_PATH="${FOAM_LD_LIBRARY_PATH}"
;;
(*)
export LD_LIBRARY_PATH="${pv_libdirs}:${LD_LIBRARY_PATH}"
;;
esac esac
fi fi

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2019-2021 OpenCFD Ltd. # Copyright (C) 2019-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -34,6 +34,12 @@ eval \
"$($WM_PROJECT_DIR/bin/foamCleanPath -sh-lib \ "$($WM_PROJECT_DIR/bin/foamCleanPath -sh-lib \
$ParaView_DIR $archDir/ParaView-)" $ParaView_DIR $archDir/ParaView-)"
# Darwin
case "$WM_ARCH" in
(darwin*)
export DYLD_LIBRARY_PATH="${FOAM_LD_LIBRARY_PATH}" ;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
ParaView_DIR="$(command -v paraview 2>/dev/null)" ParaView_DIR="$(command -v paraview 2>/dev/null)"

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2021 OpenCFD Ltd. # Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -178,12 +178,23 @@ else
fi fi
# Clean standard environment variables # Clean standard environment variables (PATH, MANPATH, [DY]LD_LIBRARY_PATH)
export PATH MANPATH
if [ "${_foam_uname_s}" = Darwin ]
then
export DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH
fi
export PATH MANPATH LD_LIBRARY_PATH
_foamClean PATH "$foamOldDirs" _foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs" _foamClean MANPATH "$foamOldDirs"
_foamClean -lib "$foamOldDirs" _foamClean -lib "$foamOldDirs"
if [ "${_foam_uname_s}" = Darwin ]
then
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Base setup (OpenFOAM compilation), MPI and third-party packages # Base setup (OpenFOAM compilation), MPI and third-party packages
@ -237,11 +248,21 @@ fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Remove duplicates from environment paths # Remove duplicates from environment paths
export PATH MANPATH LD_LIBRARY_PATH export PATH MANPATH
if [ "${_foam_uname_s}" = Darwin ]
then
export DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH
fi
_foamClean PATH _foamClean PATH
_foamClean MANPATH _foamClean MANPATH
_foamClean -lib _foamClean -lib
if [ "${_foam_uname_s}" = Darwin ]
then
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi
# Add trailing ':' for system manpages # Add trailing ':' for system manpages
if [ -n "$MANPATH" ] if [ -n "$MANPATH" ]

View File

@ -6,7 +6,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd. # Copyright (C) 2016-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -164,7 +164,9 @@ then
eval "$($foamClean -sh-env=PATH $foamOldDirs)" eval "$($foamClean -sh-env=PATH $foamOldDirs)"
eval "$($foamClean -sh-env=MANPATH $foamOldDirs)" eval "$($foamClean -sh-env=MANPATH $foamOldDirs)"
eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)" eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)"
eval "$($foamClean -sh-env=DYLD_LIBRARY_PATH $foamOldDirs)" # Darwin
eval "$($foamClean -sh-env=FOAM_LD_LIBRARY_PATH $foamOldDirs)"
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi fi
[ -n "$MANPATH" ] || unset MANPATH [ -n "$MANPATH" ] || unset MANPATH
@ -172,7 +174,7 @@ fi
[ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH [ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH
# Remove any shadow env variables # Remove any shadow env variables
unset FOAM_DYLD_LIBRARY_PATH unset FOAM_DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Cleanup aliases and functions # Cleanup aliases and functions

View File

@ -6,6 +6,10 @@
# include <ctime> # include <ctime>
# include <cstring> # include <cstring>
#if defined(__APPLE__) && defined(__clang__)
#pragma clang fp exceptions(ignore)
#endif
using namespace std; using namespace std;
# include "geompack.H" # include "geompack.H"