GNU bug report logs - #47869
[PATCH core-updates] ‘which’ looks in PATH, incorrect when cross-compiling

Previous Next

Package: guix-patches;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Sun, 18 Apr 2021 12:14:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Maxime Devos <maximedevos <at> telenet.be>
To: 47869 <at> debbugs.gnu.org
Subject: [bug#47869] [PATCH v3 core-updates] various cross-compilation fixes in guix/build/utils.scm
Date: Tue, 01 Jun 2021 21:53:17 +0200
[Message part 1 (text/plain, inline)]
Hi guix,

This is version three of the patch series,
which (no pun intended) incorporates feedback
from Ludovic Courtès.

This version adds a 'search-input-file' procedure
to (guix build utils). It is used like:

  (wrap-script something #:guile
    (search-input-file inputs "bin/guile")
    [...])

Explicitely setting #:guile instead of defaulting
to (which "guile") is required for cross-compilation,
to make sure the guile eventually used is compiled for
the correct architecture.

This patch series also extends 'wrap-program' with
a #:sh keyword argument, which has the same purpose
as #:guile for 'wrap-script'.

Some differences to v2:

  * The #:sh and #:guile arguments are optional.
    The default value should be good when compiling natively,
    but not when cross-compiling.

    Eventually, we may look into making them required,
    but let's pun for later.

  * I left 'wrap-qt-program' alone for now.

  * I left documenting 'wrap-program' and 'wrap-script' for later.

  * I didn't adjust all uses of wrap-program to set #:sh,
    only a few.

For testing wrap-program:
Write to "a.sh":

  #!/stuff/etcetera
  echo "hello world!"

From ./pre-inst-env guix repl, do:

  (use-modules (guix build utils))
  (wrap-program "a.sh" #:sh "/bin/sh" '("PATH" = ("stuff")))

Now look at "a.sh":

  #!/bin/sh
  export PATH="stuff"
  exec -a "$0" "[current working directory]/.a.sh-real" "$@"

There are some tests in tests/build-utils.scm for 'search-input-file'.

I also ran "make && ./pre-inst-env guix build hello wireguard-tools".
(Not sure about which packages I tested actually.) This successfully
built "hello" (and all its dependencies, this can take a lot of time!).

Building wireguard-tools failed at first. It turned out I made a mistake
in 'wrap-program': the following ...

  (define vars/filtered
    (match vars
      ((#:sh . vars) vars)
      (vars vars)))

... should have been ...

 (define vars/filtered
    (match vars
      ((#:sh _ . vars) vars)
      (vars vars)))

That has been corrected. I tested the corrected "wrap-program" in a REPL
as above, but haven't tried building wireguard-tools again (that would
entail doing the whole bootstrapping process again).

This patch series is on top of commit 9ba35475ede5eb61bfeead096bc6b73f123ac891
on core-updates.

Greetings,
Maxime.
[0001-build-Allow-overriding-the-shell-interpreter-in-wrap.patch (text/x-patch, attachment)]
[0002-build-Define-search-input-file-procedure.patch (text/x-patch, attachment)]
[0003-glib-or-gtk-build-system-Look-up-the-interpreter-in-.patch (text/x-patch, attachment)]
[0004-python-build-system-Look-up-the-interpreter-in-input.patch (text/x-patch, attachment)]
[0005-qt-build-system-Look-up-the-interpreter-in-inputs.patch (text/x-patch, attachment)]
[0006-rakudo-build-system-Look-up-the-interpreter-in-input.patch (text/x-patch, attachment)]
[0007-gnu-carla-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0008-gnu-bats-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0009-gnu-proteinortho-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0010-gnu-prinseq-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0011-gnu-gess-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0012-gnu-nanopolish-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0013-gnu-sieve-connect-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0014-gnu-clipmenu-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0015-gnu-vpnc-scripts-Set-guile-argument-of-wrap-script.patch (text/x-patch, attachment)]
[0016-gnu-openconnect-sso-Set-sh-argument-of-wrap-program.patch (text/x-patch, attachment)]
[0017-gnu-protonvpn-cli-Set-sh-argument-of-wrap-program.patch (text/x-patch, attachment)]
[0018-gnu-wireguard-tools-Set-sh-argument-of-wrap-program.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 4 years and 48 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.