Skip to content
Snippets Groups Projects
  • Mark OLESEN's avatar
    d0324a97
    ENH: install helpers to assist when installing into system mpi directories · d0324a97
    Mark OLESEN authored
    - the problem noted in issue #1893 is caused by the rpm-mpi-hooks
      (fedora and redhat-8).
    
      For the additional mpi library qualifier (openmpi-x86_64) to be
      added to the requirements, the mpi-specific libraries (eg,
      libPstream.so) need to be installed in the mpi system directory
      (eg, /usr/lib64/openmpi).
    
      However, need to then create symlinks to ensure that the libraries
      are correctly found via our LD_LIBRARY_PATH and we don't get dummy
      libraries.
    d0324a97
    History
    ENH: install helpers to assist when installing into system mpi directories
    Mark OLESEN authored
    - the problem noted in issue #1893 is caused by the rpm-mpi-hooks
      (fedora and redhat-8).
    
      For the additional mpi library qualifier (openmpi-x86_64) to be
      added to the requirements, the mpi-specific libraries (eg,
      libPstream.so) need to be installed in the mpi system directory
      (eg, /usr/lib64/openmpi).
    
      However, need to then create symlinks to ensure that the libraries
      are correctly found via our LD_LIBRARY_PATH and we don't get dummy
      libraries.
update-mpi-links.in 2.10 KiB
#!/bin/sh
FOAM_MPI="@FOAM_MPI@"
FOAM_SYSTEM_MPI_LIBBIN="@FOAM_SYSTEM_MPI_LIBBIN@"
#------------------------------------------------------------------------------
# =========                 |
# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
#  \\    /   O peration     |
#   \\  /    A nd           | www.openfoam.com
#    \\/     M anipulation  |
#------------------------------------------------------------------------------
#     Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
#     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Description
#     Local update of links from system mpi lib/ to local lib/mpi-name
#
# Note
#     Normally located as a trigger within the platforms/ directory
#     Uses hard-code values (eg, generated with autoconfig).
#
#------------------------------------------------------------------------------
cd "${0%/*}" || exit                                # Run from this directory

# Local values
FOAM_LIBBIN="$(pwd -P)/lib"
FOAM_MPI_LIBBIN="$FOAM_LIBBIN/$FOAM_MPI"

#------------------------------------------------------------------------------
echo "Link OpenFOAM ($FOAM_MPI) from system mpi locations"
echo "Target: $FOAM_MPI_LIBBIN"
echo "Source: $FOAM_SYSTEM_MPI_LIBBIN"

if [ -z "$FOAM_MPI" ]
then
    echo "FOAM_MPI not defined - skipping"
    exit 0
fi
if [ -z "$FOAM_SYSTEM_MPI_LIBBIN" ]
then
    echo "FOAM_SYSTEM_MPI_LIBBIN not defined - skipping"
    exit 0
fi
if [ ! -d "$FOAM_SYSTEM_MPI_LIBBIN" ]
then
    echo "No system mpi lib: $FOAM_SYSTEM_MPI_LIBBIN"
    echo "... not updating"
    exit 0
fi
if [ ! -d "$FOAM_LIBBIN" ]
then
    echo "Missing $FOAM_LIBBIN"
    exit 0
fi

#------------------------------------------------------------------------------
mkdir -p "$FOAM_MPI_LIBBIN"

# Create symlinks
(
    cd "$FOAM_MPI_LIBBIN" || exit

    for i in "$FOAM_SYSTEM_MPI_LIBBIN"/*
    do
        if [ -f "$i" ]
        then
            ln -svf "$i" "${i##*/}"
        fi
    done
)

exit 0  # clean exit

#------------------------------------------------------------------------------