unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip McGrath <philip@philipmcgrath.com>
To: 62231@debbugs.gnu.org, Tim Johann <t1m@phrogstar.de>
Subject: [bug#62231] Chez Scheme for Racket build on aarch64 (patch attached)
Date: Thu, 23 Mar 2023 21:36:42 -0400	[thread overview]
Message-ID: <4267909.iIbC2pHGDl@bastet> (raw)
In-Reply-To: <87h6ukntrg.fsf@phrogstar.de>

[-- Attachment #1: Type: text/plain, Size: 3392 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-03-24  3:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 23:23 [bug#62231] Chez Scheme for Racket build on aarch64 (patch attached) Tim Johann
2023-03-24  1:36 ` Philip McGrath [this message]
2023-03-24 20:03   ` Tim Johann
2023-03-25  5:36     ` Philip McGrath
2023-03-26 14:26     ` bug#62231: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4267909.iIbC2pHGDl@bastet \
    --to=philip@philipmcgrath.com \
    --cc=62231@debbugs.gnu.org \
    --cc=t1m@phrogstar.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).