[Pkg-samba-maint] Bug#1003477: talloc FTCBFS: it's difficult

Helmut Grohne helmut at subdivi.de
Mon Jan 10 19:44:31 GMT 2022


Source: talloc
Version: 2.3.3-2
Tags: patch
User: debian-cross at lists.debian.org
Usertags: cross-satisfiability ftcbfs

talloc fails to cross build from source. I'm inclined to say it's
because waf. Really, stop using waf if you can. It's a nightmare.

Ok ok. It's bad, but not impossible. I've attached this huge patch to
make it work. Of course you can apply it and it'll work, yes. But how
about stop using waf?

Polemics aside. waf can be made to cross build if you export all the
build tools. Beyond the usual ones, you also need PYTHON3_CONFIG and
this magic _PYTHON_SYSCONFIGDATA_NAME variable. Of course, debian/rules
also needs to use it instead of calling python3-config directly. Beyond
that, a waf anser file is needed. And that's mostly it. Build-Depends
need to be multiarchified and the python3-talloc.lintian-overrides was
wrongly hard coding the amd64 triplet.

It really can be made to work. But is all this pain really worth it? How
about using like setuptools or something sane? Think about it. And if
all else fails, apply my patch.

Helmut
-------------- next part --------------
diff --minimal -Nru talloc-2.3.3/debian/changelog talloc-2.3.3/debian/changelog
--- talloc-2.3.3/debian/changelog	2021-12-14 20:39:55.000000000 +0100
+++ talloc-2.3.3/debian/changelog	2022-01-10 15:14:47.000000000 +0100
@@ -1,3 +1,10 @@
+talloc (2.3.3-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Make talloc cross buildable. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Mon, 10 Jan 2022 15:14:47 +0100
+
 talloc (2.3.3-2) unstable; urgency=medium
 
   * Avoid explicitly specifying -Wl,--as-needed linker flag.
diff --minimal -Nru talloc-2.3.3/debian/clean talloc-2.3.3/debian/clean
--- talloc-2.3.3/debian/clean	1970-01-01 01:00:00.000000000 +0100
+++ talloc-2.3.3/debian/clean	2022-01-10 15:14:47.000000000 +0100
@@ -0,0 +1,2 @@
+debian/waf.answers
+debian/python3-talloc.lintian-overrides
diff --minimal -Nru talloc-2.3.3/debian/control talloc-2.3.3/debian/control
--- talloc-2.3.3/debian/control	2021-12-14 09:55:18.000000000 +0100
+++ talloc-2.3.3/debian/control	2022-01-10 15:13:07.000000000 +0100
@@ -11,7 +11,8 @@
                docbook-xml,
                docbook-xsl,
                libpopt-dev,
-               python3-dev,
+               libpython3-dev,
+               python3-dev:any,
                xsltproc
 Rules-Requires-Root: no
 Standards-Version: 4.6.0
diff --minimal -Nru talloc-2.3.3/debian/python3-talloc.lintian-overrides talloc-2.3.3/debian/python3-talloc.lintian-overrides
--- talloc-2.3.3/debian/python3-talloc.lintian-overrides	2020-06-21 00:07:41.000000000 +0200
+++ talloc-2.3.3/debian/python3-talloc.lintian-overrides	1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-python3-talloc: package-name-doesnt-match-sonames libpytalloc-util.cpython-*
-# False positives, see #896012
-python3-talloc: library-not-linked-against-libc usr/lib/x86_64-linux-gnu/libpytalloc-util.cpython-*.so.*
diff --minimal -Nru talloc-2.3.3/debian/python3-talloc.lintian-overrides.in talloc-2.3.3/debian/python3-talloc.lintian-overrides.in
--- talloc-2.3.3/debian/python3-talloc.lintian-overrides.in	1970-01-01 01:00:00.000000000 +0100
+++ talloc-2.3.3/debian/python3-talloc.lintian-overrides.in	2022-01-10 15:14:47.000000000 +0100
@@ -0,0 +1,3 @@
+python3-talloc: package-name-doesnt-match-sonames libpytalloc-util.cpython-*
+# False positives, see #896012
+python3-talloc: library-not-linked-against-libc usr/lib/@DEB_HOST_MULTIARCH@/libpytalloc-util.cpython-*.so.*
diff --minimal -Nru talloc-2.3.3/debian/rules talloc-2.3.3/debian/rules
--- talloc-2.3.3/debian/rules	2021-12-14 09:52:18.000000000 +0100
+++ talloc-2.3.3/debian/rules	2022-01-10 15:14:47.000000000 +0100
@@ -12,16 +12,57 @@
 DESTDIR=$(CURDIR)/debian/tmp
 
 include /usr/share/dpkg/architecture.mk
+DPKG_EXPORT_BUILDTOOLS=1
+-include /usr/share/dpkg/buildtools.mk
+export PYTHON_CONFIG ?= $(DEB_HOST_GNU_TYPE)-python3-config
 
 conf_args = --prefix=/usr --disable-rpath-install --disable-rpath --bundled-libraries=NONE
-conf_args += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
 conf_args += --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
 conf_args += -v
 
+ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
+conf_args += --cross-compile --cross-answers=debian/waf.answers
+WAF_SYSNAME_linux = Linux
+WAF_SYSNAME_hurd = GNU
+WAF_SYSNAME_kfreebsd = GNU/kFreeBSD
+WAF_SYSNAME = $(WAF_SYSNAME_$(DEB_HOST_ARCH_OS))
+WAF_MACHINE_amd64 = x86_64
+WAF_MACHINE_arm64 = aarch64
+WAF_MACHINE_arm = armv7l
+WAF_MACHINE_i386 = i686
+WAF_MACHINE_mips64el = mips64
+WAF_MACHINE_mipsel = mips
+WAF_MACHINE_ppc64el = ppc64le
+WAF_MACHINE_hppa = parisc64
+WAF_MACHINE_powerpc = ppc
+WAF_MACHINE = $(or $(WAF_MACHINE_$(DEB_HOST_ARCH_CPU)),$(DEB_HOST_ARCH_CPU))
+export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__$(DEB_HOST_ARCH_OS)_$(DEB_HOST_MULTIARCH)
+endif
+
 %:
 	dh $@ --with python3
 
 override_dh_auto_configure:
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+	echo "Checking simple C program: OK" > debian/waf.answers
+ifneq ($(WAF_SYSNAME),)
+	echo 'Checking uname sysname type: "$(WAF_SYSNAME)"' >> debian/waf.answers
+endif
+	echo 'Checking uname machine type: "$(WAF_MACHINE)"' >> debian/waf.answers
+	echo 'Checking uname release type: "unreproducible if this matters"' >> debian/waf.answers
+	echo 'Checking uname version type: "unreproducible if this matters"' >> debian/waf.answers
+	echo "Checking getconf LFS_CFLAGS: -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" >> debian/waf.answers
+	echo "Checking for large file support without additional flags: OK" >> debian/waf.answers
+	echo "Checking for HAVE_SECURE_MKSTEMP: OK" >> debian/waf.answers
+	echo "rpath library support: OK" >> debian/waf.answers
+	echo "-Wl,--version-script support: OK" >> debian/waf.answers
+	echo "Checking correct behavior of strtoll: OK" >> debian/waf.answers
+	echo "Checking for working strptime: OK" >> debian/waf.answers
+	echo "Checking for C99 vsnprintf: OK" >> debian/waf.answers
+	echo "Checking for HAVE_SHARED_MMAP: OK" >> debian/waf.answers
+	echo "Checking for HAVE_MREMAP: OK" >> debian/waf.answers
+	echo "Checking for HAVE_INCOHERENT_MMAP: FAIL" >> debian/waf.answers
+endif
 	LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" ./configure $(conf_args)
 
 override_dh_auto_build:
@@ -33,7 +74,7 @@
 endif
 
 override_dh_install:
-	DEB_PY3_INCDIR=$(shell python3-config --includes | sed 's,^-I\([^ ]*\).*,\1,') \
+	DEB_PY3_INCDIR=$(shell $(PYTHON_CONFIG) --includes | sed 's,^-I\([^ ]*\).*,\1,') \
 		dh_install
 
 get-packaged-orig-source:
@@ -58,13 +99,16 @@
 	ar -rc libtalloc.a bin/default/talloc*.o
 	mv libtalloc.a $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)
 
+execute_before_dh_lintian:
+	sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' < debian/python3-talloc.lintian-overrides.in > debian/python3-talloc.lintian-overrides
+
 override_dh_missing:
 	dh_missing --fail-missing
 
 override_dh_makeshlibs:
 	dh_makeshlibs -plibtalloc2 -- -c4
-	DEB_PY3_EXTENSION_SUFFIX=$(shell python3-config --extension-suffix | tr '_' '-') \
-	  DEB_PY3_EXTENSION_UPCASE=$(shell python3-config --extension-suffix | sed 's/\.so$$//' | tr 'a-z-' 'A-Z_') \
+	DEB_PY3_EXTENSION_SUFFIX=$(shell $(PYTHON_CONFIG) --extension-suffix | tr '_' '-') \
+	  DEB_PY3_EXTENSION_UPCASE=$(shell $(PYTHON_CONFIG) --extension-suffix | sed 's/\.so$$//' | tr 'a-z-' 'A-Z_') \
 	  debian/python3-talloc.symbols.in > debian/python3-talloc.symbols
 	dh_makeshlibs -ppython3-talloc -Xtalloc. -- -c3
 	rm debian/python3-talloc.symbols


More information about the Pkg-samba-maint mailing list