mbox series

[bug#57050,0/6] gnu: Update Racket to 8.6. Add Zuo.

Message ID cover.1659936550.git.philip@philipmcgrath.com
Headers show
Series gnu: Update Racket to 8.6. Add Zuo. | expand

Message

Philip McGrath Aug. 8, 2022, 6:06 a.m. UTC
Hi,

This patch series contains the Racket 8.6 release, including updating Racket's
variant of Chez Scheme and adding a package for Zuo, the new tiny Racket-like
language used for build scripts starting with this release.

(If you've been waiting for the release announcement, this cycle upstream is
delaying sending it until the new Racket has finished rebuilding all
of <https://docs.racket-lang.org>, which can take a few days---but the release
itself is live at <https://download.racket-lang.org> already, and I've been
told distribution packagers should update now.)

As I mentioned on the mailing list in [1], this release lets us use Racket CS
and Racket's variant of Chez Scheme on all systems, even those for which the
compiler can not yet generate native code, such as powerpc64le-linux and
riscv64-linux. (See the relevant patches for more details.) In particular,
this means that we can now provide some Chez Scheme package for every system
Guix supports. Additionally, I resolved the issues I mentioned in [1] with
i586-pc-gnu by getting getting native code generation for the Hurd working in
Racket's Chez, and I've cherry-picked those patches in this series.

  -Philip

[1]: https://lists.gnu.org/archive/html/help-guix/2022-08/msg00018.html

Philip McGrath (6):
  gnu: stex: Update to 1.2.2-2.afa6075.
  gnu: stex: Fix read-only gifs and math directories.
  gnu: chez-scheme: Fix use of "/bin/sh".
  gnu: Update Racket to 8.6. Add Zuo.
  gnu: racket: Use Racket CS on all systems.
  gnu: chez-scheme-for-racket: Suport all systems.

 gnu/local.mk                                  |  10 +-
 gnu/packages/chez.scm                         | 218 +++++--
 gnu/packages/patches/chez-scheme-bin-sh.patch |  66 ++
 .../racket-backport-8.6-cross-install.patch   |  32 +
 .../racket-backport-8.6-docindex-write.patch  |  36 ++
 .../patches/racket-backport-8.6-hurd.patch    | 609 ++++++++++++++++++
 .../patches/racket-backport-8.6-zuo.patch     | 481 ++++++++++++++
 .../patches/racket-chez-scheme-bin-sh.patch   |  66 ++
 ...-rktio.patch => racket-rktio-bin-sh.patch} |  28 +-
 gnu/packages/patches/racket-zuo-bin-sh.patch  |  72 +++
 .../stex-copy-from-immutable-store.patch      |  41 ++
 gnu/packages/racket.scm                       | 231 ++++---
 12 files changed, 1760 insertions(+), 130 deletions(-)
 create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
 create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
 create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
 create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch
 create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
 create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch
 rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (79%)
 create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch
 create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch


base-commit: f0ae9da3210cc6d87ca519545203daf9751f3465

Comments

Thiago Jung Bauermann Aug. 10, 2022, 3:30 p.m. UTC | #1
Hello Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

> This patch series contains the Racket 8.6 release, including updating Racket's
> variant of Chez Scheme and adding a package for Zuo, the new tiny Racket-like
> language used for build scripts starting with this release.
>
> (If you've been waiting for the release announcement, this cycle upstream is
> delaying sending it until the new Racket has finished rebuilding all
> of <https://docs.racket-lang.org>, which can take a few days---but the release
> itself is live at <https://download.racket-lang.org> already, and I've been
> told distribution packagers should update now.)
>
> As I mentioned on the mailing list in [1], this release lets us use Racket CS
> and Racket's variant of Chez Scheme on all systems, even those for which the
> compiler can not yet generate native code, such as powerpc64le-linux and
> riscv64-linux. (See the relevant patches for more details.) In particular,
> this means that we can now provide some Chez Scheme package for every system
> Guix supports.

I tried building the zuo branch from your gitlab repo (commit
00975c823227 “gnu: chez-scheme-for-racket: Suport all systems.” from
August 8th) on powerpc64le-linux and had this build failure in
chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2:

--8<---------------cut here---------------start------------->8---
starting phase `build'
Assuming current directory has Chez Scheme sources
Use /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/rktboot/.
Use /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/nanopass
Use /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/s
Check /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/boot/tpb64l
Load nanopass
Apply nanopass patch
Load cmacros parts
Load enum
Load cprep
Load expander
Install evaluator
Load cmacros using expander
Continue loading expander
Initialize system libraries
Load nanopass using expander
Load priminfo and primvars
Load expander using expander
Initialize system libraries in bootstrapped expander
Declare nanopass in bootstrapped expander
Load some io.ss declarations
Load some strip.ss declarations
Load some 7.ss declarations
Load most front.ss declarations
Define $filter-foreign-type
Load mkheader
Generate headers
Load mkgc
Generate GC
Load ftype.ss
Load fasl.ss
Load reloc.ss
Load format.ss
Load cp0.ss
Load cpvalid.ss
Load cpcheck.ss
Load cpletrec.ss
Load cpcommonize.ss
Load cpnanopass.ss
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/f72x3mdyagp67ybwdy9cqqsid9v8jk9l-racket-vm-bc-8.6/opt/racket-vm/bin/racket" arguments: ("rktboot/main.rkt" "--machine" "tpb64l") exit-status: 1 term-signal: #f stop-signal: #f> 
phase `build' failed after 707.9 seconds
command "/gnu/store/f72x3mdyagp67ybwdy9cqqsid9v8jk9l-racket-vm-bc-8.6/opt/racket-vm/bin/racket" "rktboot/main.rkt" "--machine" "tpb64l" failed with status 1
--8<---------------cut here---------------end--------------->8---

I didn't have the chance yet to dig into why rktboot/main.rkt is
failing. If you have any tips on how to find more details on what is
going on (e.g., is there some verbose flag that can be passed to it?) I
can try to investigate.
Philip McGrath Aug. 11, 2022, 4 a.m. UTC | #2
Hi Thiago,

On Wed, Aug 10, 2022, at 11:30 AM, Thiago Jung Bauermann wrote:
> Hello Philip,
>
> Philip McGrath <philip@philipmcgrath.com> writes:
>
>> This patch series contains the Racket 8.6 release, including updating Racket's
>> variant of Chez Scheme and adding a package for Zuo, the new tiny Racket-like
>> language used for build scripts starting with this release.
>>
>> (If you've been waiting for the release announcement, this cycle upstream is
>> delaying sending it until the new Racket has finished rebuilding all
>> of <https://docs.racket-lang.org>, which can take a few days---but the release
>> itself is live at <https://download.racket-lang.org> already, and I've been
>> told distribution packagers should update now.)
>>
>> As I mentioned on the mailing list in [1], this release lets us use Racket CS
>> and Racket's variant of Chez Scheme on all systems, even those for which the
>> compiler can not yet generate native code, such as powerpc64le-linux and
>> riscv64-linux. (See the relevant patches for more details.) In particular,
>> this means that we can now provide some Chez Scheme package for every system
>> Guix supports.
>
> I tried building the zuo branch from your gitlab repo (commit
> 00975c823227 “gnu: chez-scheme-for-racket: Suport all systems.” from
> August 8th) on powerpc64le-linux and had this build failure in
> chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2:
>
> --8<---------------cut here---------------start------------->8---
> starting phase `build'
> Assuming current directory has Chez Scheme sources
> Use 
> /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/rktboot/.
> Use 
> /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/nanopass
> Use 
> /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/s
> Check 
> /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/boot/tpb64l
> Load nanopass
> Apply nanopass patch
> Load cmacros parts
> Load enum
> Load cprep
> Load expander
> Install evaluator
> Load cmacros using expander
> Continue loading expander
> Initialize system libraries
> Load nanopass using expander
> Load priminfo and primvars
> Load expander using expander
> Initialize system libraries in bootstrapped expander
> Declare nanopass in bootstrapped expander
> Load some io.ss declarations
> Load some strip.ss declarations
> Load some 7.ss declarations
> Load most front.ss declarations
> Define $filter-foreign-type
> Load mkheader
> Generate headers
> Load mkgc
> Generate GC
> Load ftype.ss
> Load fasl.ss
> Load reloc.ss
> Load format.ss
> Load cp0.ss
> Load cpvalid.ss
> Load cpcheck.ss
> Load cpletrec.ss
> Load cpcommonize.ss
> Load cpnanopass.ss
> error: in phase 'build': uncaught exception:
> %exception #<&invoke-error program: 
> "/gnu/store/f72x3mdyagp67ybwdy9cqqsid9v8jk9l-racket-vm-bc-8.6/opt/racket-vm/bin/racket" 
> arguments: ("rktboot/main.rkt" "--machine" "tpb64l") exit-status: 1 
> term-signal: #f stop-signal: #f> 
> phase `build' failed after 707.9 seconds
> command 
> "/gnu/store/f72x3mdyagp67ybwdy9cqqsid9v8jk9l-racket-vm-bc-8.6/opt/racket-vm/bin/racket" 
> "rktboot/main.rkt" "--machine" "tpb64l" failed with status 1
> --8<---------------cut here---------------end--------------->8---
>
> I didn't have the chance yet to dig into why rktboot/main.rkt is
> failing. If you have any tips on how to find more details on what is
> going on (e.g., is there some verbose flag that can be passed to it?) I
> can try to investigate.
>

Thanks very much for this report!

I am going to report this upstream at
<https://racket.discourse.group/t/chez-for-architectures-without-native-backends/950/>,
because I don't know much I can do to pin down what's going wrong. When cross-compiling, the bootfiles are built with Chez Scheme rather than bootstrapped via Racket BC (because it is 10x faster), but I just tried manually running rktboot for tpb64l from my x86_64-linux machine, and it worked for me.

One thing that would help is if you can try to reproduce this outside of the Guix build environment. You can get the source either checking out <https://github.com/racket/racket> at the v8.6 tag or by downloading and unpacking <https://download.racket-lang.org/releases/8.6/installers/racket-minimal-8.6-src.tgz>. Navigate to the Chez Scheme source directory, which is "racket/src/ChezScheme" in the Git repository or just "src/ChezScheme" in the tarball. You can run rktboot even with an old Racket, so try something like:

    guix shell --container racket-minimal -- racket rktboot/main.rkt --machine tpb64l

If it works, you could try building Racket and/or Chez Scheme, if you want. Even if it doesn't work, you may be able to build Racket and/or Chez Scheme, because Racket distributes "pb" bootfiles (not specialized to word size and endianness) that can be used for bootstrapping. To build Chez Scheme, you probably will need to configure with:

    -m=tpb64l --threads --enable-libffi "CFLAGS=-g -O2 -D_REENTRANT -pthread" "LIBS=-lm -ldl -lrt -lffi -lncurses"

Racket is built from the parent of the Chez Scheme source directory, and you will probably need to configure with:

    --enable-pb --enable-mach=tpb64l

If you are trying to build Chez Scheme or Racket (as opposed to just the bootfiles) from the Git repository and "rktboot" doesn't work, you'll need to run `make pb-fetch` in the root directory of the checkout to get the "pb" bootfiles. More details about options for building from the Git repository are documented at <https://docs.racket-lang.org/racket-build-guide/>, which is also rendered to "build.md" in the root directory of the Git repository itself.

Thanks again for trying this!

-Philip