guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 71dc089411718af7d28174eb54d6253ab1f59093
Author: Dariqq <[email protected]>
AuthorDate: Mon Feb 23 09:38:15 2026 +0000

    gnu: cross-binutils: make windres find gcc for mingw.
    
    * gnu/packages/cross-base.scm (cross-binutils*): Add patch for mingw 
targets.
    * gnu/packages/patches/binutils-cross-windres.patch: New patch.
    * gnu/local.mk (dis_patch_DATA): Register patch.
    
    Change-Id: I5e7a53a02dccc9eadef539b0e4566c05791872cd
    Signed-off-by: Ludovic Courtès <[email protected]>
    Merges: #6642
---
 gnu/local.mk                                      |  1 +
 gnu/packages/cross-base.scm                       |  4 ++-
 gnu/packages/patches/binutils-cross-windres.patch | 31 +++++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 59de6a1649..4a1ce2d324 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1057,6 +1057,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/beignet-correct-file-names.patch                \
   %D%/packages/patches/bidiv-update-fribidi.patch              \
   %D%/packages/patches/binutils-boot-2.20.1a.patch             \
+  %D%/packages/patches/binutils-cross-windres.patch            \
   %D%/packages/patches/binutils-loongson-workaround.patch      \
   %D%/packages/patches/binutils-mingw-w64-deterministic.patch  \
   %D%/packages/patches/binutils-2.41-fix-cross.patch           \
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 4f7ec84f01..cbabc0517e 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -146,7 +146,9 @@
                     ;; TODO: This seems like a deeper problem that warrants
                     ;; deeper investigation.
                     binutils "--enable-compressed-debug-sections" "no")
-                   (search-patches "binutils-mingw-w64-deterministic.patch")))
+                   (search-patches
+                    "binutils-cross-windres.patch"
+                    "binutils-mingw-w64-deterministic.patch")))
                  (else binutils))
            target)))
 
diff --git a/gnu/packages/patches/binutils-cross-windres.patch 
b/gnu/packages/patches/binutils-cross-windres.patch
new file mode 100644
index 0000000000..fc9344ce31
--- /dev/null
+++ b/gnu/packages/patches/binutils-cross-windres.patch
@@ -0,0 +1,31 @@
+windres currently looks for gcc in this order:
+
+* target-prefixed gcc in same directory as windres
+* gcc in same directory as windres
+* gcc in PATH
+
+In case of cross compiling the unprefixed gcc is a native compiler
+and probably the wrong choice.
+
+This adds another option to look for a target-prefixed gcc in PATH
+in case binutils and gcc are installed in different prefixes.
+
+Index: binutils-2.44/binutils/resrc.c
+===================================================================
+--- binutils-2.44.orig/binutils/resrc.c
++++ binutils-2.44/binutils/resrc.c
+@@ -535,6 +535,14 @@ read_rc_file (const char *filename, cons
+                                      preprocargs, filename);
+       }
+ 
++      if (slash && dash && (dash > slash) && ! cpp_pipe)
++      {
++        /* Try prefixed gcc with the same prefix as windres */
++
++        cpp_pipe = look_for_default (cmd, slash + 1, dash - (slash + 1) + 1,
++                                     preprocargs, filename);
++      }
++
+       if (! cpp_pipe)
+       {
+         /* Sigh, try the default */

Reply via email to