From 3a70df9f64d4d09343beb1ab39c7cf00bafeb9d4 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 21 Apr 2022 15:14:21 -0400 Subject: 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 * Add platform guard Co-authored-by: Axel Huebl Co-authored-by: Dom Heinzeller --- var/spack/repos/builtin/packages/fftw/package.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index 4a99e7ba4f..58ce1a3244 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -96,6 +96,14 @@ class FftwBase(AutotoolsPackage): '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 -- cgit v1.2.3-70-g09d2