Maxime Devos schreef op di 08-06-2021 om 10:41 [+0200]:
> I tested this on 683eb7c5b118440001b89944563603a39fc2ac05.
> The problem does not occur on master.
> 
> How to reproduce:
> 
>   # --target=aarch64-linux-gnu also fails, but that's another issue
>   ./pre-inst-env guix build --target=i686-linux-gnu hello --keep-failed

I have found a solution: passing --with-slibdir to GCC's configure
script. Not sure if that's the proper solution though. GNU Hello
now builds succesfully! I'll test with a few more packages later
and then ‘formally’ submit the patch (after writing a commit message).

Greetings,
Maxime.
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 9487ac9238..6e64450b13 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2019, 2020, 2021 Marius Bakke <[email protected]>
 ;;; Copyright © 2019 Carl Dong <[email protected]>
 ;;; Copyright © 2020 Mathieu Othacehe <[email protected]>
+;;; Copyright © 2021 Maxime Devos <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -169,12 +170,23 @@ base compiler and using LIBC (which may be either a libc package or #f.)"
                                 ))
 
                        ;; Install cross-built libraries such as libgcc_s.so in
-                       ;; the "lib" output.
+                       ;; the "lib" output. (But see below.)
                        ,@(if libc
                              `((string-append "--with-toolexeclibdir="
                                               (assoc-ref %outputs "lib")
                                               "/" ,target "/lib"))
                              '())
+                       ;; At least for GCC 8.0, libgcc_s.so and libstdc++.so
+                       ;; are not installed in the location specified in
+                       ;; --with-toolexeclibdir so GCC will not find it
+                       ;; when cross-compiling, say, GNU Hello.
+                       ;;
+                       ;; Work-around by specifying slibdir.
+                       ,@(if (and libc (version>=? (package-version xgcc) "8.0"))
+                             `((string-append "--with-slibdir="
+                                              (assoc-ref %outputs "lib")
+                                              "/" ,target "/lib"))
+                             '())
                        ;; For a newlib (non-glibc) target
                        ,@(if (cross-newlib? target)
                              '("--with-newlib")

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to