Attached debdiff fixes FTBFS on Ubuntu 26.10 by converting space-
delimited MPI_COMPILE_FLAGS into a CMake list and passing unquoted
options to target_compile_options.

Built and verified in a clean stonking container.

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


** Description changed:

- madness 0.10.1+git20200818.eee5fd9f-4 has been stuck in stonking-
- proposed for ~346 days. update_excuses reports:
+ 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:
  
-   missing build on amd64/amd64v3/arm64/ppc64el/s390x: libmadness-dev
+ cc1plus: error: unrecognized argument to '-flto=' option: 'auto -ffat-
+ lto-objects'
+ 
+ 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:
+ 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.
+ 
+ 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.
+ 
+ 
+ --- [ 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-
+   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-
+   /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 ...
+   /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).
+      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: madness (Ubuntu)
       Status: New => Confirmed

** Tags added: patch stonking

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

** Patch added: "madness 0.10.1+git20200818.eee5fd9f-4ubuntu1 debdiff for 
stonking"
   
https://bugs.launchpad.net/ubuntu/+source/madness/+bug/2170321/+attachment/6007962/+files/madness_0.10.1+git20200818.eee5fd9f-4ubuntu1_stonking.debdiff

** Also affects: madness (Debian) via
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1150537
   Importance: Unknown
       Status: Unknown

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