Source: snapd
Version: 2.68.3-2
Tags: patch
User: [email protected]
Usertags: cross-satisfiability

We want to remove the gcc-multilib package. snapd happens to use it for
testing 32bit seccomp functionality on amd64. An alternative to using
-m32 is to use real cross toolchains. These are more generic than
multilib. I'm attaching a patch that converts snapd to use targeted
cross toolchains for the snap-seccomp test. As a result, it no longer
needs to be skipped. Since the gcc-multilib dependency also is a problem
to cross building, the change improves that aspect as well. Please
consider applying the patch in the forky cycle.

Helmut
diff --minimal -Nru snapd-2.68.3/debian/changelog snapd-2.68.3/debian/changelog
--- snapd-2.68.3/debian/changelog       2025-03-25 13:33:00.000000000 +0100
+++ snapd-2.68.3/debian/changelog       2025-06-01 21:54:11.000000000 +0200
@@ -1,3 +1,10 @@
+snapd (2.68.3-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Stop using gcc-multilib and fix snap-seccomp test. (Closes: #-1)
+
+ -- Helmut Grohne <[email protected]>  Sun, 01 Jun 2025 21:54:11 +0200
+
 snapd (2.68.3-2) unstable; urgency=medium
 
   * switch to pkgconf
diff --minimal -Nru snapd-2.68.3/debian/control snapd-2.68.3/debian/control
--- snapd-2.68.3/debian/control 2025-03-25 13:33:00.000000000 +0100
+++ snapd-2.68.3/debian/control 2025-06-01 21:54:11.000000000 +0200
@@ -16,7 +16,8 @@
                ca-certificates,
                dbus,
                fakeroot,
-               gcc-multilib [amd64],
+               gcc-i686-linux-gnu [amd64] <!nocheck>,
+               libc6-dev-i386-cross [amd64] <!nocheck>,
                gettext,
                gnupg2,
                golang-dbus-dev,
diff --minimal -Nru 
snapd-2.68.3/debian/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch 
snapd-2.68.3/debian/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch
--- 
snapd-2.68.3/debian/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch 
    2025-03-25 13:33:00.000000000 +0100
+++ 
snapd-2.68.3/debian/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch 
    1970-01-01 01:00:00.000000000 +0100
@@ -1,44 +0,0 @@
-From: Zygmunt Krynicki <[email protected]>
-Date: Thu, 17 Jan 2019 17:21:22 +0200
-Subject: cmd/snap-seccomp: skip tests that use -m32
-
-Apparently Debian's amd64 compiler somehow cannot compile -m32 mode
-binaries. The compilation error is:
-
-       multipass@debian-10:~/packaging/snapd/cmd/snap-seccomp$ go test
-       cannot build multi-lib syscall runner: exit status 1
-       In file included from /usr/include/errno.h:25,
-                        from 
/tmp/check-3806730340354206876/1/seccomp_syscall_runner.c:3:
-       /usr/include/features.h:424:12: fatal error: sys/cdefs.h: No such file 
or directory
-        #  include <sys/cdefs.h>
-                   ^~~~~~~~~~~~~
-       compilation terminated.
-       OK: 2 passed, 11 skipped
-
-I was unable to resolve this issue, let's disable this test until we can get to
-the bottom of it.
-
-Signed-off-by: Zygmunt Krynicki <[email protected]>
----
- cmd/snap-seccomp/main_test.go | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/cmd/snap-seccomp/main_test.go b/cmd/snap-seccomp/main_test.go
-index 0706c0e..9f98c39 100644
---- a/cmd/snap-seccomp/main_test.go
-+++ b/cmd/snap-seccomp/main_test.go
-@@ -226,6 +226,14 @@ func (s *snapSeccompSuite) SetUpSuite(c *C) {
-       // Ideally we would build for ppc64el->powerpc and arm64->armhf but
-       // it seems tricky to find the right gcc-multilib for this.
-       if arch.DpkgArchitecture() == "amd64" && s.canCheckCompatArch {
-+              // This test fails on Debian amd64
-+              // cannot build multi-lib syscall runner: exit status 1
-+              // In file included from /usr/include/errno.h:25,
-+              //                  from 
/tmp/check-3806730340354206876/1/seccomp_syscall_runner.c:3:
-+              // /usr/include/features.h:424:12: fatal error: sys/cdefs.h: No 
such file or directory
-+              //  #  include <sys/cdefs.h>
-+              //             ^~~~~~~~~~~~~
-+              c.Skip(`This test fails to build on Debian amd64`)
-               cmd = exec.Command(cmd.Args[0], cmd.Args[1:]...)
-               cmd.Args = append(cmd.Args, "-m32")
-               for i, k := range cmd.Args {
diff --minimal -Nru snapd-2.68.3/debian/patches/multilib.patch 
snapd-2.68.3/debian/patches/multilib.patch
--- snapd-2.68.3/debian/patches/multilib.patch  1970-01-01 01:00:00.000000000 
+0100
+++ snapd-2.68.3/debian/patches/multilib.patch  2025-06-01 21:53:56.000000000 
+0200
@@ -0,0 +1,129 @@
+--- a/cmd/snap-seccomp/main_test.go
++++ b/cmd/snap-seccomp/main_test.go
+@@ -226,8 +226,7 @@
+       // Ideally we would build for ppc64el->powerpc and arm64->armhf but
+       // it seems tricky to find the right gcc-multilib for this.
+       if arch.DpkgArchitecture() == "amd64" && s.canCheckCompatArch {
+-              cmd = exec.Command(cmd.Args[0], cmd.Args[1:]...)
+-              cmd.Args = append(cmd.Args, "-m32")
++              cmd = exec.Command("i686-linux-gnu-gcc", cmd.Args[1:]...)
+               for i, k := range cmd.Args {
+                       if k == s.seccompSyscallRunner {
+                               cmd.Args[i] = s.seccompSyscallRunner + ".m32"
+--- a/tests/lib/snaps/store/test-snapd-daemon-user/src/Makefile
++++ b/tests/lib/snaps/store/test-snapd-daemon-user/src/Makefile
+@@ -117,86 +117,87 @@
+ 
+ #ifneq (,$(filter $(arch_triplet), x86_64-linux-gnu aarch64-linux-gnu))
+ ifneq (,$(filter $(arch_triplet), x86_64-linux-gnu))
++CC_M32 ?= i686-linux-gnu-gcc
+ display32.o: display32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ drop32.o: drop32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ drop32: display32.o drop32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ drop-exec32.o: drop-exec32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ drop-exec32: display32.o drop-exec32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ drop-syscall32.o: drop-syscall32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ drop-syscall32: display32.o drop-syscall32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ setgid32.o: setgid32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ setgid32: display32.o setgid32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ setregid32.o: setregid32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ setregid32: display32.o setregid32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ setresgid32.o: setresgid32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ setresgid32: display32.o setresgid32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ setuid32.o: setuid32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ setuid32: display32.o setuid32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ setreuid32.o: setreuid32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ setreuid32: display32.o setreuid32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ setresuid32.o: setresuid32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ setresuid32: display32.o setresuid32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ chown32.o: chown32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ chown32: display32.o chown32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ lchown32.o: lchown32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ lchown32: display32.o lchown32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ fchown32.o: fchown32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ fchown32: display32.o fchown32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ 
+ fchownat32.o: fchownat32.c
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $< -c ${LDLIBS}
+ 
+ fchownat32: display32.o fchownat32.o
+-      ${CC} -m32 ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
++      ${CC_M32} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
+ endif
+ 
+ 
diff --minimal -Nru snapd-2.68.3/debian/patches/series 
snapd-2.68.3/debian/patches/series
--- snapd-2.68.3/debian/patches/series  2025-03-25 13:33:00.000000000 +0100
+++ snapd-2.68.3/debian/patches/series  2025-06-01 21:54:11.000000000 +0200
@@ -1,4 +1,4 @@
-0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch
 0004-cmd-snap-skip-tests-depending-on-text-wrapping.patch
 0007-i18n-use-dummy-localizations-to-avoid-dependencies.patch
 0010-man-page-sections.patch
+multilib.patch

Reply via email to