Package: madness
Version: 0.10.1+git20200818.eee5fd9f-4
Severity: important
Tags: patch ftbfs
User: [email protected]
Usertags: origin-ubuntu stonking

Dear Maintainer,

madness fails to build from source on Ubuntu 26.10:

cc1plus: error: unrecognized argument to '-flto=' option: 'auto 
-ffat-lto-objects'

Root cause:
MPI_COMPILE_FLAGS returned by CMake FindMPI contains space-delimited flags 
leaked by mpich wrappers. In src/madness/CMakeLists.txt, passing quoted 
"${MPI_COMPILE_FLAGS}" without separate_arguments() causes CMake to pass all 
flags as a single compiler argument to g++.

Fix:
Split MPI_COMPILE_FLAGS using separate_arguments() in external/mpi.cmake and 
remove quotes in target_compile_options() in src/madness/CMakeLists.txt.

The patch is attached.

Best regards,
Viktor Pashaiev
Description: Fix FTBFS with multi-flag MPI compile options
 Split space-delimited MPI_COMPILE_FLAGS and unquote in target_compile_options.
Author: Viktor Pashaiev <[email protected]>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/madness/+bug/2170321
Last-Update: 2026-10-10
--- a/external/mpi.cmake
+++ b/external/mpi.cmake
@@ -45,6 +45,7 @@
   string(REGEX REPLACE "[ ]?-pthread" "" MPI_COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
   string(REGEX REPLACE "[ ]?-pthread" "" MPI_LINK_FLAGS "${MPI_LINK_FLAGS}")
   set(MPI_LIBRARIES ${MPI_LIBRARIES} Threads::Threads)
+  separate_arguments(MPI_COMPILE_FLAGS)
 
   # MPIEXEC was deprecated in CMake 3.10
   if (CMAKE_VERSION VERSION_LESS 3.10.0)
--- a/src/madness/CMakeLists.txt
+++ b/src/madness/CMakeLists.txt
@@ -91,7 +91,7 @@
 if(MPI_FOUND)
   target_include_directories(madness PUBLIC ${MPI_INCLUDE_PATH})
   target_compile_definitions(madness PUBLIC -DMPICH_SKIP_MPICXX=1 -DOMPI_SKIP_MPICXX=1)
-  target_compile_options(madness PUBLIC "${MPI_COMPILE_FLAGS}")
+  target_compile_options(madness PUBLIC ${MPI_COMPILE_FLAGS})
   target_link_libraries(madness PUBLIC ${MPI_LINK_FLAGS})
   target_link_libraries(madness PUBLIC ${MPI_LIBRARIES})
 endif()

Reply via email to