fftw: Link explicitly against -lmpi (#29279)

* fftw: Link explicitly against `-lmpi`

Closes https://github.com/spack/spack/issues/29224.

* Generalize MPI flags

Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>

* Add platform guard

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>
This commit is contained in:
Erik Schnetter 2022-04-21 15:14:21 -04:00 committed by GitHub
parent 616a8eebcd
commit 3a70df9f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,6 +96,14 @@ def setup_build_environment(self, env):
'CXXFLAGS', self.spec['llvm-openmp'].headers.include_flags)
env.append_flags(
'LDFLAGS', self.spec['llvm-openmp'].libs.ld_flags)
# FFTW first configures libtool without MPI, and later uses it with
# MPI. libtool then calls wrong linker to create shared libraries
# (it calls `$CC` instead of `$MPICC`), and MPI symbols
# remain undefined because `-lmpi` is not passed to the linker.
# https://github.com/FFTW/fftw3/issues/274
# https://github.com/spack/spack/issues/29224
if self.spec.satisfies('+mpi') and self.spec.satisfies('platform=darwin'):
env.append_flags('LIBS', self.spec['mpi'].libs.ld_flags)
def configure(self, spec, prefix):
# Base options