GNU bug report logs - #62231
Chez Scheme for Racket build on aarch64 (patch attached)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Tim Johann <t1m@HIDDEN>; dated Fri, 17 Mar 2023 05:03:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 62231 <at> debbugs.gnu.org:


Received: (at 62231) by debbugs.gnu.org; 24 Mar 2023 20:16:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 24 16:16:03 2023
Received: from localhost ([127.0.0.1]:41436 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pfnpS-0004M3-O8
	for submit <at> debbugs.gnu.org; Fri, 24 Mar 2023 16:16:03 -0400
Received: from ms-10.1blu.de ([178.254.4.101]:60858)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <t1m@HIDDEN>) id 1pfnpQ-0004LU-LA
 for 62231 <at> debbugs.gnu.org; Fri, 24 Mar 2023 16:16:01 -0400
Received: from [176.199.211.189] (helo=dolos)
 by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <t1m@HIDDEN>)
 id 1pfnpO-0007BR-VT; Fri, 24 Mar 2023 21:15:59 +0100
From: Tim Johann <t1m@HIDDEN>
To: 62231 <at> debbugs.gnu.org, Philip McGrath <philip@HIDDEN>
Subject: Re: Chez Scheme for Racket build on aarch64 (patch attached)
Date: Fri, 24 Mar 2023 21:03:19 +0100
References: <87h6ukntrg.fsf@HIDDEN> <4267909.iIbC2pHGDl@bastet>
User-agent: mu4e 1.8.13; emacs 29.0.60
In-reply-to: <4267909.iIbC2pHGDl@bastet>
Message-ID: <87r0tdq51d.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Con-Id: 303810
X-Con-U: 0-timjohann
X-Originating-IP: 176.199.211.189
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 62231
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain
Content-Disposition: inline

Hi Philip,

Happy to be of help.

Thanks for the pointers, here's the amended patch.  I hope it is to your liking.

cheers

Tim

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=chez-racket-aarch64-rev1.patch

commit e3c514db745d48e5ef7f7abb7b45037341298b17
Author: Tim Johann <t1m@HIDDEN>
Date:   Fri Mar 24 21:09:52 2023 +0100

    gnu: chez-scheme-for-racket-bootstrap-bootfiles: change for aarch64.
    
    * gnu/packages/chez.scm (chez-scheme-for-racket-bootstrap-bootfiles):
      Temporary change for build on aarch64, making racket available on aarch64.
      Architecture autodetect in rktboot only addresses x86 archs, so far.
      This work-around sets the architecture, looked up in translation table,
      explicitly.  The long term solution should be to fix rktboot to include
      other natively supported architectures in the autodetect mechanism.
        cf. https://github.com/racket/racket/issues/3948
      [arguments] use --machine even when architecture is supported by Racket's
      fork of ChezScheme.

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index c6420a980e..ab6eaba6bd 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -692,10 +692,12 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
                          (search-input-file (or native-inputs inputs)
                                             "/opt/racket-vm/bin/racket")
                          "../rktboot/main.rkt"
-                         #$@(if (racket-cs-native-supported-system?)
-                                #~()
-                                (let ((m (nix-system->pbarch-machine-type)))
-                                  #~("--machine" #$m)))))))))))))
+                         ;; Temporary handling of builds on non-x86 architectures,
+                         ;; see https://github.com/racket/racket/issues/3948
+                         ;; Autodetect in rktboot only addresses x86 archs, so far.
+                         #$@(let ((m (or (racket-cs-native-supported-system?)
+                                         (nix-system->pbarch-machine-type))))
+                              #~("--machine" #$m))))))))))))
     (supported-systems
      (package-supported-systems chez-scheme-for-racket))
     (home-page "https://github.com/racket/ChezScheme")

--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#62231; Package guix-patches. Full text available.

Message received at 62231 <at> debbugs.gnu.org:


Received: (at 62231) by debbugs.gnu.org; 24 Mar 2023 01:38:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 23 21:38:38 2023
Received: from localhost ([127.0.0.1]:39581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pfWO5-0003ib-Un
	for submit <at> debbugs.gnu.org; Thu, 23 Mar 2023 21:38:38 -0400
Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:51229)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philip@HIDDEN>) id 1pfWMY-0003fq-Tz
 for 62231 <at> debbugs.gnu.org; Thu, 23 Mar 2023 21:38:36 -0400
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.west.internal (Postfix) with ESMTP id 403A832002E2;
 Thu, 23 Mar 2023 21:36:52 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute3.internal (MEProxy); Thu, 23 Mar 2023 21:36:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 philipmcgrath.com; h=cc:content-type:content-type:date:date:from
 :from:in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to; s=fm2; t=1679621811; x=
 1679708211; bh=capo7vavydvunRYSZuPKcYWLzKeVrKdPbDgOkLx7hJY=; b=V
 dDuwQKx4LzyJ7hbIfIqEJbysenm/JS+ibHDSAEZq8XE7KqxTDydPfZz9HYQljDo5
 +Gq4GgcxHq1bsetnD9M3a/JhbVSdddPH63a5DzqHUfZEvVZUOEXCaghk2+kFjyuf
 kcyU3jXTaWwDhe1yALOBYiwvMGZU07fNq+zuXAIr/01752CEejNQptXV98csifZM
 3SlwdxgYJls8GUPi2D3HL9SKY83bFxexUsYGK+cVdCA+PYCSHGJQWmLtxk8ArVZs
 dYQ5Kklw2awbtK3Xz6pK44a6l74icXZhhsmWYDNcU2oN0WtVLf3sK4inIRJitW5d
 bOhKfkUp/0fPPGDAB3Qwg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:sender:subject
 :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm2; t=1679621811; x=1679708211; bh=capo7vavydvun
 RYSZuPKcYWLzKeVrKdPbDgOkLx7hJY=; b=LjrOg8UFms3lkizJX0DLJF8KI7Vi3
 qFuPhEEDlVB0ZG3B9qT+npSkEEp3Muq0oQhkUEzLfL6wUrgeP1c23LsAsyq2XZr/
 nk6j7wj8Bar2V00MZIB9bFYZsgYL2n12OzdiZtP2LPLIt4SrRD9XCzNVxGEalmpg
 AvWaG5Uxow8vIGsAenv6L3AvtCyBhN3X5NjBUBng9thdhPmkqQN5eOENUAep2Vr3
 TkJzuxA53smIIgGECtH0XrpPS32gbPsrQv4S7dB1QcCEStewgiLy9x4vxwQlxITH
 Z8VC1TSIV6Fp7F/jK3x6GeuXssiZ+4zkJxC1FdglyxiboNmnMXdV8iH1w==
X-ME-Sender: <xms:sv4cZCLSaF-bb_sExxzjdoAs_OhpgOvnkyrAye0VtYFR26XNqi4VRw>
 <xme:sv4cZKIgukeApYOKfKUS_QjPLbFskTEgoHt8Wdve8OGQwmSxLygfDnf8If3H4H7fU
 6EhZql82MQ4kORu2kE>
X-ME-Received: <xmr:sv4cZCvJSUzilfhb4fFheM5z3vZL0tDJET5sBDUhvS7Zm5K69s4fnllM6xwoMj-Z9GEGb0v6p6owZeBuuAflLG1gyHRgTERz9pdPJQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeghedgfeeiucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkjghfgggtsehgtderre
 dttddvnecuhfhrohhmpefrhhhilhhiphcuofgtifhrrghthhcuoehphhhilhhiphesphhh
 ihhlihhpmhgtghhrrghthhdrtghomheqnecuggftrfgrthhtvghrnhepledtfeevvdevje
 egleeltddtteeiveffkeetfedtieehuedtjeduudevhfejkeefnecuffhomhgrihhnpehg
 ihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih
 hlfhhrohhmpehphhhilhhiphesphhhihhlihhpmhgtghhrrghthhdrtghomh
X-ME-Proxy: <xmx:sv4cZHa1rsjgeWBySAZQQES9rMzX84r2L9a4PDa8RPIVGq0v6geKLw>
 <xmx:sv4cZJYLd0L5MozSUjxJqkZzv4g0EuUe9ik1vXQ5N7DdlJIOKMifXw>
 <xmx:sv4cZDBPR4RQzKLKONXKm0t1J8b07ckj-Xu56s9-la1pd1lGF8ioIw>
 <xmx:s_4cZIXg_M582fAAulwQN9YOEPoqyHClArYvV3cQt3vynVWX4LgSUA>
Feedback-ID: i2b1146f3:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 23 Mar 2023 21:36:50 -0400 (EDT)
From: Philip McGrath <philip@HIDDEN>
To: 62231 <at> debbugs.gnu.org, Tim Johann <t1m@HIDDEN>
Subject: Re: Chez Scheme for Racket build on aarch64 (patch attached)
Date: Thu, 23 Mar 2023 21:36:42 -0400
Message-ID: <4267909.iIbC2pHGDl@bastet>
In-Reply-To: <87h6ukntrg.fsf@HIDDEN>
References: <87h6ukntrg.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart9862253.CDJkKcVGEf";
 micalg="pgp-sha512"; protocol="application/pgp-signature"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62231
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--nextPart9862253.CDJkKcVGEf
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"; protected-headers="v1"
From: Philip McGrath <philip@HIDDEN>
To: 62231 <at> debbugs.gnu.org, Tim Johann <t1m@HIDDEN>
Subject: Re: Chez Scheme for Racket build on aarch64 (patch attached)
Date: Thu, 23 Mar 2023 21:36:42 -0400
Message-ID: <4267909.iIbC2pHGDl@bastet>
In-Reply-To: <87h6ukntrg.fsf@HIDDEN>
References: <87h6ukntrg.fsf@HIDDEN>
MIME-Version: 1.0

Hi Tim,

On Thursday, March 16, 2023 7:23:46 PM EDT Tim Johann wrote:
> A few weeks ago I wanted to use Racket on Guix on aarch64, but was made
> aware, that Racket was not available as a substitute and it did not build. 
> On the other hand, recent versions of Racket were available on Raspberry Pi
> OS which is explicitly running on aarch64.  The machine I am running Guix
> on actually is a Raspberry Pi 4B.
> 

Thanks again for your investigation of this problem! As I commented on the 
upstream issue at <https://github.com/racket/racket/issues/3948>, I still 
think this is an upstream bug (and your analysis helped a great deal in finding 
the root cause), but the approach in your patch is probably the easiest way to 
fix things for Guix users for now. I'd just ask that you add a comment 
referencing the upstream issue and with some explanation, because it's not my 
preferred long-term approach.

> 
> [...]
> 
> using the Racket utility
>   ../rktboot/main.rkt
> This script would actually accept the flag '--machine' and would set the
> environment variable MACH to the value of the argument following the flag.
> 
> The problem is that in the case of aarch64 the recipe would not set the
> flag. In the recipe for chez-scheme-for-racket-bootstrap-bootfiles in
> module (gnu packages chez), we find the lines
> ,----
> 
> | #~(invoke
> | 
> |    (search-input-file (or native-inputs inputs)
> |    
> |                       "/opt/racket-vm/bin/racket")
> |    
> |    "../rktboot/main.rkt"
> |    #$@(if (racket-cs-native-supported-system?)
> |    
> |           #~()
> |           (let ((m (nix-system->pbarch-machine-type)))
> |           
> |             #~("--machine" #$m)))))))))))))
> 
> `----
> and, since `(racket-cs-native-supported-system?)' returns `tarm64le', the
> first branch of the if expression is taken, ommitting the flag.
> 

The "rktboot" scripts (which simulate enough of Chez Scheme to bootstrap its 
bootfiles) are supposed to be able to infer right machine type for the current 
platform, at least if the platform is natively supported. The problem is that 
the upstream code to doesn't actually work on architectures other than i386 
and x86_64. 

> I suggest to change the above code to the following:
> ,----
> 
> | #~(invoke
> | 
> |    (search-input-file (or native-inputs inputs)
> |    
> |                       "/opt/racket-vm/bin/racket")
> |    
> |    "../rktboot/main.rkt"
> |    #$@(let ((m (or (racket-cs-native-supported-system?)
> |    
> |                    (nix-system->pbarch-machine-type))))
> |         
> |         #~("--machine" #$m))))))))))))
> 
> `----
> which sets the flag for natively supported architectures and those supported
> by portable bytecode.

This is a good work-around. The reason I'd like to avoid it in the long run is 
that, ideally, I'd like to get us out of the business of managing Chez machine 
types and the translation from normal architecture and OS strings. I think 
we'll at least be able to eliminate `%chez-features-table` once the ongoing 
work to reunify upstream Chez Scheme with Racket's branch is complete. 
Reducing the number of places where we have to use these machine-type-
producing functions should help advance that goal, so I'd prefer to have a 
comment here reminding us that we can reconsider "--machine" once <https://
github.com/racket/racket/issues/3948> is fixed.

-Philip

--nextPart9862253.CDJkKcVGEf
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE9GWrrNY3rqwUFVXPygNjjfo/HHoFAmQc/qoACgkQygNjjfo/
HHqfUQ/+P2CoZiNj0Z5MObpbhiswec/AP5ccFl0qKDKWcdbpps51YSr45kzWeXDk
kCb6+rdYzNUzAumX7SWmNV2nq6GyD3YvxMgmNt1gVsUv2DmAAMBfEgOVugS64cCK
M/o/KBgBpjB9+bdrRIqNSvWqKn9l7hfn+U065+AMDqvU7Hoi66nl9sDAUf+IO0cU
pd33dD8rBrMZvcKhTZc7pN7IUF0JJXyBcOveTLiyBVYGK5YmxdcarjmkogRnyHjU
ZDsPMApjyLhkFPYZozIxE8gp5bQ3uN90SFPUjanvQpGE5R4FsCeVkyD3A2uwo5EH
piexnfQ9WRDBqR4/Fsrv3QniMSpeaM5i7pvF8bqmPJy6rn0drVmATlR2yaMyhojS
L5TRcOfqP+gljAAbHzXsvyvlymtXhIUr4IZfo34trIlmIicxnKKFuhG7gYklSGkS
Rxhnw/yA0nL6bb/4SixPLNIzOooJkLRx3OnUw08BewsbDoE2QIIww2dt9LntmTCK
NnU31pGP6Ua/AZAT3lUv1Htu3S1PA/RA4ZyWQO8FnAu7BLiuAftRZDpuNTPz47rJ
tkC4chURT6PD1wYgvfC3UJivC+GrfGNb0u8o3CgSrVZnyldIEbA1Uyb7Y7Fp6+7e
6SGYFol67mfE4y80xYRblreTpRFt0lRoO6Hper+AsL8G+jxjVZs=
=9y03
-----END PGP SIGNATURE-----

--nextPart9862253.CDJkKcVGEf--







Information forwarded to guix-patches@HIDDEN:
bug#62231; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Mar 2023 05:02:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 17 01:02:56 2023
Received: from localhost ([127.0.0.1]:43440 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pd2Ex-0001uh-E5
	for submit <at> debbugs.gnu.org; Fri, 17 Mar 2023 01:02:56 -0400
Received: from lists.gnu.org ([209.51.188.17]:54632)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <t1m@HIDDEN>) id 1pcxJs-0002Fy-Aa
 for submit <at> debbugs.gnu.org; Thu, 16 Mar 2023 19:47:41 -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 <t1m@HIDDEN>) id 1pcxJs-0007u2-4K
 for guix-patches@HIDDEN; Thu, 16 Mar 2023 19:47:40 -0400
Received: from ms-10.1blu.de ([178.254.4.101])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <t1m@HIDDEN>) id 1pcxJp-0002sc-2R
 for guix-patches@HIDDEN; Thu, 16 Mar 2023 19:47:39 -0400
Received: from [176.199.211.189] (helo=dolos)
 by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <t1m@HIDDEN>) id 1pcxJj-0003Fk-LA
 for guix-patches@HIDDEN; Fri, 17 Mar 2023 00:47:31 +0100
From: Tim Johann <t1m@HIDDEN>
To: guix-patches@HIDDEN
Subject: Chez Scheme for Racket build on aarch64 (patch attached)
Date: Fri, 17 Mar 2023 00:23:46 +0100
User-agent: mu4e 1.8.13; emacs 29.0.60
Message-ID: <87h6ukntrg.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Con-Id: 303810
X-Con-U: 0-timjohann
X-Originating-IP: 176.199.211.189
Received-SPF: pass client-ip=178.254.4.101; envelope-from=t1m@HIDDEN;
 helo=ms-10.1blu.de
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 17 Mar 2023 01:02:54 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="

--==-=-=
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Guix Team,

tl;dr;

The recipe for package 'chez-scheme-for-racket-bootstrap-bootfiles' (a
dependency for racket-8.*) needs to use the --machine flag to build on aarc=
h64
(and possibly also ppc32, the other non-x86 architectures supported by the
Racket fork of Chez Scheme).  I therefore suggest the attached patch to make
building and using Racket possible on aarch64 Guix.

End of tl;dr;

A few weeks ago I wanted to use Racket on Guix on aarch64, but was made awa=
re,
that Racket was not available as a substitute and it did not build.  On the
other hand, recent versions of Racket were available on Raspberry Pi OS whi=
ch is
explicitly running on aarch64.  The machine I am running Guix on actually i=
s a
Raspberry Pi 4B.

So, I dug deeper to find that the problem is that the package
  chez-scheme-for-racket-bootstrap-bootfiles
fails with the error
,----
|   string-append: contract violation
|   expected: string?
|   given: #f
|   argument position: 1st
|   other arguments...:
|    ".def"
|   context...:
|    /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.9.9-pre-r=
elease.14.drv-0/source/racket/src/rktboot/machine-def.rkt:6:0: open-file-wi=
th-machine.def-redirect
| error: in phase 'build': uncaught exception:
| %exception #<&invoke-error program: "/gnu/store/0n4skakcg05bbq9sq7g00j2zm=
25xh4wa-racket-vm-bc-8.8/opt/racket-vm/bin/racket" arguments: ("../rktboot/=
main.rkt") exit-status: 1 term-signal: #f stop-signal: #f>=20
| phase `build' failed after 14.3 seconds
| command "/gnu/store/0n4skakcg05bbq9sq7g00j2zm25xh4wa-racket-vm-bc-8.8/opt=
/racket-vm/bin/racket" "../rktboot/main.rkt" failed with status 1
| builder for `/gnu/store/d04mbj02vzjv0ljcqy2lxs33scz7kjz0-chez-scheme-for-=
racket-bootstrap-bootfiles-9.9.9-pre-release.14.drv' failed with exit code 1
| @ build-failed /gnu/store/d04mbj02vzjv0ljcqy2lxs33scz7kjz0-chez-scheme-fo=
r-racket-bootstrap-bootfiles-9.9.9-pre-release.14.drv - 1 builder for `/gnu=
/store/d04mbj02vzjv0ljcqy2lxs33scz7kjz0-chez-scheme-for-racket-bootstrap-bo=
otfiles-9.9.9-pre-release.14.drv' failed with exit code 1
`----
(see, e.g. the build [442314 on ci.guix.gnu.org]).

The Racket fork of Chez is natively supported on aarch64, which is supporte=
d by
comments in module (gnu packages chez), so I went on to find that machine
architecture is communicated in the build process by setting the environment
variable MACH.  I haven't looked to verify this, but it seems that this
environment variable is normally set to a guessed value by the zuo build pr=
ocess
(zuo for 'make' in Mandarin?).

The Guix build recipe for chez-scheme-for-racket-bootstrap-bootfiles, thoug=
h, is
not configuring the whole downloaded racket source package but takes the
shortcut of just building ChezScheme in the subdirectory
  racket/src/ChezScheme
using the Racket utility
  ../rktboot/main.rkt
This script would actually accept the flag '--machine' and would set the
environment variable MACH to the value of the argument following the flag.

The problem is that in the case of aarch64 the recipe would not set the fla=
g.
In the recipe for chez-scheme-for-racket-bootstrap-bootfiles in module (gnu
packages chez), we find the lines
,----
| #~(invoke
|    (search-input-file (or native-inputs inputs)
|                       "/opt/racket-vm/bin/racket")
|    "../rktboot/main.rkt"
|    #$@(if (racket-cs-native-supported-system?)
|           #~()
|           (let ((m (nix-system->pbarch-machine-type)))
|             #~("--machine" #$m)))))))))))))
`----
and, since `(racket-cs-native-supported-system?)' returns `tarm64le', the f=
irst
branch of the if expression is taken, ommitting the flag.

I suggest to change the above code to the following:
,----
| #~(invoke
|    (search-input-file (or native-inputs inputs)
|                       "/opt/racket-vm/bin/racket")
|    "../rktboot/main.rkt"
|    #$@(let ((m (or (racket-cs-native-supported-system?)
|                    (nix-system->pbarch-machine-type))))
|         #~("--machine" #$m))))))))))))
`----
which sets the flag for natively supported architectures and those supporte=
d by
portable bytecode.

The package (and subsequently Racket) builds on aarch64, the build on x86_64
seems to be unaffected.

It is a simple change which would make a huge difference for Guix users who=
 want
to be able to play with Racket on an aarch64 machine.

Cheers

Tim

L=C3=A1 Fh=C3=A9ile P=C3=A1draig sona dhaoibh!


[442314 on ci.guix.gnu.org] <https://ci.guix.gnu.org/build/442314/log/raw>

--==-=-=
Content-Type: text/html; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

<html xmlns=3D"http://www.w3.org/1999/xhtml" lang=3D"en" xml:lang=3D"en"><h=
ead><!-- 2023-03-17 Fri 00:47 --><meta http-equiv=3D"Content-Type" content=
=3D"text/html;charset=3Dutf-8"/><meta name=3D"viewport" content=3D"width=3D=
device-width, initial-scale=3D1"/><meta name=3D"generator" content=3D"Org M=
ode"/></head><body>
<div style=3D"font-family:&quot;Arial&quot;;font-size:10pt;line-height:11pt=
;" id=3D"content">
<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
Hi Guix Team,<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
tl;dr;<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
The recipe for package 'chez-scheme-for-racket-bootstrap-bootfiles' (a<br/>
dependency for racket-8.*) needs to use the =E2=80=93machine flag to build =
on aarch64<br/>
(and possibly also ppc32, the other non-x86 architectures supported by the<=
br/>
Racket fork of Chez Scheme).  I therefore suggest the attached patch to mak=
e<br/>
building and using Racket possible on aarch64 Guix.<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
End of tl;dr;<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
A few weeks ago I wanted to use Racket on Guix on aarch64, but was made awa=
re,<br/>
that Racket was not available as a substitute and it did not build.  On the=
<br/>
other hand, recent versions of Racket were available on Raspberry Pi OS whi=
ch is<br/>
explicitly running on aarch64.  The machine I am running Guix on actually i=
s a<br/>
Raspberry Pi 4B.<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
So, I dug deeper to find that the problem is that the package<br/>
  chez-scheme-for-racket-bootstrap-bootfiles<br/>
fails with the error<br/></p>
<pre style=3D"line-height:12pt;color:unspecified-fg;background-color:unspec=
ified-bg;margin:0px;font-size:9pt;font-family:monospace;" id=3D"org149cae2">
  string-append: contract violation
  expected: string?
  given: #f
  argument position: 1st
  other arguments...:
   &quot;.def&quot;
  context...:
   /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.9.9-pre-rel=
ease.14.drv-0/source/racket/src/rktboot/machine-def.rkt:6:0: open-file-with=
-machine.def-redirect
error: in phase 'build': uncaught exception:
%exception #&lt;&amp;invoke-error program: &quot;/gnu/store/0n4skakcg05bbq9=
sq7g00j2zm25xh4wa-racket-vm-bc-8.8/opt/racket-vm/bin/racket&quot; arguments=
: (&quot;../rktboot/main.rkt&quot;) exit-status: 1 term-signal: #f stop-sig=
nal: #f&gt;=20
phase `build' failed after 14.3 seconds
command &quot;/gnu/store/0n4skakcg05bbq9sq7g00j2zm25xh4wa-racket-vm-bc-8.8/=
opt/racket-vm/bin/racket&quot; &quot;../rktboot/main.rkt&quot; failed with =
status 1
builder for `/gnu/store/d04mbj02vzjv0ljcqy2lxs33scz7kjz0-chez-scheme-for-ra=
cket-bootstrap-bootfiles-9.9.9-pre-release.14.drv' failed with exit code 1
@ build-failed /gnu/store/d04mbj02vzjv0ljcqy2lxs33scz7kjz0-chez-scheme-for-=
racket-bootstrap-bootfiles-9.9.9-pre-release.14.drv - 1 builder for `/gnu/s=
tore/d04mbj02vzjv0ljcqy2lxs33scz7kjz0-chez-scheme-for-racket-bootstrap-boot=
files-9.9.9-pre-release.14.drv' failed with exit code 1
</pre>
<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
(see, e.g. the build <a style=3D"color:#0071c5;" href=3D"https://ci.guix.gn=
u.org/build/442314/log/raw">442314 on ci.guix.gnu.org</a>).<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
The Racket fork of Chez is natively supported on aarch64, which is supporte=
d by<br/>
comments in module (gnu packages chez), so I went on to find that machine<b=
r/>
architecture is communicated in the build process by setting the environmen=
t<br/>
variable MACH.  I haven't looked to verify this, but it seems that this<br/>
environment variable is normally set to a guessed value by the zuo build pr=
ocess<br/>
(zuo for 'make' in Mandarin?).<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
The Guix build recipe for chez-scheme-for-racket-bootstrap-bootfiles, thoug=
h, is<br/>
not configuring the whole downloaded racket source package but takes the<br=
/>
shortcut of just building ChezScheme in the subdirectory<br/>
  racket/src/ChezScheme<br/>
using the Racket utility<br/>
  ../rktboot/main.rkt<br/>
This script would actually accept the flag '=E2=80=93machine' and would set=
 the<br/>
environment variable MACH to the value of the argument following the flag.<=
br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
The problem is that in the case of aarch64 the recipe would not set the fla=
g.<br/>
In the recipe for chez-scheme-for-racket-bootstrap-bootfiles in module (gnu=
<br/>
packages chez), we find the lines<br/></p>
<div style=3D"margin-top:10px;font-family:&quot;Arial&quot;;font-size:10pt;=
line-height:11pt;">
<pre style=3D"line-height:12pt;color:unspecified-fg;background-color:unspec=
ified-bg;margin:0px;font-size:9pt;font-family:monospace;">#~(invoke
   (search-input-file (<span style=3D"color: #00ffff;">or</span> native-inp=
uts inputs)
                      <span style=3D"color: #ffa07a;">&quot;/opt/racket-vm/=
bin/racket&quot;</span>)
   <span style=3D"color: #ffa07a;">&quot;../rktboot/main.rkt&quot;</span>
   #$@(<span style=3D"color: #00ffff;">if</span> (racket-cs-native-supporte=
d-system?)
          #~()
          (<span style=3D"color: #00ffff;">let</span> ((m (nix-system-&gt;p=
barch-machine-type)))
            #~(<span style=3D"color: #ffa07a;">&quot;--machine&quot;</span>=
 #$m)))))))))))))
</pre>
</div>
<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
and, since <code style=3D"font-size:10pt;font-family:monospace;background:#=
f9f9f9;">(racket-cs-native-supported-system?)</code> returns <code style=3D=
"font-size:10pt;font-family:monospace;background:#f9f9f9;">tarm64le</code>,=
 the first<br/>
branch of the if expression is taken, ommitting the flag.<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
I suggest to change the above code to the following:<br/></p>
<div style=3D"margin-top:10px;font-family:&quot;Arial&quot;;font-size:10pt;=
line-height:11pt;">
<pre style=3D"line-height:12pt;color:unspecified-fg;background-color:unspec=
ified-bg;margin:0px;font-size:9pt;font-family:monospace;">#~(invoke
   (search-input-file (<span style=3D"color: #00ffff;">or</span> native-inp=
uts inputs)
                      <span style=3D"color: #ffa07a;">&quot;/opt/racket-vm/=
bin/racket&quot;</span>)
   <span style=3D"color: #ffa07a;">&quot;../rktboot/main.rkt&quot;</span>
   #$@(<span style=3D"color: #00ffff;">let</span> ((m (<span style=3D"color=
: #00ffff;">or</span> (racket-cs-native-supported-system?)
                   (nix-system-&gt;pbarch-machine-type))))
        #~(<span style=3D"color: #ffa07a;">&quot;--machine&quot;</span> #$m=
))))))))))))
</pre>
</div>
<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
which sets the flag for natively supported architectures and those supporte=
d by<br/>
portable bytecode.<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
The package (and subsequently Racket) builds on aarch64, the build on x86_6=
4<br/>
seems to be unaffected.<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
It is a simple change which would make a huge difference for Guix users who=
 want<br/>
to be able to play with Racket on an aarch64 machine.<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
Cheers<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
Tim<br/></p>

<p style=3D"text-decoration:none;margin-bottom:0px;margin-top:10px;line-hei=
ght:11pt;font-size:10pt;font-family:&quot;Arial&quot;;">
L=C3=A1 Fh=C3=A9ile P=C3=A1draig sona dhaoibh!<br/></p>
</div>
</body></html>
--==-=-=--

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=chez-racket-aarch64.patch

commit f8d7b06a92b3839da1908837ac81ab6295626cf5
Author: Tim Johann <t1m@HIDDEN>
Date:   Thu Mar 16 18:53:13 2023 +0100

    gnu: chez-scheme-for-racket-bootstrap-bootfiles: change for aarch64.
    
    * gnu/packages/chez.scm (chez-scheme-for-racket-bootstrap-bootfiles):
    change for build on aarch64, making racket available on aarch64.
    [arguments] use --machine even when architecture is supported by Racket's
    fork of ChezScheme.

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index c6420a980e..bc709917c2 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -692,10 +692,9 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
                          (search-input-file (or native-inputs inputs)
                                             "/opt/racket-vm/bin/racket")
                          "../rktboot/main.rkt"
-                         #$@(if (racket-cs-native-supported-system?)
-                                #~()
-                                (let ((m (nix-system->pbarch-machine-type)))
-                                  #~("--machine" #$m)))))))))))))
+                         #$@(let ((m (or (racket-cs-native-supported-system?)
+                                         (nix-system->pbarch-machine-type))))
+                              #~("--machine" #$m))))))))))))
     (supported-systems
      (package-supported-systems chez-scheme-for-racket))
     (home-page "https://github.com/racket/ChezScheme")

--=-=-=--




Acknowledgement sent to Tim Johann <t1m@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#62231; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 24 Mar 2023 20:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.