From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 10:51:06 2021 Received: (at 47869) by debbugs.gnu.org; 29 May 2021 14:51:06 +0000 Received: from localhost ([127.0.0.1]:57533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln0Ir-0006Zg-SJ for submit@debbugs.gnu.org; Sat, 29 May 2021 10:51:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln0In-0006Z6-KL for 47869@debbugs.gnu.org; Sat, 29 May 2021 10:51:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45066) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ln0Ii-0001gS-6j; Sat, 29 May 2021 10:50:56 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=40280 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ln0Ih-00071U-D1; Sat, 29 May 2021 10:50:55 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: bug#47869: [PATCH core-updates] =?utf-8?B?4oCYd2hpY2jigJk=?= looks in PATH, incorrect when cross-compiling References: <0892bdfbc097b07631190c8526a41d57b456d343.camel@telenet.be> <87v97f7oll.fsf_-_@gnu.org> <343ead490dec84fec8694d2411963d3a80d27166.camel@telenet.be> Date: Sat, 29 May 2021 16:50:53 +0200 In-Reply-To: <343ead490dec84fec8694d2411963d3a80d27166.camel@telenet.be> (Maxime Devos's message of "Tue, 18 May 2021 23:25:28 +0200") Message-ID: <87wnrha90y.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47869 Cc: 47869@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Maxime, Maxime Devos skribis: > Ludovic Court=C3=A8s schreef op di 18-05-2021 om 22:51 [+0200]: [...] >> The =E2=80=9Ccorrect=E2=80=9D way we do it right now is like >> this: >>=20 >> (lambda* (#:key outputs inputs #:allow-other-keys) >> (let ((out (assoc-ref outputs "out")) >> (curl (assoc-ref inputs "curl"))) >> (wrap-program (string-append out "/bin/akku") >> `("LD_LIBRARY_PATH" ":" prefix (,(string-append curl "/lib= ")))) >> #t)) >>=20 >> Here, when cross-compiling, (assoc-ref inputs "curl") returns the target >> cURL. > > This is something that can be fixed on 'core-updates', right? Yes, it=E2=80=99s a good time for this! For now, we can even afford world rebuilds on =E2=80=98core-updates=E2=80=99. >> > From e78d2d8651d5f56afa7d57be78c5cccccebb117a Mon Sep 17 00:00:00 2001 >> > From: Maxime Devos >> > Date: Sun, 18 Apr 2021 20:44:28 +0200 >> > Subject: [PATCH 3/7] build: utils: Make inputs of 'wrap-script' explic= it. >> >=20 >> > Previously, 'wrap-script' used (which "guile") to determine where to l= ocate >> > the guile interpreter. But this is incorrect when cross-compiling. W= hen >> > cross-compiling, this would locate the (native) guile interpreter that= is >> > in the PATH, while a guile interpreter for the target is required. >> >=20 >> > Remove the optional #:guile argument which is only used in tests and r= eplace >> > it with a required 'inputs' argument and adjust all callers. Write a = new >> > test verifying a guile for the target is located, instead of a native = guile. >>=20 >> I think the #:guile argument was a fine interface: clear and >> to-the-point. The problem IMO is just that it=E2=80=99s not use where it >> should. :-) > > It should be used practically everywhere, no? So making it optional doesn= 't > make much sense to me when we want to support cross-compilation. Yes, and I agree that=E2=80=99s a difficulty. >> > (add-after 'install 'wrap-executables >> > - (lambda* (#:key outputs #:allow-other-keys) >> > + (lambda* (#:key inputs outputs #:allow-other-keys) >> > (let ((out (assoc-ref outputs "out"))) >> > - (wrap-script (string-append out "/bin/carla") >> > + (wrap-script (string-append out "/bin/carla") inputs >> > `("GUIX_PYTHONPATH" ":" prefix (,(getenv = "GUIX_PYTHONPATH")))) >>=20 >> This would become: >>=20 >> (wrap-script (string-append out "/bin/carla") >> `(=E2=80=A6) >> #:guile (assoc-ref inputs "guile")) >> >> WDYT? > > Ok, this looks a good interface to me, though I think > 'wrap-script' will need to be modified. IIRC, #:guile > must be the full file name of the guile binary and not > simply /gnu/store/[...]-guile-$VERSION. Good point. I think one could write: (wrap-script =E2=80=A6 #:guile (search-input-file inputs "/bin/guile")) which is more reasonable. > That should help with the verbosity. The previous code becomes > > (wrap-program (string-append libexec "/dhclient-script") > `("PATH" =E2=80=A6) > #:sh (search-input-file inputs "bin/sh")) > > which isn't overly verbose. > > This procedure 'search-input-file' would return #f if the input > was not found, right? I would rather it raises an exception instead. > There have been some bugs where "#f" was silently written into some file, > which is unlikely to work well. Agreed, let=E2=80=99s have =E2=80=98search-input-file=E2=80=99 raise an exc= eption if the file isn=E2=80=99t found. > For the few cases were the input binary is truly optional, > we can define a 'search-optional-input-file' procedure. Let=E2=80=99s ignore that until the problem shows up. >> > -@c TODO document wrap-program >> > +@deffn {Scheme Procedure} wrap-program @var{prog} @var{inputs} @var{v= ars} >> > +Make a wrapper for @var{prog}. @var{vars} should look like this: >> > + >> > +@lisp >> > + '(VARIABLE DELIMITER POSITION LIST-OF-DIRECTORIES) >> ^ >> You can remove indentation and use @var instead of capital letters. > > @var can be used inside @lisp? Didn't know that. Yes. Sorry for the delay, and thanks again! Ludo=E2=80=99.