[Pkg-samba-maint] Bug#1093033: samba FTCBFS: multiple reasons related to waf
Helmut Grohne
helmut at subdivi.de
Tue Jan 14 10:20:18 GMT 2025
Source: samba
Version: 2:4.21.3+dfsg-5
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs
Hi Michael,
thanks for working a lot on making samba cross buildable. As I
understand it, you use qemu-user-binfmt for cross building. That's not
something a package may rely on generally. For instance,
gobject-introspection requires emulation and uses cross-exe-wrapper for
doing it.
In case of samba, a lot of emulation can be avoided. The build system
has basic support for cross building, but it still is somewhat
incomplete. I looked into improving the state and have prepared a patch.
It's a proposal for some improvements that you may or may not disagree
about. I suggest that you cherry-pick those that you like and then close
this bug.
* If the cross profile is set, pass --cross-compile and
--cross-answers. Generate a suitable answers file using a shell
script. I understand that this poses extra maintenance down the road
as checks may change. Is this something you'd carry?
* The largefile check may be disarmed by relying on CHECK_SIZEOF. I
hope that this aspect is upstreamable.
Then the "configure summary" fails. It needlessly runs a binary and
could be converted as well. I can look into that, but appreciate
feedback on these steps to see whether such changes are welcome.
Helmut
-------------- next part --------------
diff --minimal -Nru samba-4.21.3+dfsg/debian/changelog samba-4.21.3+dfsg/debian/changelog
--- samba-4.21.3+dfsg/debian/changelog 2025-01-11 22:17:49.000000000 +0100
+++ samba-4.21.3+dfsg/debian/changelog 2025-01-14 07:36:18.000000000 +0100
@@ -1,3 +1,10 @@
+samba (2:4.21.3+dfsg-5.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Improve cross compilation. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de> Tue, 14 Jan 2025 07:36:18 +0100
+
samba (2:4.21.3+dfsg-5) unstable; urgency=medium
* the Fixing Big Mishaps release.
diff --minimal -Nru samba-4.21.3+dfsg/debian/clean samba-4.21.3+dfsg/debian/clean
--- samba-4.21.3+dfsg/debian/clean 2024-11-25 17:35:00.000000000 +0100
+++ samba-4.21.3+dfsg/debian/clean 2025-01-14 07:36:18.000000000 +0100
@@ -7,3 +7,5 @@
third_party/waf/waflib/__pycache__/
third_party/waf/waflib/extras/__pycache__/
third_party/waf/waflib/Tools/__pycache__/
+# generated for cross compilation
+debian/waf.answers
diff --minimal -Nru samba-4.21.3+dfsg/debian/patches/cross.patch samba-4.21.3+dfsg/debian/patches/cross.patch
--- samba-4.21.3+dfsg/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100
+++ samba-4.21.3+dfsg/debian/patches/cross.patch 2025-01-14 07:36:18.000000000 +0100
@@ -0,0 +1,94 @@
+--- samba-4.21.3+dfsg.orig/buildtools/wafsamba/samba_conftests.py
++++ samba-4.21.3+dfsg/buildtools/wafsamba/samba_conftests.py
+@@ -84,42 +84,42 @@
+ @conf
+ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
+ '''see what we need for largefile support'''
+- getconf_cflags = conf.CHECK_COMMAND(['getconf', 'LFS_CFLAGS'])
+- if getconf_cflags is not False:
+- if (conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
+- define='WORKING_GETCONF_LFS_CFLAGS',
+- execute=True,
+- cflags=getconf_cflags,
+- msg='Checking getconf large file support flags work')):
+- conf.ADD_CFLAGS(getconf_cflags)
+- getconf_cflags_list=TO_LIST(getconf_cflags)
+- for flag in getconf_cflags_list:
+- if flag[:2] == "-D":
+- flag_split = flag[2:].split('=')
+- if len(flag_split) == 1:
+- conf.DEFINE(flag_split[0], '1')
+- else:
+- conf.DEFINE(flag_split[0], flag_split[1])
++ if not conf.env.CROSS_COMPILE:
++ getconf_cflags = conf.CHECK_COMMAND(['getconf', 'LFS_CFLAGS'])
++ if getconf_cflags is not False:
++ conf.CHECK_SIZEOF('off_t',
++ define='SIZEOF_GETCONF_OFF_T',
++ cflags=getconf_cflags)
++ if int(conf.env.SIZEOF_GETCONF_OFF_T) >= 8:
++ conf.DEFINE('WORKING_GETCONF_LFS_CFLAGS', 1)
++ conf.ADD_CFLAGS(getconf_cflags)
++ getconf_cflags_list=TO_LIST(getconf_cflags)
++ for flag in getconf_cflags_list:
++ if flag[:2] == "-D":
++ flag_split = flag[2:].split('=')
++ if len(flag_split) == 1:
++ conf.DEFINE(flag_split[0], '1')
++ else:
++ conf.DEFINE(flag_split[0], flag_split[1])
+
+- if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
+- define,
+- execute=True,
+- msg='Checking for large file support without additional flags'):
++ conf.CHECK_SIZEOF('off_t', define='SIZEOF_DEFAULT_OFF_T')
++ if int(conf.env.SIZEOF_DEFAULT_OFF_T) >= 8:
++ conf.DEFINE(define, 1)
+ return True
+
+- if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
+- define,
+- execute=True,
+- cflags='-D_FILE_OFFSET_BITS=64',
+- msg='Checking for -D_FILE_OFFSET_BITS=64'):
++ conf.CHECK_SIZEOF('off_t',
++ define='SIZEOF_FOB_OFF_T',
++ cflags='-D_FILE_OFFSET_BITS=64')
++ if int(conf.env.SIZEOF_FOB_OFF_T) >= 8:
++ conf.DEFINE(define, 1)
+ conf.DEFINE('_FILE_OFFSET_BITS', 64)
+ return True
+
+- if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
+- define,
+- execute=True,
+- cflags='-D_LARGE_FILES',
+- msg='Checking for -D_LARGE_FILES'):
++ conf.CHECK_SIZEOF('off_t',
++ define='SIZEOF_LF_OFF_T',
++ cflags='-D_LARGE_FILES')
++ if int(conf.env.SIZEOF_LF_OFF_T) >= 8:
++ conf.DEFINE(define, 1)
+ conf.DEFINE('_LARGE_FILES', 1)
+ return True
+ return False
+--- samba-4.21.3+dfsg.orig/buildtools/wafsamba/samba_autoconf.py
++++ samba-4.21.3+dfsg/buildtools/wafsamba/samba_autoconf.py
+@@ -323,7 +323,7 @@
+
+
+ @conf
+-def CHECK_SIZEOF(conf, vars, headers=None, define=None, critical=True):
++def CHECK_SIZEOF(conf, vars, headers=None, define=None, critical=True, cflags=''):
+ '''check the size of a type'''
+ for v in TO_LIST(vars):
+ v_define = define
+@@ -335,6 +335,7 @@
+ 'static int test_array[1 - 2 * !(((long int)(sizeof(%s))) <= %d)];' % (v, size),
+ define=v_define,
+ quote=False,
++ cflags=cflags,
+ headers=headers,
+ local_include=False,
+ msg="Checking if size of %s == %d" % (v, size)):
diff --minimal -Nru samba-4.21.3+dfsg/debian/patches/series samba-4.21.3+dfsg/debian/patches/series
--- samba-4.21.3+dfsg/debian/patches/series 2025-01-11 14:43:20.000000000 +0100
+++ samba-4.21.3+dfsg/debian/patches/series 2025-01-14 07:36:18.000000000 +0100
@@ -30,3 +30,4 @@
lower-dns-lookup-mismatch-messages.patch
include-grp.h-for-setgroups-in-a-few-places.patch
ctdb-failover-statd_callout-PATH_MAX-workaround.patch
+cross.patch
diff --minimal -Nru samba-4.21.3+dfsg/debian/rules samba-4.21.3+dfsg/debian/rules
--- samba-4.21.3+dfsg/debian/rules 2025-01-11 22:12:04.000000000 +0100
+++ samba-4.21.3+dfsg/debian/rules 2025-01-14 07:36:18.000000000 +0100
@@ -133,6 +133,13 @@
config-args += \
--with-shared-modules=vfs_dfs_samba4,vfs_nfs4acl_xattr,auth_samba4
+ifneq (,$(filter cross,$(DEB_BUILD_PROFILES)))
+config-args += \
+ --cross-compile \
+ --hostcc=$(CC_FOR_BUILD) \
+ --cross-answers=debian/waf.answers
+endif
+
ifeq (${DEB_HOST_ARCH_OS}, linux) # extra linux-specific features
config-args += \
@@ -186,6 +193,9 @@
configure: bin/configured.stamp
.PHONY: configure
bin/configured.stamp:
+ifneq (,$(filter cross,$(DEB_BUILD_PROFILES)))
+ ./debian/waf.answers.sh > debian/waf.answers
+endif
CC="${CC}" CPP="${CPP}" LD="${LD}" PKGCONFIG="${PKG_CONFIG}" \
CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
PYTHON=python3 PYTHON_CONFIG=${DEB_HOST_MULTIARCH}-python3-config \
diff --minimal -Nru samba-4.21.3+dfsg/debian/waf.answers.sh samba-4.21.3+dfsg/debian/waf.answers.sh
--- samba-4.21.3+dfsg/debian/waf.answers.sh 1970-01-01 01:00:00.000000000 +0100
+++ samba-4.21.3+dfsg/debian/waf.answers.sh 2025-01-14 07:36:18.000000000 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if dpkg-architecture -iany-gnu-any-any; then
+ echo "Checking for HAVE_SECURE_MKSTEMP: OK"
+ echo "Checking for working strptime: OK"
+ echo "Checking for C99 vsnprintf: OK"
+ echo "Checking errno of iconv for illegal multibyte sequence: OK"
+ echo "Checking for HAVE_SHARED_MMAP: OK"
+ if dpkg-architecture -ilinux-any; then
+ echo "Checking for HAVE_MREMAP: OK"
+ echo "Checking whether we can use Linux thread-specific credentials: OK"
+ fi
+fi
More information about the Pkg-samba-maint
mailing list