l...@gnu.org (Ludovic Courtès) skribis: > David Craven <da...@craven.ch> 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’s currently no easy way to cross build a full GuixSD >>> anyway, like ‘guix system build --target=mips64el-linux-gnu’ (the >>> --target flag doesn’t exist yet). Or did you experiment in this area? >>> >>> I’d be curious. It’s designed to allow this (in particular because >>> gexps are cross-compilation-aware), but I’ve never tried. >> >> I'm currently not trying to cross-compile everything. The >> --system=mips64el-linux gets us pretty far already. The missing parts >> are only the ones where no substitutes are available. > > Aaah OK. That’s 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 > ‘gexp->derivation’ 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’s an untested hack to illustrate:
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
Ludo’.