From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Cross-building GuixSD (and maybe using pre-built toolchains) Date: Thu, 01 Sep 2016 13:59:14 +0200 Message-ID: <87twdzq19p.fsf@gnu.org> References: <87d1kon1lf.fsf@gnu.org> <87k2ewuj9e.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfQeQ-0003BE-Bf for help-guix@gnu.org; Thu, 01 Sep 2016 07:59:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfQeM-0000Bb-6H for help-guix@gnu.org; Thu, 01 Sep 2016 07:59:21 -0400 In-Reply-To: <87k2ewuj9e.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 01 Sep 2016 10:17:01 +0200") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: David Craven Cc: help-guix@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > David Craven skribis: > >>>> So one issue that happens when cross building is for things that have >>>> the #:no-substitutes #t enabled. This is mainly found in service >>>> derivations for generating configuration files. >>> >>> I think there=E2=80=99s currently no easy way to cross build a full Gui= xSD >>> anyway, like =E2=80=98guix system build --target=3Dmips64el-linux-gnu= =E2=80=99 (the >>> --target flag doesn=E2=80=99t exist yet). Or did you experiment in thi= s area? >>> >>> I=E2=80=99d be curious. It=E2=80=99s designed to allow this (in partic= ular because >>> gexps are cross-compilation-aware), but I=E2=80=99ve never tried. >> >> I'm currently not trying to cross-compile everything. The >> --system=3Dmips64el-linux gets us pretty far already. The missing parts >> are only the ones where no substitutes are available. > > Aaah OK. That=E2=80=99s not cross-compilation though, so it works if and= only > if substitutes are available or builds can be offloaded to a machine of > that architecture. Otherwise it cannot really work. > > Now, in most cases, the tiny Guile derivations created via > =E2=80=98gexp->derivation=E2=80=99 et al. in GuixSD (e.g., the derivation= that builds > the initrd) could use, say, an x86_64 Guile, even if building for > mips64el. However, it would be difficult to take advantage of this > AFAICS. There=E2=80=99s an untested hack to illustrate: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/gexp.scm b/guix/gexp.scm index 302879f..53239ac 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -523,6 +523,8 @@ The other arguments are as for 'derivation'." (cons file-name thing))) graphs)) + (define gsystem "x86_64-linux") + (mlet* %store-monad (;; The following binding forces '%current-system' and ;; '%current-target-system' to be looked up at >>= ;; time. @@ -546,13 +548,13 @@ The other arguments are as for 'derivation'." (object->string sexp))) (modules (if (pair? %modules) (imported-modules %modules - #:system system + #:system gsystem #:module-path module-path #:guile guile-for-build) (return #f))) (compiled (if (pair? %modules) (compiled-modules %modules - #:system system + #:system gsystem #:module-path module-path #:guile guile-for-build) (return #f))) @@ -587,7 +589,7 @@ The other arguments are as for 'derivation'." ,builder) #:outputs outputs #:env-vars env-vars - #:system system + #:system gsystem #:inputs `((,guile) (,builder) ,@(if modules diff --git a/guix/packages.scm b/guix/packages.scm index 3646b9b..fe23d35 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -1104,7 +1104,7 @@ symbolic output name, such as \"out\". Note that this procedure calls "This monadic procedure changes the Guile currently used to run the build code of derivations to GUILE, a package object." (lambda (store) - (let ((guile (package-derivation store guile))) + (let ((guile (package-derivation store guile "x86_64-linux"))) (values (%guile-for-build guile) store)))) (define* (package-file package --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpMdWRv4oCZLg0K --=-=-=--