Subject: [RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket'.

From: Philip McGrath <[email-masked]>
Date: Mon, 15 Aug 2022 01:47:37 -0400

Hi Thiago,

> Nice! thanks for the quick fix. I tested guix-issue-57050-v2 and now
> chez-scheme-for-racket-bootstrap-bootfiles builds successfully!
> Unfortunately there's still a holdup: the install phase of racket-vm-cs-8.6
> fails:
>
> [...]
>
> Apparently some part of the racket-vm-cs build system thinks that it's
> cross-compiling when it's not. I'm still trying to figure out where this
> “--cross-compiler” argument is being added but thought I'd provide an early
> report.
>

Thanks for trying this! I think I've found what's going wrong in the
'configure' script is going wrong, but I'm not sure yet what's the right way
to fix it. In the meantime, I think the patch below on top of the
guix-issue-57050-v2 tag should avoid triggering the bad assumption in the
'configure' script: could you give it a try? It's also at
https://gitlab.com/philip1/guix-patches as the current tip of the 'zuo'
branch, commit 64be5566c119d5b4ab83d5fb44d01aa1ecaed599.

 -Philip

-- >8 --
Date: Mon, 15 Aug 2022 00:35:23 -0400
Subject: gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket'.

On systems like powerpc64le-linux that rely on the 'pbarch' backends for
Chez Scheme, configuring with '--enable-racket' incorrectly triggers
cross-compilation mode: see <https://racket.discourse.group/t//950/26>
and <https://issues.guix.gnu.org/57050#54>. We can avoid the problem by
including a bootstrap Racket in 'native-inputs' only for
cross-compilation.

The fact that this works reveals that we are bootstrapping slightly less
that we thought we were. We have to rely on generated code for Racket's
macro expander (which includes the reader and module system) because it
is not bootstrappable, though it is auditable. However, apparently we
are also relying on generated code for the 'io', 'regexp', and 'thread'
subsystems, which can be bootstrapped via Racket BC. We should bootstrap
them once the 'configure' issue is fixed.

* gnu/packages/racket.scm (racket-vm-cs)[native-inputs]: Don't use
'racket-vm-bc' for non-cross builds.
---
 gnu/packages/racket.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index b1de6cf885..4ff36077ef 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -462,14 +462,12 @@ (define-public racket-vm-cs
      (let ((native-inputs (package-native-inputs racket-vm-cgc)))
        (modify-inputs (if (%current-target-system)
                           (modify-inputs native-inputs
+                            (prepend racket-vm-cs)
                             (delete "racket-vm-cgc"))
                           native-inputs)
          (delete "libtool")
          (prepend chez-scheme-for-racket
-                  chez-nanopass-bootstrap
-                  (if (%current-target-system)
-                      racket-vm-cs
-                      racket-vm-bc)))))
+                  chez-nanopass-bootstrap))))
     (arguments
      (substitute-keyword-arguments (package-arguments racket-vm-cgc)
        ((#:phases those-phases #~%standard-phases)

base-commit: aaa95de8c6cff1ba749a9dd0365dedb822ffa625
-- 
2.32.0