Bug#984877: cubature FTCBFS: multiple reasons

Helmut Grohne helmut at subdivi.de
Tue Mar 9 10:57:36 GMT 2021


Source: cubature
Version: 1.0.3+ds-4
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs

cubature fails to cross build from source. The failure varies a bit with
the architecture combination. For instance cross building from amd64 to
mipsel results in a failure about finding -lfftw3l. Cross building from
amd64 to arm64 results in an Exec format error.

There are multiple causes at work here. The tool clencurt_gen is a build
tool and therefore should be built with the build architecture compiler,
not the host architecture compiler.

Once fixing that, the relevant fftw library is missing. It is a bit
special here, because fftw is needed for both the build architecture
(for clencurt_gen) and for the host architecture (for the actual
libcubature). Thus a dependency is required for both architectures.

Then, depending on the architecture combination, linking fftw fails
again. This time, it happens during the later host architecture compiler
invocations. The relevant fftw library to use depends on the
architecture. Thus we need the FFTWLIB variable for both build and host.

Please consider applying the attached patch to make cross building work.

Helmut
-------------- next part --------------
diff --minimal -Nru cubature-1.0.3+ds/debian/changelog cubature-1.0.3+ds/debian/changelog
--- cubature-1.0.3+ds/debian/changelog	2021-02-20 11:14:12.000000000 +0100
+++ cubature-1.0.3+ds/debian/changelog	2021-03-09 08:25:25.000000000 +0100
@@ -1,3 +1,13 @@
+cubature (1.0.3+ds-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Build build tool clencurt_gen with the build arch compiler.
+    + Add missing libfftw3-dev:native build dependency.
+    + Detect fftw/fftwl for the host objects using the host library.
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 09 Mar 2021 08:25:25 +0100
+
 cubature (1.0.3+ds-4) unstable; urgency=medium
 
   * Replace DEB_BUILD_MULTIARCH with DEB_HOST_MULTIARCH
diff --minimal -Nru cubature-1.0.3+ds/debian/control cubature-1.0.3+ds/debian/control
--- cubature-1.0.3+ds/debian/control	2021-02-20 11:13:22.000000000 +0100
+++ cubature-1.0.3+ds/debian/control	2021-03-09 08:25:25.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Debian Science Team <debian-science-maintainers at lists.alioth.debian.org>
 Uploaders: Ole Streicher <olebole at debian.org>, Nilesh Patra <npatra974 at gmail.com>
-Build-Depends: debhelper-compat (= 12), dh-exec, libfftw3-dev
+Build-Depends: debhelper-compat (= 12), dh-exec, libfftw3-dev, libfftw3-dev:native
 Standards-Version: 4.4.1
 Vcs-Git: https://salsa.debian.org/science-team/cubature.git
 Vcs-Browser: https://salsa.debian.org/science-team/cubature
diff --minimal -Nru cubature-1.0.3+ds/debian/rules cubature-1.0.3+ds/debian/rules
--- cubature-1.0.3+ds/debian/rules	2021-02-20 11:04:04.000000000 +0100
+++ cubature-1.0.3+ds/debian/rules	2021-03-09 08:25:25.000000000 +0100
@@ -3,12 +3,18 @@
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
--include /usr/share/dpkg/buildtools.mk
+include /usr/share/dpkg/buildtools.mk
 
 %:
 	dh $@
 
 ifeq (,$(wildcard /usr/lib/$(DEB_BUILD_MULTIARCH)/libfftw3l*))
+FFTWDEF_FOR_BUILD=-DNO_LONG_DOUBLE_FFTW
+FFTWLIB_FOR_BUILD=-lfftw3
+else
+FFTWLIB_FOR_BUILD=-lfftw3l
+endif
+ifeq (,$(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/libfftw3l*))
 FFTWDEF=-DNO_LONG_DOUBLE_FFTW
 FFTWLIB=-lfftw3
 else
@@ -16,7 +22,7 @@
 endif
 
 override_dh_auto_build:
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(FFTWDEF) $(LDFLAGS) -o clencurt_gen clencurt_gen.c $(FFTWLIB) -lm
+	$(CC_FOR_BUILD) $(CFLAGS) $(CPPFLAGS) $(FFTWDEF_FOR_BUILD) $(LDFLAGS) -o clencurt_gen clencurt_gen.c $(FFTWLIB_FOR_BUILD) -lm
 	./clencurt_gen 19 > clencurt.h
 	$(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c hcubature.c pcubature.c
 	$(CC) $(LDFLAGS) -shared -o libcubature.so.0 -Wl,-soname,libcubature.so.0 hcubature.o pcubature.o -lm


More information about the debian-science-maintainers mailing list