Subject: bug#69913: Can't build a x86_64-w64-mingw32 cross-gcc-toolchain with GCC 13.2.0

From: Michael Ford <[email-masked]>
Date: Wed, 20 Mar 2024 11:16:05 +0000

Using the following:
(use-modules (gnu packages)
         (gnu packages cross-base)
         (gnu packages gcc)
         (guix packages))

(packages->manifest
 (append
  (list
    (cross-gcc-toolchain "x86_64-w64-mingw32"
             #:base-gcc gcc-13)
)))

and guix build -m win.scm:
<snip>
gcc-13.2.0/gotools/ChangeLog
patching file gcc/builtins.cc
Hunk #1 succeeded at 3680 (offset 317 lines).
Hunk #2 succeeded at 3753 (offset 317 lines).
patching file gcc/gimple-fold.cc
Hunk #1 succeeded at 855 (offset -1 lines).
Hunk #2 succeeded at 961 (offset -1 lines).
patching file libvtv/Makefile.in
Hunk #1 succeeded at 14 with fuzz 1 (offset -1 lines).
patching file gcc/gcc.cc
Hunk #1 succeeded at 4796 (offset -36 lines).
patching file gcc/incpath.cc
patching file gcc/system.h
Hunk #1 succeeded at 1331 (offset 14 lines).
patching file gcc/configure
Hunk #1 succeeded at 3723 (offset 34 lines).
Hunk #2 succeeded at 3734 (offset 34 lines).
patching file gcc/configure.ac
Hunk #1 succeeded at 205 (offset 1 line).
Hunk #2 succeeded at 216 (offset 1 line).
patching file libgcc/config/i386/gthr-win32.h
Hunk #1 FAILED at 30.
1 out of 1 hunk FAILED -- saving rejects to file
libgcc/config/i386/gthr-win32.h.rej
source is at 'gcc-13.2.0'
applying '/gnu/store/5pdqk0wql3kzjn2j6p3q7gklypd3al8j-gcc-12-strmov-store-file-names.patch'...
applying '/gnu/store/5705r4ajxl8lav1hz9xm19w75zdcz1n2-gcc-5.0-libvtv-runpath.patch'...
applying '/gnu/store/glaf2kjf5mm120whv5vgdsqzqb623hcj-gcc-12-cross-environment-variables.patch'...
applying '/gnu/store/d7zmb04ikykxz6yflzch09a05hw3my4i-gcc-cross-gxx-include-dir.patch'...
applying '/gnu/store/avcc737afnm0a27cqkh8ng9ynm65bj52-gcc-4.9.3-mingw-gthr-default.patch'...
Backtrace:
           5 (primitive-load "/gnu/store/l9nb00czkbyhm3swms9ic2s9s4n…")
In ice-9/eval.scm:
    619:8  4 (_ #(#(#<directory (guile-user) fffff780ec80> "gcc…") #))
In ice-9/boot-9.scm:
    142:2  3 (dynamic-wind #<procedure fffff1e9c560 at ice-9/eval.s…> …)
In ice-9/eval.scm:
    619:8  2 (_ #(#(#<directory (guile-user) fffff780ec80>)))
In srfi/srfi-1.scm:
    634:9  1 (for-each #<procedure apply-patch (a)> _)
In guix/build/utils.scm:
    812:6  0 (invoke "/gnu/store/10dp5a06lqg5kcbl77wdl2sfhrjchagk-p…" …)

guix/build/utils.scm:812:6: In procedure invoke:
ERROR:
  1. &invoke-error:
      program: "/gnu/store/10dp5a06lqg5kcbl77wdl2sfhrjchagk-patch-2.7.6/bin/patch"
      arguments: ("--force" "--no-backup-if-mismatch" "-p1" "--input"
"/gnu/store/avcc737afnm0a27cqkh8ng9ynm65bj52-gcc-4.9.3-mingw-gthr-default.patch")
      exit-status: 1
      term-signal: #f
      stop-signal: #f
builder for `/gnu/store/bldkldr4dyqzqxaj5g6m7ky1vhz21k64-gcc-13.2.0.tar.xz.drv'
failed with exit code 1
build of /gnu/store/bldkldr4dyqzqxaj5g6m7ky1vhz21k64-gcc-13.2.0.tar.xz.drv
failed
View build log at
'/var/log/guix/drvs/bl/dkldr4dyqzqxaj5g6m7ky1vhz21k64-gcc-13.2.0.tar.xz.drv.gz'.
cannot build derivation
`/gnu/store/j3wi93aslij4h3cxbnc3x0bkcls9ndnq-gcc-cross-sans-libc-x86_64-w64-mingw32-13.2.0.drv':
1 dependencies couldn't be built
cannot build derivation
`/gnu/store/aki7kddfrk8nilxyahw1k2rn19dlm04y-gcc-cross-x86_64-w64-mingw32-13.2.0.drv':
1 dependencies couldn't be built
cannot build derivation
`/gnu/store/flg0pak45286lmz6bl8iczym5ny9ifgm-gcc-cross-x86_64-w64-mingw32-toolchain-13.2.0.drv':
1 dependencies couldn't be built
guix build: error: build of
`/gnu/store/flg0pak45286lmz6bl8iczym5ny9ifgm-gcc-cross-x86_64-w64-mingw32-toolchain-13.2.0.drv'
failed

guix --version
guix (GNU Guix) b7eb1a8116b2caee7acf26fb963ae998fbdb4253
Copyright (C) 2024 the Guix authors
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.