Attached debdiff for mpich 5.0.1-9ubuntu1 on stonking.

Fixes the root cause flag leakage:
- Exports MPICHLIB_LDFLAGS and passes LDFLAGS="" FFLAGS="$(GF_FLAGS)" 
FCFLAGS="$(GF_FLAGS)" to dh_auto_configure.
- Drops @LDFLAGS@ from WRAPPER_LIBS in MPL localdefs.in to keep mpich.pc clean.

Verified in a clean stonking container: all compiler wrappers (mpicxx,
mpicc, mpifort) and mpich.pc are clean of distribution LTO and metadata
flags. madness compiles cleanly against the rebuilt mpich.

Forwarded to Debian BTS: https://bugs.debian.org/1150548

** Description changed:

- madness fails to build from source in Ubuntu 26.10 (stonking) due to
- space-delimited MPI compile flags passed into target_compile_options as
- a single argument:
+ This bug tracks FTBFS of madness and compiler flag leakage from mpich in
+ Ubuntu 26.10 (stonking).
  
- cc1plus: error: unrecognized argument to '-flto=' option: 'auto -ffat-
- lto-objects'
+ [ mpich: Root Cause Fix ]
+ mpich leaks distribution build flags into compiler wrappers and pkg-config:
+ 1. debian/rules exports MPICHLIB_*FLAGS for library build, but does not 
isolate LDFLAGS:
+    - MPICHLIB_LDFLAGS is not exported.
+    - LDFLAGS is not cleared in dh_auto_configure, causing 
WRAPPER_LDFLAGS=$LDFLAGS.
+    - FFLAGS="$(FFLAGS)" passes optimization and LTO flags into 
WRAPPER_FFLAGS/WRAPPER_FCFLAGS.
+ 2. MPL localdefs.in unconditionally appends @LDFLAGS@ to WRAPPER_LIBS, 
leaking Ubuntu flags (-flto=auto, -Wl,--package-metadata=...) into mpich.pc 
(Libs:).
  
- Root cause:
- MPI_COMPILE_FLAGS returned by CMake FindMPI contains multiple compiler 
options (such as '-flto=auto -ffat-lto-objects' from mpich wrappers). In 
src/madness/CMakeLists.txt, target_compile_options(madness PUBLIC 
"${MPI_COMPILE_FLAGS}") passes the variable with quotes and without 
separate_arguments(), causing CMake to pass the entire string as a single 
command-line option to g++.
+ Fix for mpich:
+ - Export MPICHLIB_LDFLAGS and pass LDFLAGS="" FFLAGS="$(GF_FLAGS)" 
FCFLAGS="$(GF_FLAGS)" to dh_auto_configure.
+ - Add debian/patches/mpl-isolate-ldflags.patch to remove @LDFLAGS@ from 
WRAPPER_LIBS in MPL localdefs.in.
+ - Debian BTS: https://bugs.debian.org/1150548
  
- Fix:
- 1. Run separate_arguments(MPI_COMPILE_FLAGS) in external/mpi.cmake to split 
the flags into a CMake list.
- 2. Drop quotes in target_compile_options(madness PUBLIC ${MPI_COMPILE_FLAGS}) 
in src/madness/CMakeLists.txt.
- 3. Clean config/config.guess and config/config.sub via debian/clean to ensure 
clean source build.
+ [ madness: Consumer Fix ]
+ madness CMakeLists.txt passes "${MPI_COMPILE_FLAGS}" as a quoted string to 
target_compile_options(madness PUBLIC ...). When multiple flags are returned by 
FindMPI, g++ rejects the space-separated string as a single invalid argument:
+ cc1plus: error: unrecognized argument to '-flto=' option: 'auto 
-ffat-lto-objects'
  
- Debian BTS:
- https://bugs.debian.org/1150537
- 
- Verification:
- Built madness successfully on Ubuntu 26.10 amd64. All static libraries and 
test executables compiled and linked cleanly.
- 
+ Fix for madness:
+ - Split MPI_COMPILE_FLAGS using separate_arguments() in external/mpi.cmake.
+ - Drop quotes in target_compile_options() in src/madness/CMakeLists.txt.
+ - Clean config.guess/config.sub via debian/clean.
+ - Debian BTS: https://bugs.debian.org/1150537
  
  --- [ Original Report ]
  
- 
- madness 0.10.1+git20200818.eee5fd9f-4 has been stuck in stonking-proposed for 
~346 days. update_excuses reports:
+ madness 0.10.1+git20200818.eee5fd9f-4 has been stuck in stonking-
+ proposed for ~346 days. update_excuses reports:
  
    missing build on amd64/amd64v3/arm64/ppc64el/s390x: libmadness-dev
  (from 0.10.1+git20200818.eee5fd9f-3)
  
  Build log (amd64):
  
https://launchpad.net/ubuntu/+source/madness/0.10.1+git20200818.eee5fd9f-4/+build/32793501
  
  Failure (7 times, in src/madness/{world,tensor,mra,misc}):
  
    cc1plus: error: unrecognized argument to '-flto=' option: 'auto -ffat-
  lto-objects'
  
  The failing compile lines contain the LTO flags as ONE quoted argument:
  
    /usr/bin/x86_64-linux-gnu-g++ ... -std=c++17 -fPIC "-flto=auto -ffat-
  lto-objects" -MD ...
  
  so g++ sees "-flto=" with the value "auto -ffat-lto-objects". Only the
  MPI-using targets are affected (the bundled gtest/muParser/tinyxml
  targets build fine), and the build used cmake 4.3.4-1ubuntu1, gcc-15
  15.3.0-4ubuntu1.
  
  Cause (analysis, to be confirmed):
  The flag does not come from madness itself: debian/rules doesn't set any LTO 
option and madness' CMake files don't add -flto. It comes from MPICH. madness 
Build-Depends on libmpich-dev and uses CMake's FindMPI, which interrogates the 
mpicxx wrapper and turns what it finds into MPI_CXX_COMPILE_OPTIONS / the 
MPI::MPI_CXX interface target.
  
  In stonking, mpich 5.0.1-9 (synced from Debian) bakes the LDFLAGS it was
  built with into its wrappers and pkg-config file. On Ubuntu those
  LDFLAGS contain our default LTO flags:
  
    /usr/bin/mpicxx.mpich:
      final_ldflags=" -Wl,-Bsymbolic-functions -Wl,--package-metadata=... 
-flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now ..."
    /usr/lib/x86_64-linux-gnu/mpich/lib/pkgconfig/mpich.pc:
      Libs: ... -flto=auto -ffat-lto-objects ...
      fflags= / fcflags= ... -flto=auto -ffat-lto-objects ...
  
  FindMPI then ends up passing "-flto=auto -ffat-lto-objects" as a single
  compile option. Debian doesn't enable LTO by default, so its mpich
  wrappers are clean and madness builds there (Debian testing has the -4
  binaries). That makes this Ubuntu-specific.
  
  (mpich's debian/rules explicitly clears CPPFLAGS/CFLAGS/CXXFLAGS for
  configure, using MPICHLIB_*FLAGS for the library build instead, but does
  not do the same for LDFLAGS, which is presumably how the LTO flags leak
  into the wrappers.)
  
  Debian / upstream status:
  - No open Debian bug against madness (or found against mpich) for this; it is 
Ubuntu-only because of LTO.
  - madness upstream is a 2020 git snapshot; nothing to pick up there for this.
  
  Suggested direction (to be done by whoever picks this up):
  1. Reproduce: build madness -4 in a stonking chroot/container and confirm the 
quoted flag comes from MPI::MPI_CXX (e.g. check MPI_CXX_COMPILE_OPTIONS in 
CMakeCache.txt, and "mpicxx.mpich -show").
  2. Quick unblock for madness: add an Ubuntu delta to debian/rules
       export DEB_BUILD_MAINT_OPTIONS = optimize=-lto
     This might not be enough on its own, since the flags come from mpicxx, not 
from madness' own build flags; if so, sanitise MPI_CXX_COMPILE_OPTIONS (e.g. 
pass -DMPI_CXX_COMPILE_OPTIONS= / -DMPI_CXX_SKIP_MPICXX..., or override at 
configure time).
  3. Proper fix: mpich should not leak the build's LDFLAGS (LTO, 
-Wl,--package-metadata, -Bsymbolic-functions, ...) into mpicc/mpicxx/mpifort 
and mpich.pc, e.g. by building with MPICHLIB_LDFLAGS and an empty LDFLAGS for 
configure, like it already does for CFLAGS. That would be an Ubuntu delta for 
mpich (or a Debian bug, since the package-metadata/relro flags leak there too) 
and would also protect other CMake+MPICH reverse build-dependencies. Check 
whether other mpich users in proposed fail the same way before deciding.
  4. Then upload/retry madness and check the autopkgtests.

** Changed in: mpich (Ubuntu)
       Status: New => Confirmed

** Bug watch added: Debian Bug tracker #1150548
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1150548

** Changed in: mpich (Debian)
 Remote watch: None => Debian Bug tracker #1150548

** Patch added: "mpich 5.0.1-9ubuntu1 debdiff for stonking"
   
https://bugs.launchpad.net/bugs/2170321/+attachment/6007965/+files/mpich_5.0.1-9ubuntu1_stonking.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2170321

Title:
  madness FTBFS in stonking: '-flto=auto -ffat-lto-objects' passed as
  one argument (LTO flags leaked by mpich wrappers)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/madness/+bug/2170321/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to