From c482490a60cf89d43367f070e521f7d8bc0975eb Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 23 Aug 2016 21:02:55 +0100 Subject: [PATCH] etc/bashrc, etc/config.sh: - "$FOAM_USER_APPBIN" and "$FOAM_USER_LIBBIN" have been added to "foamOldDirs" in "etc/bashrc" and "etc/config.sh/unset" - "$OPAL_PREFIX" is now undefined in the option "SYSTEMOPENMPI" within "etc/config.sh/mpi", but only if the path defined in this variable is cleaned when using "foamCleanPath". - "$OPAL_PREFIX" is now also conditionally undefined in "etc/config.sh/unset" when the path is picked up by "foamCleanPath". Patch contributed by Bruno Santos Resolved bug-report http://bugs.openfoam.org/view.php?id=2210 --- etc/bashrc | 3 ++- etc/config.sh/mpi | 6 ++++++ etc/config.sh/unset | 10 ++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/etc/bashrc b/etc/bashrc index 4df0d6c375..8d6e8fbf23 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -104,7 +104,8 @@ export FOAM_SIGFPE= ################################################################################ # The old dirs to be cleaned from the environment variables -foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR $HOME/$WM_PROJECT/$USER \ +foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \ + $HOME/$WM_PROJECT/$USER $FOAM_USER_APPBIN $FOAM_USER_LIBBIN \ $WM_PROJECT_SITE $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN" # Location of installation diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi index 36b651e0fc..8c679f6568 100644 --- a/etc/config.sh/mpi +++ b/etc/config.sh/mpi @@ -37,6 +37,12 @@ SYSTEMOPENMPI) # Use the system installed openmpi, get library directory via mpicc export FOAM_MPI=openmpi-system + # Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs + if [ -z "$($foamClean "$OPAL_PREFIX" "$foamOldDirs")" ] + then + unset OPAL_PREFIX + fi + libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'` # Bit of a hack: strip off 'lib' and hope this is the path to openmpi diff --git a/etc/config.sh/unset b/etc/config.sh/unset index fa0a65b3fc..75aefc6172 100644 --- a/etc/config.sh/unset +++ b/etc/config.sh/unset @@ -34,7 +34,8 @@ foamClean=$WM_PROJECT_DIR/bin/foamCleanPath [ -f "$foamClean" -a -x "$foamClean" ] || unset foamClean # The old dirs to be cleaned from the environment variables -foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR $HOME/$WM_PROJECT/$USER \ +foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \ + $HOME/$WM_PROJECT/$USER $FOAM_USER_APPBIN $FOAM_USER_LIBBIN \ $WM_PROJECT_SITE $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN $ParaView_DIR" #------------------------------------------------------------------------------ @@ -101,7 +102,12 @@ unset FOAM_UTILITIES unset MPI_ARCH_PATH unset MPI_BUFFER_SIZE -unset OPAL_PREFIX + +# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs +if [ -z "$($foamClean "$OPAL_PREFIX" "$foamOldDirs")" ] +then + unset OPAL_PREFIX +fi #------------------------------------------------------------------------------