Try binink:
> git clone
https://codeberg.org/amirouche/binink
> cd binink
> ./venv
> make chezscheme # cloned from
github.com/cisco/chezscheme in ./local/src/
> make binink
> mv a.out local/bin/binink
> make check
...
> binink
Usage:
binink check [--fail-fast] [DIRECTORY ...] LIBRARY.SCM ...
binink compile [DIRECTORY ...] LIBRARY.SCM PROCEDURE
binink exec [DIRECTORY ...] LIBRARY.SCM PROCEDURE [-- ARGUMENT ...]
binink repl
binink root available
binink root create DISTRIBUTION VERSION MACHINE DIRECTORY
binink root exec DIRECTORY TARGET-DIRECTORY -- COMMAND ...
The following flags are available:
--dev Generate allocation, and instruction counts, debug on
exception, and dump profile information.
--optimize-level=0-3 Configure optimization level, higher is less
safe, harder to debug, but faster
(scheme "Chez Scheme Version 10.3.0-pre-release-4")
(tag "main-22509ee-dirty")
(homepage "
https://codeberg.org/amirouche/binink")
Mind the fact that program.scm is not supported. Instead you need a
r6rs library with an exported procedure:
> cd tmp # preferable to avoid warnings
> cat myproject.scm
(library (myproject)
(export main)
(import (chezscheme))
(define main
(lambda args
(display (apply + (map string->number args)))
(newline))))
You can compile it into a a.out binary with the following command:
> binink compile myproject.scm main
compiling /tmp/binink/compile-kFaDKf/program.scm with output to
/tmp/binink/compile-kFaDKf/program.so
Produced: ./a.out
> /usr/bin/time ./a.out 123 321 456
900
real 0m 0.03s
user 0m 0.02s
sys 0m 0.01s
That binary has not dependency except musl:
> ldd a.out
/lib/ld-musl-x86_64.so.1 (0x7f41cab73000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f41cab73000)
For cross compiling to other distro, there is binink root subcommands
that rely on bubblewrap (bwrap), here is quick cli dance to
demonstrate it:
> mkdir /tmp/rootfs/trixie -p
> binink root create debian trixie amd64 /tmp/rootfs/trixie
...
> sudo binink root exec /tmp/rootfs/trixie/ /root -- /bin/bash
$ apt install build-essential uuid-dev liblz4-dev zlib1g-dev git
...
$ git clone
https://codeberg.org/amirouche/binink
$ cd binink
$ make chezscheme
$ make binink
$ ./a.out
Usage:
binink check [--fail-fast] [DIRECTORY ...] LIBRARY.SCM ...
...
$ ldd a.out
linux-vdso.so.1 (0x00007f0cd45cf000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0cd3f2c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0cd3d36000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0cd45d1000)
With
https://en.wikipedia.org/wiki/Binfmt_misc around you can cross
compile to another hardware architecture
> --
> You received this message because you are subscribed to the Google Groups "chez-scheme" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
chez-scheme...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/chez-scheme/fffe7c82-2f6d-418c-a5d8-064ef80f2884n%40googlegroups.com.