chibi-scheme
chibi-scheme copied to clipboard
fails to work on 9front
Compiles but doesn't work on 9front
% mk install
% cd
% chibi-scheme
ERROR: couldn't find include: "srfi/69/hash.no-such-file"
called from <anonymous> on line 211 of file /sys/lib/chibi-scheme/meta-7.scm
called from <anonymous> on line 1213 of file /sys/lib/chibi-scheme/init-7.scm
called from <anonymous> on line 280 of file /sys/lib/chibi-scheme/init-7.scm
called from error on line 100 of file /sys/lib/chibi-scheme/init-7.scm
Looks like this is related to shared libraries as I see
#define sexp_so_extension ".no-such-file"
in include/chibi/install.h
chibi-scheme -q should work.
SRFI 69 should be compiled statically in the 9front build, not sure what broke there.
Thanks. Yes, chibi-scheme -q
works but still, things are broken. For instance mk test
fails. Another example: (expt 2 32)
returns 0. This is with $objtype = amd64.
[edit: not filing a separate PR yet as the root cause may be the same for all this]
I've never tried to build Chibi on 9front and don't have an installation available. I don't have any plans to address this port myself, but patches are welcome.
The original Plan9 work was all done on 9vx. I haven't touched this in ages, but nothing fundamental has changed.
What I'm seeing is when gen-static
is called during the 2nd phase of the build, it gets in some kind of allocation loop and eventually runs out of memory.
I'm willing to dig deeper if you have tips, but I'm not sure what to do about it.
I believe this is a problem recognizing eof-object
:
linux:
$ chibi-scheme
> (define eof-object (read-char (open-input-string "")))
> (eof-object? eof-object)
#t
> eof-object
#<eof>
>
9front:
% ./6.out -q
> (define eof-object (read-char (open-input-string "")))
> (eof-object? eof-object)
#f
> eof-object
#\xffffff
>
It just keeps reading until it runs out of memory since it never sees the eof.
#define EOF (-1)
in stdio.h
just like linux
So EOF is somehow becoming positive on 9front?
I think it must be an architecture thing (sizes) because if I change https://github.com/ashinn/chibi-scheme/blob/master/vm.c#L2206
from
if (i == EOF) {
to
if ((int)i == EOF) {
it works.
The build still fails for other reasons, but this seems to address one bit of brokenness.
i
is sexp_sint_t
which may indeed be larger than int
, so without the cast you'd expect it to promote EOF to the larger size. This should work properly, so it seems like a bug in the 9front compiler?
At the same time, the cast should be safe on all platforms, I can add that.
I think plan9 promotion rules are older K&R C rules while Ansi C made a "quiet change" in 1990. But this was a long time ago and I don't recall the details. Just a vague memory.