GNU bug report logs -
#58576
[PATCH] system: image: Define correct docker image arch when cross building
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Fri, 04 Nov 2022 08:46:52 +0100
with message-id <87iljvjh5f.fsf <at> gnu.org>
and subject line Re: [PATCH v2] system: image: Define correct docker image arch when cross building
has caused the debbugs.gnu.org bug report #58576,
regarding [PATCH] system: image: Define correct docker image arch when cross building
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
58576: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58576
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Thiago Jung Bauermann <thiago.bauermann <at> linaro.org>
Cross-building a docker image with:
$ guix system image --image-type=docker --target=aarch64-linux-gnu os.scm
results in an image where the architecture declared in its config.json is
the host architecture rather than the target one. The binaries are
correctly cross-compiled, so the image can be loaded and used despite the
warning message shown by docker:
$ docker load -i vcal7bvsqcijchifhqdvprpd1niqh8sk-docker-image.tar.gz
Loaded image: guix:latest
$ docker create guix:latest
WARNING: The requested image's platform (linux/amd64) does not match the
detected host platform (linux/arm64/v8) and no specific platform was
requested
40f06aa869ed690489c4a3824a7f7721bd4bf453b85f25ac7199266939fe2fba
$ echo $?
0
This is fixed by passing the correct triplet to the build-docker-image
function.
* gnu/system/image.scm (system-docker-image) Add ‘image-target’ variable.
[builder]: Pass ‘#:system’ argument to ‘build-docker-image’.
---
gnu/system/image.scm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 5fc0d55d9a14..c6d7d13f6daf 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -652,6 +652,9 @@ (define shared-network?
shared-network?)
(list boot-program)))
(substitutable? (image-substitutable? image))
+ (image-target (or (%current-target-system)
+ (and=> (image-platform image) platform-target)
+ (nix-system->gnu-triplet)))
(register-closures? (has-guix-service-type? os))
(schema (and register-closures?
(local-file (search-path %load-path
@@ -705,6 +708,7 @@ (define builder
#:entry-point '(#$boot-program #$os)
#:compressor '(#+(file-append gzip "/bin/gzip") "-9n")
#:creation-time (make-time time-utc 0 1)
+ #:system #$image-target
#:transformations `((,image-root -> ""))))))))
(computed-file name builder
[Message part 3 (message/rfc822, inline)]
Hello Thiago,
> * gnu/system/image.scm (system-docker-image) Add ‘image-target’ variable.
> [builder]: Pass ‘#:system’ argument to ‘build-docker-image’.
Applied as a75deb884468db0ce2c35e23a61f1a14c9be958e.
Thanks,
Mathieu
This bug report was last modified 2 years and 202 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.