Source: libfiu
Version: 1.2-4
Tags: patch
User: [email protected]
Usertags: ftcbfs

libfiu fails to cross build from source for multiple reasons. The 
immediate failure arises from trying to use ldd to determine the libc 
soname. ldd operates by running the target object and that's something 
we cannot do during cross compilation. I propose inspecting the object 
using objdump instead. Once that is resolved, the Python stuff is being 
built for the build architecture as no cross compilation settings are 
passed. The easiest way of doing this - using dh_auto_* things with the 
pybuild buildsystem - fixes this while also reducing the rules file. 
Last but not least, make install computes compiler flags depending on 
the compiler and since dh_auto_install does not pass cross tools, make 
install tries to rebuild everything as it perceives a change in flags. 
We may simply export cross tools for all targets. You'll find all of the 
mentioned problems addressed in the attached patch. Please consider 
applying it.

Helmut
diff -Nru libfiu-1.2/debian/changelog libfiu-1.2/debian/changelog
--- libfiu-1.2/debian/changelog 2025-09-10 02:05:31.000000000 +0200
+++ libfiu-1.2/debian/changelog 2025-09-22 11:52:48.000000000 +0200
@@ -1,3 +1,13 @@
+libfiu (1.2-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: Use objdump to determine the libc soname.
+    + Let dh_auto_* pass cross stuff for Python.
+    + Use host tools for make install.
+
+ -- Helmut Grohne <[email protected]>  Mon, 22 Sep 2025 11:52:48 +0200
+
 libfiu (1.2-4) unstable; urgency=medium
 
   * Apply an upstream patch to fix FTBFS with GCC-15. (Closes: #1097184)
diff -Nru libfiu-1.2/debian/patches/cross.patch 
libfiu-1.2/debian/patches/cross.patch
--- libfiu-1.2/debian/patches/cross.patch       1970-01-01 01:00:00.000000000 
+0100
+++ libfiu-1.2/debian/patches/cross.patch       2025-09-22 11:52:48.000000000 
+0200
@@ -0,0 +1,20 @@
+--- libfiu-1.2.orig/preload/posix/Makefile
++++ libfiu-1.2/preload/posix/Makefile
+@@ -23,6 +23,7 @@
+ # install utility, we assume it's GNU/BSD compatible
+ INSTALL=install
+ 
++OBJDUMP ?= objdump
+ 
+ MODS = $(sort $(wildcard modules/*.mod))
+ GEN_C = $(addsuffix .c,$(MODS))
+@@ -87,7 +88,8 @@
+ # --as-needed) might not link it against libc.
+ build-libcsoname:
+       @$(CC) build-libccheck.c -lc -shared -fPIC -o build-libccheck.so
+-      @ldd ./build-libccheck.so | grep libc.so | awk '{ print $$1 }' > $@
++      @$(OBJDUMP) -p ./build-libccheck.so | \
++              sed -n 's/^\s*NEEDED\s\+\(libc\.so\)/\1/p' > $@
+       @rm build-libccheck.so
+       @test "`cat $@`" != "" || \
+               (echo "Error finding soname, please report"; rm $@; exit 1)
diff -Nru libfiu-1.2/debian/patches/series libfiu-1.2/debian/patches/series
--- libfiu-1.2/debian/patches/series    2025-09-10 02:05:31.000000000 +0200
+++ libfiu-1.2/debian/patches/series    2025-09-22 11:52:48.000000000 +0200
@@ -1 +1,2 @@
 0001-tests-generated-Disable-optimizations-to-avoid-false.patch
+cross.patch
diff -Nru libfiu-1.2/debian/rules libfiu-1.2/debian/rules
--- libfiu-1.2/debian/rules     2025-09-10 02:05:31.000000000 +0200
+++ libfiu-1.2/debian/rules     2025-09-22 11:52:48.000000000 +0200
@@ -3,10 +3,12 @@
 DOCS = $(patsubst %.rst,%.html, $(wildcard doc/*.rst))
 PYTHON_VERSIONS := $(shell py3versions -sv)
 PYTHON_VERSION_DEFAULT := $(shell py3versions -dv)
+DPKG_EXPORT_BUILDTOOLS = 1
 DPKG_EXPORT_BUILDFLAGS = 1
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
+include /usr/share/dpkg/buildtools.mk
 include /usr/share/dpkg/buildflags.mk
 
 %:
@@ -21,10 +23,7 @@
 
 override_dh_auto_build: $(DOCS)
        dh_auto_build -- V=1 $(shell dpkg-buildflags --export=cmdline)
-       cd bindings/python && \
-       set -e && for i in $(PYTHON_VERSIONS); do \
-               python$$i ./setup.py build; \
-       done
+       dh_auto_build --buildsystem=pybuild --sourcedirectory=bindings/python
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
@@ -40,10 +39,8 @@
 
 override_dh_auto_install:
        make install PREFIX=$(CURDIR)/debian/tmp/usr DESTDIR=/usr 
PLIBPATH=/usr/lib/fiu V=1
-       cd bindings/python && \
-       set -e && for i in $(PYTHON_VERSIONS); do \
-               python$$i ./setup.py install 
--root=$(CURDIR)/debian/python3-fiu --no-compile -O0 --install-layout=deb; \
-       done
+       dh_auto_install --buildsystem=pybuild --sourcedirectory=bindings/python 
-- \
+               --install-args "--root=$(CURDIR)/debian/python3-fiu 
--no-compile -O0 --install-layout=deb"
 
 override_dh_compress:
        dh_compress -X.rst

Reply via email to