[CM] S7 questions and libc issue

Fernando Oleo Blanco irvise_ml at irvise.xyz
Thu May 12 14:08:52 PDT 2022


Thank you for your help. I have one last set of questions if you do not
mind.

Am Thu, 12 May 2022 12:53:54 -0700
schrieb <bil at ccrma.Stanford.EDU>:

> For gcc, use
>
>    gcc -o s7 s7.c -I. -lm -DWITH_MAIN -DWITH_C_LOADER=0 -pthread
> -static
>
> libc_s7.so gives FFI bindings for a large portion of libc.
> repl.scm needs it to get raw terminal handlers. The
> WITH_C_LOADER switch is what you needed, I think.
>

I compiled s7 as you indicated and now it works as expected. However, I
have a few concers regarding libc_s7.

It seems that it is needed by r7rs.scm. See the following test:

```
fernando at linux:~/Builds/S7-scheme/s7-riscv> ./s7 r7rs.scm
s7: 2-May-2022
load r7rs.scm
writing libc_s7.c
loading libc_s7.so

;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;")
;    (symbol "\x7f;ELF\x02;\x01;\x01;")
;    libc_s7.so, line 1, position: 7
; ((delete-file o-file-name))
; ((load so-file-name cur-env))
; ((curlet))

```

When loading r7rs.scm it needs to create libc_s7.so. So it would seem
that the libc.scm is quite important, which makes sense and I probably
will need to make use of it. However, I see two problems. The first one
is in the code snippet above. I do not know why, S7 always fails to
load the .so with that message... There seems to be something wrong
with symbol generation when compiling the .c file (or its generation
from libc.scm...). Is that a bug? Did I do something wrong?

And finally, how can I build libc_s7 into the s7 executable? I have
tried compiling the libc_s7.c file into an object file and then
compiling s7 a second time to see if it would get built inside... But
that does not seem to help...

My goal would be to get as close as possible to a "full" Scheme
implementation with batteries included if possible in a single
executable. Does S7 have a mechanism to bundle as much of the "core"
functionalilty together or in a way that "just works". It could be that
I have the s7 executable and I just load the .scm files directly
without having to compile .so first.

Thank you for your patiente,
Fer




More information about the Cmdist mailing list