Bug#791676: libmpich-dev: mpicc adds compiler specific flags and fails for older gcc versions

Drew Parsons dparsons at debian.org
Mon Nov 16 09:47:51 GMT 2020


Package: libmpich-dev
Version: 3.4~a2+really3.3.2-2
Followup-For: Bug #791676


Confirming this bug still exists after the gcc-10 transition. Use
MPICH_FC to catch it.

$ MPICH_FC=gfortran-9 mpifort.mpich a.f90 
gfortran-9: error: unrecognized command line option ‘-fallow-invalid-boz’
gfortran-9: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?

These arguments are set in the final_fcflags variable in
/usr/bin/mpifort.mpich:

final_fcflags=" -O2 -fdebug-prefix-map=/build/mpich-Aiaw9P/mpich-3.4~a2+really3.3.2=. -fstack-protector-strong  -fallow-invalid-boz -fallow-argument-mismatch"

"-O2 -fdebug-prefix-map -fstack-protector-strong" likely comes from
dpkg-buildflags (`dpkg-buildflags --get FCFLAGS`) (or FFLAGS)

Not clear where the -fallow-invalid-boz -fallow-argument-mismatch
comes from. 

src/env/mpifort.bash.in has
  final_fcflags="@MPICH_MPIFORT_FCFLAGS@ @WRAPPER_FCFLAGS@"

MPICH_MPIFORT_FCFLAGS is evidently picking up the build-time
value of MPICHLIB_FFLAGS set from dpkg-buildflags in debian/rules

"-fallow-invalid-boz -fallow-argument-mismatch" would be coming via
WRAPPER_FCFLAGS. In the build log at
https://buildd.debian.org/status/fetch.php?pkg=mpich&arch=amd64&ver=3.4%7Ea2%2Breally3.3.2-2&stamp=1596102999&raw=0
-fallow-invalid-boz is being assigned to FFLAGS and FCFLAGS for dh_auto_configure.
But debian/rules has them set empty,
  dh_auto_configure -- $(extra_flags) CPPFLAGS="" CFLAGS="" CXXFLAGS="" FFLAGS="" FCFLAGS="" BASH_SHELL=/bin/bash
This was apparently dealt with in commit 383d97b (in the debian repo)
in 2015.

So something weird is happening here. The flags are explicitly emptied
(FFLAGS="" FCFLAGS="") in debian/rules dh_auto_configure command line.
But for some reasons these flag settings in the dh_auto_configure line
are being rewritten with the offending flags during the build.

This must be the problem: I'm inspecting the debian repo
https://salsa.debian.org/science-team/mpich, which has 3.3.2-2 in the
master branch.

But the current version is 3.4~a2+really3.3.2-2.  Alastair must have
forgotten to push the latest commits. Sure enough, debian/rules for
the current version has
   dh_auto_configure -- $(extra_flags) CPPFLAGS="" CFLAGS="" CXXFLAGS="" FFLAGS="${FFLAGS}" FCFLAGS="${FCFLAGS}" BASH_SHELL=/bin/bash

together with
GF10_FLAGS:=$(if $(filter $(shell readlink /usr/bin/gfortran), gfortran-10), \
                 -fallow-invalid-boz -fallow-argument-mismatch, )

So there's the origin of it. 


In summary "-fallow-invalid-boz -fallow-argument-mismatch" is added to
FFLAGS and FCFLAGS at mpich build time if built with gfortran-10.

But the problem is that FCFLAGS is used not just for the latest binary
build, it also gets added to WRAPPER_FCFLAGS which is inserted into
final_fcflags in the mpifort.mpich script, hence used even if FC is
replaced with an older gfortran.  This is done by the configure
script, l.5015
  WRAPPER_FCFLAGS=$FCFLAGS
cf. https://salsa.debian.org/science-team/mpich/-/blob/master/configure?expanded=true&viewer=simple#L5015


-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.9.0-2-amd64 (SMP w/8 CPU threads)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE=en_AU:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libmpich-dev depends on:
ii  g++                            4:10.2.0-1
ii  gfortran [gfortran-mod-15]     4:10.2.0-1
ii  gfortran-10 [gfortran-mod-15]  10.2.0-17
ii  gfortran-9 [gfortran-mod-15]   9.3.0-18
ii  libmpich12                     3.4~a2+really3.3.2-2
ii  mpich                          3.4~a2+really3.3.2-2

libmpich-dev recommends no packages.

libmpich-dev suggests no packages.

-- no debconf information


More information about the debian-science-maintainers mailing list