• Bug#1100436: golang-1.24 FTCBFS: multiple reasons

    From Helmut Grohne@21:1/5 to All on Thu Mar 13 22:50:01 2025
    Source: golang-1.24
    Version: 1.24.1-1
    Tags: patch
    User: debian-cross@lists.debian.org
    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 <helmut@subdivi.de> 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: d