From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: Cross-compilation broken on canonical packages. Date: Mon, 30 Dec 2019 19:48:13 +0100 Message-ID: <87y2ut645u.fsf@gnu.org> References: <878snff7pv.fsf@gmail.com> <877e2zf7kv.fsf@gmail.com> <871rt0ntvy.fsf@gnu.org> <87fthc9vav.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:43209) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1im05R-0004Ed-9t for guix-devel@gnu.org; Mon, 30 Dec 2019 13:48:19 -0500 In-Reply-To: <87fthc9vav.fsf@gmail.com> (Mathieu Othacehe's message of "Sun, 22 Dec 2019 17:31:04 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Mathieu Othacehe Cc: guix-devel@gnu.org Hi, Mathieu Othacehe skribis: >> This is expected: packages in =E2=80=98%final-inputs=E2=80=99 (those ret= urned by >> =E2=80=98canonical-package=E2=80=99) are rooted in the bootstrap graph a= nd cannot be >> cross-compiled. > > Looking at canonical-package in (gnu packages commencement), I see that > there's already a switch on (%current-target-system). The given package > is directly returned if (%current-target-system) is set, which appears > to be what we want! > > ;; In general we want CANON, except if we're cross-compiling: CA= NON > ;; uses explicit inputs, so it is "anchored" in the bootstrapped > ;; process, with dependencies on things that cannot be > ;; cross-compiled. > (if (%current-target-system) > package > canon)) > > > But, this doesn't work as expected. I guess it is because of > (%current-target-system) evaluation time. Ah yeah. The hack works when you use =E2=80=98canonical-package=E2=80=99 i= n a package input, because package input fields are =E2=80=9Cthunked=E2=80=9D, so they= =E2=80=99re evaluated in a dynamic context where =E2=80=98%current-target-system=E2=80=99 has the= right value. =20=20 However, the hack doesn=E2=80=99t work for things like the =E2=80=98package= s=E2=80=99 field of because it=E2=80=99s not a thunked field. Two simple solutions here, I think: 1. Make =E2=80=98packages=E2=80=99 a thunked field. 2. Stop using =E2=80=98canonical-package=E2=80=99 altogether in =E2=80=98= %base-packages=E2=80=99. I actually have a preference for #2. We=E2=80=99d need to check what impac= t it has on the system closure size, but I suspect it=E2=80=99s going to be mini= mal. Thoughts? (The trick you posted should work of course, but it=E2=80=99s even better if we can avoid it!) Thanks, Ludo=E2=80=99.