unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Thiago Jung Bauermann via Guix-patches via <guix-patches@gnu.org>
To: 49565@debbugs.gnu.org
Cc: Maxime Devos <maximedevos@telenet.be>,
	Thiago Jung Bauermann <bauermann@kolabnow.com>
Subject: [bug#49565] [PATCH core-updates v2] gnu: bootstrap: Use %current-target-system to decide bootstrap path
Date: Mon, 19 Jul 2021 21:01:33 -0300	[thread overview]
Message-ID: <20210720000133.1619640-1-bauermann@kolabnow.com> (raw)
In-Reply-To: <27e26df84bc02d681b1ff0904bdd63dfa80313bf.camel@telenet.be>

When cross-building a non-x86 gcc-toolchain on an x86 machine,
‘%current-target’ has the x86 system value and Guix tries to use the
mesboot packages for the bootstrap – which don’t work because they’re
currently x86-only.

So introduce the ‘current-target-nix-system’ procedure which looks at
‘%current-target-system’ first (converting it to a Nix system string) and
use it to decide the bootstrap path. The procedure is factored out from
‘glibc-dynamic-linker’.

Also use it in ‘package-from-tarball’, which needs to take the target
system into account as well – thanks to Maxime Devos for pointing it out.

* gnu/packages/bootstrap.scm (package-from-tarball): Pass result of
‘current-target-nix-system’ to ‘source’ procedure.
(glibc-dynamic-linker): Use result of ‘current-target-nix-system’ as
default value for ‘system’ argument.
(%bootstrap-inputs): Use ‘current-target-nix-system’ to decide whether to
use the mesboot path.
* gnu/packages/commencement.scm (%bootstrap-inputs+toolchain): Likewise.
* guix/utils.scm (current-target-nix-system): Define.
---
 gnu/packages/bootstrap.scm    | 8 +++-----
 gnu/packages/commencement.scm | 2 +-
 guix/utils.scm                | 7 +++++++
 3 files changed, 11 insertions(+), 6 deletions(-)

Hi,

This is the new version of this patch. Thank you Maxime Devos for reviewing the
previous version and pointing out the change needed in ‘package-from-tarball’.

This version makes that change, and also defines a helper function in
`(guix utils)` which returns the Nix system identifier for the current target
– regardless of whether we are cross-building or not.

Before the patch, these are the derivations that Guix tries to build when
cross-compiling gcc-toolchain@11. Note the ‘mesboot’ packages:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build --target=powerpc64le-linux-gnu gcc-toolchain@11
substitute: atualizando substitutos de "https://ci.guix.gnu.org"... 100.0%
substitute: atualizando substitutos de "https://bordeaux.guix.gnu.org"... 100.0%
The following derivations will be built:
   /gnu/store/3hrzq7fxj0cxgxkjybki2yi7dj70sgg8-gcc-toolchain-11.1.0.drv
   /gnu/store/2xpiffvzzizrjx48ghqac3rgh1cnljv7-linux-libre-headers-5.10.35.drv
   /gnu/store/4xlm78m6wl56gn4gpifvy8721amhi81j-binutils-2.36.1.drv
   /gnu/store/05lnycy4lmn0768r41sgikg795zk9mqg-binutils-cross-boot0-2.36.1.drv
   /gnu/store/1q62fcaj2gc9mnwvv6cicch6gc7qrnp0-binutils-mesboot-2.20.1a.drv
   /gnu/store/1yjrfb846y1mnc7mgab38jbv7pv0hgbh-tar-boot0-1.34.drv
   /gnu/store/9c7a2p899ivz16636prf44q0q61i4376-patch-mesboot-2.5.9.drv
   /gnu/store/9rmnv55i966wfkx0di4h6p8197hy2836-grep-mesboot-2.0.drv
   /gnu/store/advn8cgpcf9fi6424l8bs16r5mvfqs04-gcc-mesboot-wrapper-4.9.4.drv
   /gnu/store/bpghw1m585q2wjc0z4in9w0hcpxgiidw-gzip-mesboot-1.2.4.drv
   /gnu/store/bx9lr1bg5491dc9i5p2b6zgsq0ahajxb-gcc-mesboot-4.9.4.drv
   /gnu/store/dfijxa9mnlymzmsl571qlxx0qc65kxzi-tar-mesboot-1.22.drv
   /gnu/store/hp2f5sw9d189p7z930b63wr8k3j9k6j0-coreutils-mesboot-8.32.drv
   /gnu/store/i584nxkb39n67vzq5r3yh6spqppzrj43-bzip2-mesboot-1.0.8.drv
   /gnu/store/j1accym68y6l8pxz8095jpkwgp3ciphi-gawk-mesboot-3.1.8.drv
   /gnu/store/jlwyxh3k6hvpmy60g0ygwnncq66kn590-gash-utils-boot-0.1.0.drv
   /gnu/store/9mxvccmf0b8fwq0k7lw0ndsdsbz9y8vn-gash-boot-0.2.0.drv
   /gnu/store/p43yklj8d615y68jhcvycg9i3k3bqj2g-xz-mesboot-5.0.0.drv
   /gnu/store/rxn5c166a6p0p3y2hlyk67f91a504kfa-make-mesboot-3.82.drv
   /gnu/store/sgwdni3iwwrb4ahsnwm43528fzr5csiv-sed-mesboot-4.0.6.drv
   /gnu/store/xxaccspqlg90v3cxrbvslva6s8gwxzi9-make-boot0-4.3.drv
   /gnu/store/zghmr1xyw5ip3wpi1qw2ysc7p6i75d54-glibc-mesboot-2.16.0.drv
   /gnu/store/64cway6pvw5fk7csym2k9i77rhp1pl46-coreutils-boot0-8.32.drv
   /gnu/store/7hvyky0i1hf3xbd698rr305br881pwz6-diffutils-boot0-3.7.drv
   /gnu/store/hq1lijdac3vqx811jzsg0wizsbgwgpaa-gawk-boot0-5.1.0.drv
   /gnu/store/i173n23qpssi7idck4jn7399bfkldlfs-sed-boot0-4.8.drv
   /gnu/store/l8kbhm6m9rbwkxn7zv1d06wbl2gi88wp-findutils-boot0-4.8.0.drv
   /gnu/store/pfq7g9jx16jlk3829312h88n0k1jnfns-patch-boot0-2.7.6.drv
   /gnu/store/qp3yg441ybh6bv44lrcxyp6rzyf0djii-file-boot0-5.39.drv
   /gnu/store/x4m7lff1ps5mas719815d54x6x1zwcv3-bzip2-boot0-1.0.8.drv
   /gnu/store/h5hwcnr7z57hb9b8bhhx7s22kfawqr0d-ld-wrapper-boot0-0.drv
   /gnu/store/v9p5fm974mj4d99vdpp9dhrvpwd4kfgs-glibc-2.33.drv
   /gnu/store/0kjyjcxzk5mv6zm86x8f18sbsb9m48k8-bash-static-5.1.8.drv
   /gnu/store/6h220skb9ak8ppv5417i8cbry1byv73a-glibc-intermediate-2.33.drv
   /gnu/store/rwczga96661d70jcqds8w8pr5s084mh4-gcc-cross-boot0-10.3.0.drv
   /gnu/store/cglgsds6hxy9swdyymgam9l3rfwizyfr-libstdc++-boot0-4.9.4.drv
   /gnu/store/c63lqgh0x2rx1az0ds4b2ma9vgiry31j-gcc-11.1.0.drv
   /gnu/store/f4fwnxsha5h2pk750r2p09cnhbhc3nm3-ld-wrapper-0.drv
   /gnu/store/605p0jq8wv879n3y6fbqxvaiww1kjaql-libunistring-0.9.10.drv
   /gnu/store/5irbp0c5zzvs50wlznpfxcxr8mfndwy9-gcc-10.3.0.drv
   /gnu/store/byfbnlkwj9pjwnkx69fi2ycnqdvz2znv-ld-wrapper-boot3-0.drv
   /gnu/store/fbm3gv13nggw2qcvxmlccqgi0izzgdwn-libstdc++-10.3.0.drv
   /gnu/store/vhwmw9p8l3sysqlm8bh14xkfw1afqqcj-zlib-1.2.11.drv
   /gnu/store/60jiv5k1lg2krj3b0f9x7f26ywrda0mw-bash-minimal-5.1.8.drv
   /gnu/store/i0lk6zd2vwqqlhn8kkf0529x896lnzr1-guile-3.0.7.drv
   /gnu/store/r25wjwjbb13yk8yc4bm77dxxcq9qvx9y-libatomic-ops-7.6.10.drv
   /gnu/store/ry3zxxjsnhpdphvnnr991x9yk7gljxy9-libffi-3.3.drv
   /gnu/store/y26kx37mkidni8jj4sjn0ryy1wq1pqvs-libgc-8.0.4.drv
   /gnu/store/v9p5fm974mj4d99vdpp9dhrvpwd4kfgs-glibc-2.33.drv
--8<---------------cut here---------------end--------------->8---

These are the derivations built after the patch is applied. Note that there
is no ‘mesboot’ package:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build --target=powerpc64le-linux-gnu gcc-toolchain@11
substitute: atualizando substitutos de "https://ci.guix.gnu.org"... 100.0%
substitute: atualizando substitutos de "https://bordeaux.guix.gnu.org"... 100.0%
The following derivations will be built:
   /gnu/store/wnllxi9hz868ymmhl9y1izry825azal7-gcc-toolchain-11.1.0.drv
   /gnu/store/3mzbrsijxql7np8zzgs5z6svl4iw3si8-ld-wrapper-0.drv
   /gnu/store/2qbrgj46x4ywkl5icxl13iqalzy1y464-libgc-8.0.4.drv
   /gnu/store/0d3sx0dvn32afifnhsz28yvf9p8shh49-findutils-boot0-4.8.0.drv
   /gnu/store/c497lf15zqz2xx75idh091sp4i3il5zh-make-boot0-4.3.drv
   /gnu/store/dnycxgnzfpj1vc8aaxgnb4gj1m8cv2fa-diffutils-boot0-3.7.drv
   /gnu/store/11z204mvwgimbwifvwd7di76k49kwh1n-tar-boot0-1.34.drv
   /gnu/store/2ykvg2wms8f5bqgqn0fw28grssmkx43f-libatomic-ops-7.6.10.drv
   /gnu/store/3lyp33ib5v3zmykgk53m3plmm7n122j0-file-boot0-5.39.drv
   /gnu/store/4942syn0qn16cg97x27l26rddv5pf297-gawk-boot0-5.1.0.drv
   /gnu/store/5jzrc7l0yjd3wagbfkgdb29jb7cxl97i-bash-minimal-5.1.8.drv
   /gnu/store/7ivfiaav5af41jcpij0lg8ig2vhl46cz-patch-boot0-2.7.6.drv
   /gnu/store/975bjay86c67q0agahxjbalbphd6i2dn-ld-wrapper-boot0-0.drv
   /gnu/store/gbzc67364szqynv0k8ncgvb4r9v0s8gl-binutils-cross-boot0-2.36.1.drv
   /gnu/store/aa1pb63rgm7mgmljq4nqxw5dxlgf1x0k-coreutils-boot0-8.32.drv
   /gnu/store/i33n2m4883668c26kfbcn4r6k5mb6i3q-bzip2-boot0-1.0.8.drv
   /gnu/store/rdigl19v5302arib6i0ic2nhdl8588yv-sed-boot0-4.8.drv
   /gnu/store/d407z0m02m85hbrgf6c0bbvbc72v9wp8-gcc-10.3.0.drv
   /gnu/store/6qy66x2s6izvkiggild5bwi7b1p3i14c-zlib-1.2.11.drv
   /gnu/store/rfji2zr6yicw3vjcksjzk7zc7hxmh0pa-glibc-2.33.drv
   /gnu/store/1knbpbymgj1rggdlkdpz2k9i2sh1hjwk-bash-static-5.1.8.drv
   /gnu/store/05667q3f8yl7fbny1sxkli66rcl8gyrf-glibc-intermediate-2.33.drv
   /gnu/store/5lmmwvhf8gjzw31a0fv7gkl9zcaj76r6-gcc-cross-boot0-10.3.0.drv
   /gnu/store/wkmp9i5il6afhrn6d3lkzf7wminx6rax-libstdc++-boot0-4.9.4.drv
   /gnu/store/b2bjf70ks7f55z1ady9ng34m7iyk8w5a-binutils-2.36.1.drv
   /gnu/store/dqgshra3sbikll475m95slnyqzkmagsn-libstdc++-10.3.0.drv
   /gnu/store/fr2q75l4rdymmcy6wdmjc560vn4l7lxi-ld-wrapper-boot3-0.drv
   /gnu/store/c7i6v0w124ckyvb6pizbg4fqhgwf6gi5-guile-3.0.7.drv
   /gnu/store/ar81shvadvhzkyq4ygln66gpy7xrvjy4-libffi-3.3.drv
   /gnu/store/w8p9y4llj6a91blrf574yjns09vbnkbl-libunistring-0.9.10.drv
   /gnu/store/c63lqgh0x2rx1az0ds4b2ma9vgiry31j-gcc-11.1.0.drv
   /gnu/store/rfji2zr6yicw3vjcksjzk7zc7hxmh0pa-glibc-2.33.drv
--8<---------------cut here---------------end--------------->8---

This is all on today's core-updates branch, at commit:

db5962c68099 gnu: ghostscript: Improve reproducibility of PDF document generation

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 5a8028a4652c..d1493e4c7ec7 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -266,7 +266,7 @@ or false to signal an error."
     (inputs
      `(("tar" ,(bootstrap-executable "tar" (%current-system)))
        ("xz"  ,(bootstrap-executable "xz" (%current-system)))
-       ("tarball" ,(bootstrap-origin (source (%current-system))))))
+       ("tarball" ,(bootstrap-origin (source (current-target-nix-system))))))
     (source #f)
     (synopsis description)
     (description description)
@@ -299,9 +299,7 @@ or false to signal an error."
                                  package-with-bootstrap-guile)))))
 
 (define* (glibc-dynamic-linker
-          #:optional (system (or (and=> (%current-target-system)
-                                        gnu-triplet->nix-system)
-                                 (%current-system))))
+          #:optional (system (current-target-nix-system)))
   "Return the name of Glibc's dynamic linker for SYSTEM."
   ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
   (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
@@ -927,7 +925,7 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
 (define (%bootstrap-inputs)
   ;; The initial, pre-built inputs.  From now on, we can start building our
   ;; own packages.
-  (match (%current-system)
+  (match (current-target-nix-system)
     ((or "i686-linux" "x86_64-linux")
      `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
        ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index a04bb83c3d2d..030dfad970a7 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2396,7 +2396,7 @@ exec " gcc "/bin/" program
 (define (%bootstrap-inputs+toolchain)
   ;; The traditional bootstrap-inputs.  For the i686-linux, x86_64-linux
   ;; Scheme-only bootstrap the actual reduced set with bootstrapped toolchain.
-  (match (%current-system)
+  (match (current-target-nix-system)
     ((or "i686-linux" "x86_64-linux")
      (%boot-mesboot6-inputs))
     (_
diff --git a/guix/utils.scm b/guix/utils.scm
index c5a3a52f9dbc..0d438a00ce00 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -85,6 +85,7 @@
             gnu-triplet->nix-system
             %current-system
             %current-target-system
+            current-target-nix-system
             package-name->name+version
             target-linux?
             target-hurd?
@@ -630,6 +631,12 @@ returned by `config.guess'."
   ;; cross-building to.
   (make-parameter #f))
 
+(define (current-target-nix-system)
+  "Return the Nix system identifier for the current target, whether we are
+cross-building or not."
+  (or (and=> (%current-target-system) gnu-triplet->nix-system)
+      (%current-system)))
+
 (define* (package-name->name+version spec
                                      #:optional (delimiter #\@))
   "Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"




  parent reply	other threads:[~2021-07-20  0:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15  0:46 [bug#49565] [PATCH] gnu: glibc-headers-mesboot: Use %build-inputs in setenv phase Thiago Jung Bauermann via Guix-patches via
2021-07-15  2:04 ` Thiago Jung Bauermann via Guix-patches via
2021-07-15 12:58 ` Maxime Devos
2021-07-15 15:03   ` Thiago Jung Bauermann via Guix-patches via
2021-07-15 16:00     ` Maxime Devos
2021-07-15 17:02       ` Thiago Jung Bauermann via Guix-patches via
2021-07-16  1:31 ` [bug#49565] [PATCH core-updates] gnu: bootstrap: Use %current-target-system to decide bootstrap path Thiago Jung Bauermann via Guix-patches via
2021-07-16  8:20   ` Maxime Devos
2021-07-16 20:01     ` Thiago Jung Bauermann via Guix-patches via
2021-07-18 16:10       ` Maxime Devos
2021-07-18 16:45         ` Thiago Jung Bauermann via Guix-patches via
2021-07-20  0:01     ` Thiago Jung Bauermann via Guix-patches via [this message]
2021-07-20 13:16       ` [bug#49565] [PATCH core-updates v2] " Thiago Jung Bauermann via Guix-patches via
2021-07-21 20:30         ` Thiago Jung Bauermann via Guix-patches via
2021-07-21 22:01           ` [bug#49565] [PATCH] gnu: glibc-headers-mesboot: Use %build-inputs in setenv phase Ludovic Courtès
2021-07-22  0:32             ` Thiago Jung Bauermann via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210720000133.1619640-1-bauermann@kolabnow.com \
    --to=guix-patches@gnu.org \
    --cc=49565@debbugs.gnu.org \
    --cc=bauermann@kolabnow.com \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).