Your message dated Tue, 19 Aug 2025 03:06:12 +0000
with message-id <[email protected]>
and subject line Bug#1100436: fixed in golang-1.24 1.24.4-2
has caused the Debian Bug report #1100436,
regarding golang-1.24 FTCBFS: multiple reasons
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1100436: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1100436
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: golang-1.24
Version: 1.24.1-1
Tags: patch
User: [email protected]
Usertags: ftcbfs

I looked into cross building the go compiler itself. The packaging
already did a lot of the heavy lifting. Thank you!

The immediate failure is running the host's go executable. As go is a
multi-target compiler, we really want the build's go here. That can be
achieved by appending :native to the relevant Build-Depends.

>From then, the build goes quite far. The failure is from dh_strip
complaining about amd64 executables in various locations. One aspect to
this is that we should tell the build process about the C and C++
compilers as it uses different variable meanings from Debian:

  CC -> CC_FOR_TARGET
  CC_FOR_BUILD -> CC

I propose adding those variables to debian/helpers/goenv.sh.

Unfortunately, that doesn't make dh_strip happy. In a cross build,
./bin contains the build's go tools and a directory ${GOOS}_${GOARCH}
containing the host's go tools. This is different from native builds and
requires some branching to install them.

Likewise, pkg/tool now contains tools for both the build and the host
architecture, but the binary package should only contain the host's
tools.

For correctly installing those files in both native and cross builds,
the packaging needs the GOOS and GOARCH variables, which is why I
suggest moving their computation from debian/helpers/goenv.sh into
debian/rules. Admittedly, it is slightly uglier in make than in shell.

And with all of these changes, we can readily cross build the
golang-1.24 package. What do you think?

I suppose that this likewise applies to other go versions and that the
patch is transferrable there.

If you think that the toolchain freeze is too close to apply this patch,
please defer it until after trixie is released. Cross building go
packages in Debian requires more changes and cross building the go
compiler probably is not the most exciting exercise.

Helmut
diff --minimal -Nru golang-1.24-1.24.1/debian/changelog 
golang-1.24-1.24.1/debian/changelog
--- golang-1.24-1.24.1/debian/changelog 2025-03-05 00:58:41.000000000 +0100
+++ golang-1.24-1.24.1/debian/changelog 2025-03-13 11:38:16.000000000 +0100
@@ -1,3 +1,15 @@
+golang-1.24 (1.24.1-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Build-Depend on a native go compiler.
+    + Move GO{,HOST}{ARCH,OS} from debian/helpers/goenv.sh to debian/rules
+      for use by debhelper.
+    + Export C{C,XX}{,_FOR_TARGET} as required by make.bash.
+    + Install the host's (target in go-speak) tools and compiler only.
+
+ -- Helmut Grohne <[email protected]>  Thu, 13 Mar 2025 11:38:16 +0100
+
 golang-1.24 (1.24.1-1) unstable; urgency=medium
 
   * Team upload
diff --minimal -Nru golang-1.24-1.24.1/debian/control 
golang-1.24-1.24.1/debian/control
--- golang-1.24-1.24.1/debian/control   2025-03-05 00:58:41.000000000 +0100
+++ golang-1.24-1.24.1/debian/control   2025-03-13 11:38:16.000000000 +0100
@@ -13,7 +13,7 @@
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
                binutils-gold [arm64],
-               golang-1.24-go | golang-1.23-go | golang-1.22-go,
+               golang-1.24-go:native | golang-1.23-go:native | 
golang-1.22-go:native,
                netbase
 Standards-Version: 4.6.2
 Vcs-Browser: https://salsa.debian.org/go-team/compiler/golang/tree/golang-1.24
diff --minimal -Nru golang-1.24-1.24.1/debian/golang-X.Y-go.dirs 
golang-1.24-1.24.1/debian/golang-X.Y-go.dirs
--- golang-1.24-1.24.1/debian/golang-X.Y-go.dirs        2025-03-05 
00:58:41.000000000 +0100
+++ golang-1.24-1.24.1/debian/golang-X.Y-go.dirs        2025-03-13 
11:38:16.000000000 +0100
@@ -1 +1 @@
-usr/lib/go-X.Y
+usr/lib/go-X.Y/bin
diff --minimal -Nru golang-1.24-1.24.1/debian/golang-X.Y-go.install 
golang-1.24-1.24.1/debian/golang-X.Y-go.install
--- golang-1.24-1.24.1/debian/golang-X.Y-go.install     2025-03-05 
00:58:41.000000000 +0100
+++ golang-1.24-1.24.1/debian/golang-X.Y-go.install     2025-03-13 
11:38:16.000000000 +0100
@@ -1,5 +1,4 @@
 VERSION /usr/lib/go-X.Y/
-bin /usr/lib/go-X.Y/
 go.env /usr/lib/go-X.Y/
 pkg/include /usr/share/go-X.Y/pkg/
-pkg/tool /usr/lib/go-X.Y/pkg/
+pkg/tool/${env:GOOS}_${env:GOARCH} /usr/lib/go-X.Y/pkg/
diff --minimal -Nru golang-1.24-1.24.1/debian/helpers/goenv.sh 
golang-1.24-1.24.1/debian/helpers/goenv.sh
--- golang-1.24-1.24.1/debian/helpers/goenv.sh  2025-03-05 00:58:41.000000000 
+0100
+++ golang-1.24-1.24.1/debian/helpers/goenv.sh  2025-03-13 11:38:16.000000000 
+0100
@@ -1,37 +1,7 @@
 #!/bin/sh
 set -e
 
-__goos__deb_arch_os() {
-       case "$1" in
-               kfreebsd) echo freebsd ;;
-               linux) echo "$1" ;;
-               *) echo >&2 "error: unrecongized DEB_*_ARCH_OS: $1"; exit 1 ;;
-       esac
-}
-
-__goarch__deb_arch_cpu() {
-       case "$1" in
-               amd64|arm|arm64|loong64|mips|ppc64|riscv64|s390x) echo "$1" ;;
-               i386) echo 386 ;;
-               mips64el) echo mips64le ;;
-               mipsel) echo mipsle ;;
-               ppc64el) echo ppc64le ;;
-               *) echo >&2 "error: unrecongized DEB_*_ARCH_CPU: $1"; exit 1 ;;
-       esac
-}
-
-#       build machine
-#           The machine the package is built on.
-#
-#       host machine
-#           The machine the package is built for.
-
-export GOHOSTOS="$(__goos__deb_arch_os "$(dpkg-architecture 
-qDEB_BUILD_ARCH_OS 2>/dev/null)")"
-export GOOS="$(__goos__deb_arch_os "$(dpkg-architecture -qDEB_HOST_ARCH_OS 
2>/dev/null)")"
-
-export GOHOSTARCH="$(__goarch__deb_arch_cpu "$(dpkg-architecture 
-qDEB_BUILD_ARCH_CPU 2>/dev/null)")"
-export GOARCH="$(__goarch__deb_arch_cpu "$(dpkg-architecture 
-qDEB_HOST_ARCH_CPU 2>/dev/null)")"
-
+# GO{,HOST}{ARCH,OS} are set in debian/rules
 if [ -z "$GOHOSTOS" -o -z "$GOOS" -o -z "$GOHOSTARCH" -o -z "$GOARCH" ]; then
        exit 1
 fi
@@ -70,4 +40,28 @@
 fi
 export GOARM
 
+if [ "$(dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null)" = "$(dpkg-architecture 
-qDEB_BUILD_ARCH 2>/dev/null)" ]; then
+       : "${CC:=${CC_FOR_BUILD:-gcc}}"
+       CC_FOR_TARGET="$CC"
+       : "${CXX:=${CXX_FOR_BUILD:-g++}}"
+       CXX_FOR_TARGET="$CXX"
+else
+       if [ -z "${CC:-}" ]; then
+               CC_FOR_TARGET="$CC"
+       else
+               CC_FOR_TARGET="$(dpkg-architecture -qDEB_HOST_GNU_TYPE 
2>/dev/null)-gcc"
+       fi
+       CC="${CC_FOR_BUILD:-gcc}"
+       if [ -n "${CXX:-}" ]; then
+               CXX_FOR_TARGET="$CXX"
+       else
+               CXX_FOR_TARGET="$(dpkg-architecture -qDEB_HOST_GNU_TYPE 
2>/dev/null)-g++"
+       fi
+       CXX="${CXX_FOR_BUILD:-g++}"
+fi
+export CC
+export CC_FOR_TARGET
+export CXX
+export CXX_FOR_TARGET
+
 eval "$@"
diff --minimal -Nru golang-1.24-1.24.1/debian/rules 
golang-1.24-1.24.1/debian/rules
--- golang-1.24-1.24.1/debian/rules     2025-03-05 00:58:41.000000000 +0100
+++ golang-1.24-1.24.1/debian/rules     2025-03-13 11:38:16.000000000 +0100
@@ -20,6 +20,18 @@
 # Go 1.12 needs a build cache, otherwise the build fails.
 export GOCACHE := $(GOPATH)/gocache
 
+__goos__deb_arch_os = $(or $(filter $(1),linux),$(if $(filter 
$(1),kfreebsd),freebsd,$(error unrecognized DEB_*_ARCH_OS: $(1))))
+__goarch__deb_arch_cpu_map_i386 = 386
+__goarch__deb_arch_cpu_map_mips64el = mips64le
+__goarch__deb_arch_cpu_map_mipsel = mipsle
+__goarch__deb_arch_cpu_map_ppc64el = ppc64le
+__goarch__deb_arch_cpu = $(or $(filter $(1),amd64 arm arm64 loong64 mips ppc64 
riscv64 s390x),$(__goarch__deb_arch_cpu_map_$(1)),$(error unrecognized 
DEB_*_ARCH_CPU: $(1)))
+
+export GOHOSTOS := $(call __goos__deb_arch_os,$(DEB_BUILD_ARCH_OS))
+export GOOS := $(call __goos__deb_arch_os,$(DEB_HOST_ARCH_OS))
+export GOHOSTARCH := $(call __goarch__deb_arch_cpu,$(DEB_BUILD_ARCH_CPU))
+export GOARCH := $(call __goarch__deb_arch_cpu,$(DEB_HOST_ARCH_CPU))
+
 # source files generated during building.
 # especially zbootstrap.go has different defaultGOARM values on armhf and 
armel,
 # since the value is set from debian/helpers/goenv.sh
@@ -74,6 +86,7 @@
        dh_compress -Xusr/share/doc/golang-$(GOVER)-doc/html
 
 execute_after_dh_install-arch:
+       cp bin/$(if $(filter 
$(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)),,$(GOOS)_$(GOARCH)/)* 
debian/golang-$(GOVER)-go/usr/lib/go-$(GOVER)/bin/
        cp --parent -v $(GENERATED_FILES) 
debian/golang-$(GOVER)-go/usr/share/go-$(GOVER)/
 
 execute_after_dh_install-indep:

--- End Message ---
--- Begin Message ---
Source: golang-1.24
Source-Version: 1.24.4-2
Done: Tianon Gravi <[email protected]>

We believe that the bug you reported is fixed in the latest version of
golang-1.24, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Tianon Gravi <[email protected]> (supplier of updated golang-1.24 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Mon, 18 Aug 2025 19:36:59 -0700
Source: golang-1.24
Architecture: source
Version: 1.24.4-2
Distribution: unstable
Urgency: medium
Maintainer: Debian Go Compiler Team <[email protected]>
Changed-By: Tianon Gravi <[email protected]>
Closes: 1100436
Changes:
 golang-1.24 (1.24.4-2) unstable; urgency=medium
 .
   * Add support for cross-building natively (Closes: #1100436)
     - https://salsa.debian.org/go-team/compiler/golang/-/merge_requests/21
Checksums-Sha1:
 ad511fb697472563652485740c5989cc9dbd73c8 2923 golang-1.24_1.24.4-2.dsc
 32c79f2a09317024a02ebe38bbe56fb612b10d39 43204 
golang-1.24_1.24.4-2.debian.tar.xz
 5789dd95c357a9df69c503c7cfb5192d610b43d2 5531 
golang-1.24_1.24.4-2_source.buildinfo
Checksums-Sha256:
 ba36a0e168334924520552e34f342cd3a579b85312612c02d10588afbfbc09bf 2923 
golang-1.24_1.24.4-2.dsc
 cdb0fa7a8099a6c54b901e2f0e04825b48656b149e41f39549545e9ec68924b1 43204 
golang-1.24_1.24.4-2.debian.tar.xz
 a2de504c16113fdb4ac7e8f070fdda77da4df43057c0915cf4c4739c48b6ed3b 5531 
golang-1.24_1.24.4-2_source.buildinfo
Files:
 dcda3a5977a913b5bf006160b67be18a 2923 golang optional golang-1.24_1.24.4-2.dsc
 e1ccfbdae02db239d5bfdb56a74ab072 43204 golang optional 
golang-1.24_1.24.4-2.debian.tar.xz
 8bdb7b5c17c362bbc78f3ac4bea306a4 5531 golang optional 
golang-1.24_1.24.4-2_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJGBAEBCgAwFiEEtC9oGQB/APiONk/UA2qcJb81fdQFAmij5A0SHHRpYW5vbkBk
ZWJpYW4ub3JnAAoJEANqnCW/NX3U4jMQAJydODDZ+tKTwO0EB3NSuvTPDpB4m02+
/hnbgEr3Hfq8f1ybWTPMAi3zhi+ev6VPiZKnUxboFvRyVvZr018PfUAPxalBDSwU
W7Lj4sj0DltdJWczNt+086COR8VlSJCDpE/J1HtbLPAWK2WO7OWfHLdCBS3BYeq1
ypSCVKorl0S/X8zOiKDitbDJgCKCnRSwGBVNX0CGfewv3LY9PFf8ckvSGpA/t2VH
3z5CqncEmCUzlZE9qX73Cu1qHN5icHlrpTzfxPpPJxrS4He7ZS6KwZQiodV53TB5
LDuKxXTzIl/ZLmCsJzpWkyFd7Ts1n/qUbr776oOyCp/Ywt4itydoUXiHsEb9PFAP
FtT3D2W6fT3Ra7tzej2HCzqa8OkVVnLn6ILCGrdZfIMeU8swQ/QFHz38zbF2FazY
QTmvPMkz9ZGwCcOzkFgAZKsVp6ijvwmV3dEU3TKl/FPuGNeeCyYhYj5QrDzgemzU
plTzpAIZOPCj3nMAiB1wv7+Te67nMbu3wlOF9efbMAxvTJMRBhND6mDSfc8VojLK
/esOsWmPRX1Kz2jy171g8/uyiC9pBVuyx4Sea9zhCkMagVjYIdAxqY/YpA5TL1vq
2ZGYNSyoCyV0k7aBwqxiprAzMEUUPKRdj5rGa+VGL2pJOd31zGUejJb5Ad7moOpJ
hFDhUTGHISfH
=WFDZ
-----END PGP SIGNATURE-----

Attachment: pgpWf9FFdIK4T.pgp
Description: PGP signature


--- End Message ---

Reply via email to