** Description changed:

  This bug tracks FTBFS of madness and compiler flag leakage from mpich in
- Ubuntu 26.10 (stonking).
+ tenacious.
  
- [ 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:).
- 
- Fix for mpich:
- - Export MPICHLIB_LDFLAGS and pass LDFLAGS="" FFLAGS="$(GF_FLAGS)" 
FCFLAGS="$(GF_FLAGS)" to dh_auto_configure.
+ mpich fix (5.0.2-2ubuntu1):
+ - Export MPICHLIB_LDFLAGS and pass LDFLAGS="" FFLAGS="$(GF_FLAGS)" 
FCFLAGS="$(GF_FLAGS)" to dh_auto_configure in debian/rules.
  - Add debian/patches/mpl-isolate-ldflags.patch to remove @LDFLAGS@ from 
WRAPPER_LIBS in MPL localdefs.in.
  - Debian BTS: https://bugs.debian.org/1150548
+ - PPA builds (amd64, arm64, ppc64el):
+   https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33919264
+   https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33919265
+   https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33919266
  
- [ 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'
- 
- 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.
+ madness fix (0.10.1+git20200818.eee5fd9f-4ubuntu1):
+ - Split MPI_COMPILE_FLAGS using separate_arguments() in external/mpi.cmake 
and unquote it in src/madness/CMakeLists.txt.
  - Debian BTS: https://bugs.debian.org/1150537
+ - PPA builds against mpich 5.0.2-2ubuntu1 (amd64, arm64, ppc64el):
+   https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33919424
+   https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33919425
+   https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33919426
  
  --- [ Original Report ]
  
  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.

-- 
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