From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oD9oFzFzZGNxIQEAbAwnHQ (envelope-from ) for ; Fri, 04 Nov 2022 03:04:33 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id oLZpFzFzZGMkZQEA9RJhRA (envelope-from ) for ; Fri, 04 Nov 2022 03:04:33 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F1B4F372E6 for ; Fri, 4 Nov 2022 03:04:32 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqm4E-0006kR-Dj; Thu, 03 Nov 2022 22:04:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqlwD-0002n6-AB for guix-patches@gnu.org; Thu, 03 Nov 2022 21:56:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqlwB-0000xm-3i for guix-patches@gnu.org; Thu, 03 Nov 2022 21:56:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oqlwA-0000M0-FM for guix-patches@gnu.org; Thu, 03 Nov 2022 21:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58576] [PATCH v2] system: image: Define correct docker image arch when cross building Resent-From: Thiago Jung Bauermann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 04 Nov 2022 01:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58576 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo patch To: 58576@debbugs.gnu.org Cc: Mathieu Othacehe , Thiago Jung Bauermann Received: via spool by 58576-submit@debbugs.gnu.org id=B58576.16675269221312 (code B ref 58576); Fri, 04 Nov 2022 01:56:02 +0000 Received: (at 58576) by debbugs.gnu.org; 4 Nov 2022 01:55:22 +0000 Received: from localhost ([127.0.0.1]:51137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqlvW-0000L6-Gz for submit@debbugs.gnu.org; Thu, 03 Nov 2022 21:55:22 -0400 Received: from mx.kolabnow.com ([212.103.80.154]:36328) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqlvR-0000Km-QY for 58576@debbugs.gnu.org; Thu, 03 Nov 2022 21:55:21 -0400 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 41C042232; Fri, 4 Nov 2022 02:55:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:date:subject:subject :from:from:received:received:received; s=dkim20160331; t= 1667526910; x=1669341311; bh=1+IJcU3xOls+/l+S7ze/Q96HxEH2gmr0pEl GIr31ezo=; b=OegGjUzvgPUPGC3RinF92UhbwlGs+2EicEHiQqRgMPQPR92cX4S 7WIxljElXzdJVnKz96J7vfIswk9olqRYZur6p1NXsoMZc+1jitIom1+JbrURKjFQ ohHVDZ/9+DGKO+FR9QVGFGuE49ShZ2rqMUHBb/DE9Kb8XvVYWdQ2niKPt33Ek3q9 lmS7Sn3OkHzssP/FlML+Rcrav8Eoj6XD/5RkDUujllDtshH77S3K0CC3zgRS/K0H XiGtdbMuL/mX2ve6NvsIjOB6vl8IsgbSOY6R99PpV/MEfkZfewexIS8JHMHIF6/c kS3SvaC40vTevPfzXibPm9D8AzeLqKvXlFZh1V4tlJrqjAGj0SSYV/Qa0nXZ+WyY LBv0pN6QHaaMWr6Qm5JNqeVi7b4PsGfJxSDV8CDgg+GFwRLPqSIJejHCl100UGdp nhT68+0vfLdrg6x9TLoYcOwmitI3A6cZ3TJJrEU2lwdBNVnaJ0lR0NkQIs1BPD5A X11vssQUZLEF8CLiiT+3E/HtdPYVyg7cch4CveXsYEKMD0bhP9CAX1qG9IgMJYnc UNbIRtekZhEcBEE+TBp+hUCgwmdgzMXf1lLguxDEqI65RXOeIetQ9pATFLqp1RJt Qm3/AqLamegWtNJpT5xUG2cU7dGm33KokG1m1CD4SUWrK+u/KTY97PnA= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out001.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hka-94rUrrkK; Fri, 4 Nov 2022 02:55:10 +0100 (CET) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by mx.kolabnow.com (Postfix) with ESMTPS id ED52D213E; Fri, 4 Nov 2022 02:55:09 +0100 (CET) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx001.mykolab.com (Postfix) with ESMTPS id AE801BD2; Fri, 4 Nov 2022 02:55:09 +0100 (CET) Date: Thu, 3 Nov 2022 22:54:56 -0300 Message-Id: <20221104015456.1059014-1-bauermann@kolabnow.com> In-Reply-To: <87tu3qgmlg.fsf@kolabnow.com> References: <87tu3qgmlg.fsf@kolabnow.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Guix-patches" Reply-to: Thiago Jung Bauermann X-ACL-Warn: , Thiago Jung Bauermann via Guix-patches From: Thiago Jung Bauermann via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667527473; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=1+IJcU3xOls+/l+S7ze/Q96HxEH2gmr0pElGIr31ezo=; b=pQFiW3l9Iu2gpPu/F1imaZRd+BbGj1G6cxmAH99bKEkz46KqQ9d7/1DAMemyKlUcBEjMmI Etc1AWvJfrYNd4ihrMbJsUMq7uajjzfJtvTkPZO/iaW8RsmUsSXxkrPL28DKgd9rT/YfSL 70tns2pvpUxH2zbBFZB0d8sV7ra4RF57KG43orGpfDd4oIbkMTgAAJDX5YN37NSG/hCNu9 EbYQfI9dcEsdnZ3Yzs3/TwCjNllqZ339GiSO9BK7XM2L/4SqrKZcM4i2ypdp1Vw75PHpFH +VBvu996pSPK8ImgRR3qUzuXWJB1tOIoyQaVYKl5oBDS+CYKmo2dsFH9DTpt2g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667527473; a=rsa-sha256; cv=none; b=lT1JQFFZSiWvYzhP6YwJU7UDiLw2xD1R585klU6tQtEI9XI3Nup13g00KEjsZipS6qw5L8 +tG2v64lvM2v0i697hcDfh1W4HilpVqN46fIy2cbKNvD0KnsgEqhDkAb7uZtU9uHHhwp0r dwIP01P12PT4Lv0AlAtaWH6m5gmO9cmWSGwi1p/QmGB9h5sd0v3pWW+kficRLpYafZK5eL ZVokZB6Vy6rlYhnnomTrFGPeAffxBS+bfLnAdsUGXB5IAD30m6ozLaU2KBnIqD5M5/k9V5 ik3c6tHN6vPkaqeVp6/xbLcWYu7kVGvA2V2D6wIJmRFuFBN8AXyjl9sIHAdaNw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20160331 header.b=OegGjUzv; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.30 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20160331 header.b=OegGjUzv; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: F1B4F372E6 X-Spam-Score: -4.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: jIJwm7WMcl0t 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’. --- Hello, This is v2 of the patch. The only difference is that the expression defining ‘image-target’ doesn't try to get the target from the image's platform field, since its caller ‘system-image’ already does that (thanks to Mathieu for pointing it out). gnu/system/image.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 5fc0d55d9a14..f07a4a52174f 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -652,6 +652,8 @@ (define shared-network? shared-network?) (list boot-program))) (substitutable? (image-substitutable? image)) + (image-target (or (%current-target-system) + (nix-system->gnu-triplet))) (register-closures? (has-guix-service-type? os)) (schema (and register-closures? (local-file (search-path %load-path @@ -705,6 +707,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