[Debian-med-packaging] Bug#1107485: ampliconnoise FTCBFS: misses mpi flags

Helmut Grohne helmut at subdivi.de
Sat Jun 7 10:35:25 BST 2025


Source: ampliconnoise
Version: 1.29-15
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs

ampliconnoise fails to cross build from source as it misses mpi compiler
flags. In theory, it uses mpicc, but cross builds override CC with a
non-mpi cross compiler and that's where flags go missing. Fundamentally,
mpicc and cross building are incompatible. For openmpi, the solution is
to use pkgconf, but mpich does not provide mpi-c anymore. I'm proposing
a compromise here: Attempt to use pkgconf to add the flags, but do not
fail when pkgconf doesn't work (e.g. on 32bit archs that use mpich).
Then native building will continue to work everywhere (as it continues
to use mpicc) while cross building will work for 64bit targets (where
openmpi is used). Cross builds to 32bit architectures remain broken for
now. What do you think?

Helmut
-------------- next part --------------
diff --minimal -Nru ampliconnoise-1.29/debian/changelog ampliconnoise-1.29/debian/changelog
--- ampliconnoise-1.29/debian/changelog	2024-11-26 22:12:39.000000000 +0100
+++ ampliconnoise-1.29/debian/changelog	2025-06-03 08:29:42.000000000 +0200
@@ -1,3 +1,10 @@
+ampliconnoise (1.29-15.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix cross building with openmpi. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 03 Jun 2025 08:29:42 +0200
+
 ampliconnoise (1.29-15) unstable; urgency=medium
 
   * d/t/Run.sh: remove openmpi specific --use-hwthread-cpu argument.
diff --minimal -Nru ampliconnoise-1.29/debian/control ampliconnoise-1.29/debian/control
--- ampliconnoise-1.29/debian/control	2024-11-26 21:34:27.000000000 +0100
+++ ampliconnoise-1.29/debian/control	2025-06-03 08:29:42.000000000 +0200
@@ -7,7 +7,8 @@
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
                libgsl-dev,
-               mpi-default-dev
+               mpi-default-dev,
+               pkgconf,
 Standards-Version: 4.7.0
 Vcs-Browser: https://salsa.debian.org/med-team/ampliconnoise
 Vcs-Git: https://salsa.debian.org/med-team/ampliconnoise.git
diff --minimal -Nru ampliconnoise-1.29/debian/patches/cross.patch ampliconnoise-1.29/debian/patches/cross.patch
--- ampliconnoise-1.29/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ ampliconnoise-1.29/debian/patches/cross.patch	2025-06-03 08:29:42.000000000 +0200
@@ -0,0 +1,77 @@
+--- ampliconnoise-1.29.orig/NDist/makefile
++++ ampliconnoise-1.29/NDist/makefile
+@@ -2,7 +2,7 @@
+ CFLAGS += -O3
+ EFLAGS = $(LDFLAGS)
+ EFILE  = NDist
+-LIBS   = -lm  
++LIBS   = -lm $(MPI_LIBS)
+ OBJS   = NDist.o 
+ 
+ $(EFILE) : $(OBJS)
+--- ampliconnoise-1.29.orig/PyroDist/makefile
++++ ampliconnoise-1.29/PyroDist/makefile
+@@ -2,7 +2,7 @@
+ CFLAGS += -O3
+ EFLAGS = $(LDFLAGS)
+ EFILE  = PyroDist
+-LIBS   = -lm 
++LIBS   = -lm $(MPI_LIBS)
+ OBJS   = PyroDist.o
+ 
+ $(EFILE) : $(OBJS)
+--- ampliconnoise-1.29.orig/PyroNoise/makefile
++++ ampliconnoise-1.29/PyroNoise/makefile
+@@ -2,7 +2,7 @@
+ CFLAGS += -O3
+ EFLAGS = $(LDFLAGS)
+ EFILE  = PyroNoise
+-LIBS   =  -lm
++LIBS   =  -lm $(MPI_LIBS)
+ OBJS   = PyroNoise.o 
+ 
+ $(EFILE) : $(OBJS)
+--- ampliconnoise-1.29.orig/PyroNoiseA/makefile
++++ ampliconnoise-1.29/PyroNoiseA/makefile
+@@ -2,7 +2,7 @@
+ CFLAGS += -O3
+ EFLAGS = 
+ EFILE  = PyroNoiseA
+-LIBS   =  -lm
++LIBS   =  -lm $(MPI_LIBS)
+ OBJS   = PyroNoiseA.o 
+ 
+ $(EFILE) : $(OBJS)
+--- ampliconnoise-1.29.orig/PyroNoiseM/makefile
++++ ampliconnoise-1.29/PyroNoiseM/makefile
+@@ -2,7 +2,7 @@
+ CFLAGS += -O3
+ EFLAGS = $(LDFLAGS)
+ EFILE  = PyroNoiseM
+-LIBS   =  -lm
++LIBS   =  -lm $(MPI_LIBS)
+ OBJS   = PyroNoiseM.o 
+ 
+ $(EFILE) : $(OBJS)
+--- ampliconnoise-1.29.orig/SeqDist/makefile
++++ ampliconnoise-1.29/SeqDist/makefile
+@@ -2,7 +2,7 @@
+ CFLAGS += -O3
+ EFLAGS = $(LDFLAGS)
+ EFILE  = SeqDist
+-LIBS   = -lm 
++LIBS   = -lm $(MPI_LIBS)
+ OBJS   = SeqDist.o
+ 
+ $(EFILE) : $(OBJS)
+--- ampliconnoise-1.29.orig/SeqNoise/makefile
++++ ampliconnoise-1.29/SeqNoise/makefile
+@@ -2,7 +2,7 @@
+ CFLAGS += -O3
+ EFLAGS = $(LDFLAGS)
+ EFILE  = SeqNoise
+-LIBS   = -lm 
++LIBS   = -lm $(MPI_LIBS)
+ OBJS   = SeqNoise.o
+ 
+ $(EFILE) : $(OBJS)
diff --minimal -Nru ampliconnoise-1.29/debian/patches/series ampliconnoise-1.29/debian/patches/series
--- ampliconnoise-1.29/debian/patches/series	2024-08-07 13:41:01.000000000 +0200
+++ ampliconnoise-1.29/debian/patches/series	2025-06-03 08:29:42.000000000 +0200
@@ -6,3 +6,4 @@
 fix_sequence_of_function_definitions.patch
 fix_missing_header.patch
 gcc-14.patch
+cross.patch
diff --minimal -Nru ampliconnoise-1.29/debian/rules ampliconnoise-1.29/debian/rules
--- ampliconnoise-1.29/debian/rules	2024-11-26 22:07:12.000000000 +0100
+++ ampliconnoise-1.29/debian/rules	2025-06-03 08:29:42.000000000 +0200
@@ -5,15 +5,24 @@
 #export DH_VERBOSE=1
 
 include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/buildtools.mk
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
 # Compensate test result mismatches occurring on i386 only.
 ifeq ($(DEB_HOST_ARCH),i386)
-export DEB_CFLAGS_MAINT_APPEND=-ffloat-store
-export DEB_CXXFLAGS_MAINT_APPEND=-ffloat-store
+DEB_CFLAGS_MAINT_APPEND=-ffloat-store
+DEB_CXXFLAGS_MAINT_APPEND=-ffloat-store
 endif
 
+# mpi-c only works for openmpi and mpicc only works for native builds.
+# With these settings mpich cross builds are broken and everything else works.
+DEB_CFLAGS_MAINT_APPEND += $(shell $(PKG_CONFIG) --cflags mpi-c)
+DEB_CXXFLAGS_MAINT_APPEND += $(shell $(PKG_CONFIG) --cflags mpi-c)
+MPI_LIBS += $(shell $(PKG_CONFIG) --libs mpi-c)
+
+export DEB_CFLAGS_MAINT_APPEND DEB_CXXFLAGS_MAINT_APPEND MPI_LIBS
+
 %:
 	dh $@
 


More information about the Debian-med-packaging mailing list