[CM] S7 questions and libc issue
Fernando Oleo Blanco
irvise_ml at irvise.xyz
Wed May 11 12:46:30 PDT 2022
Hi everybody,
first things first, thank you for S7!
I am writing to you since I am searching for a Scheme implementation.
For that reason, I decided to create a comparison table. The table can
be found in [1]. I would like to ask if there are any issues, problems
or mistakes regarding the S7 entry. If you find them, please, let me
know. I would like the table to be accurate so that I can make a better
decision and fairly represent the implementation. The same page briefly
documents the motivation and the main "goals" for a choice. In the end,
S7 was selected to go to the more in depth review since it met the
criteria I was looking for.
Therefore, I am happy to say that S7.git builds with the TCC compiler
[2] using no external dependencies! I have not tested the inclussion of
external dependencies or using different "flags" to tweak the features.
However, I seem to have hit a few roadblocks during testing. I would
like to put them forth in case someone can help me or give pointers to
a fix.
The first interesting one is that TCC cannot compile S7 staticly on
Linux/x86_64. It seems there are some Glibc/GCC requirements when
staticly linking... Using the -ldl flag doesn't do anything to help.
Here is the command used and the set of errors:
```
touch mus-config.h && tcc -c s7.c -I. && tcc -o repl repl.c s7.o -lm
-I. -static && ./repl
tcc: error: undefined symbol '__ehdr_start'
tcc: error: undefined symbol '__gcc_personality_v0'
tcc: error: undefined symbol '_Unwind_Resume'
tcc: error: undefined symbol '_Unwind_GetCFA'
tcc: error: undefined symbol '_Unwind_ForcedUnwind'
tcc: error: undefined symbol '__multf3'
tcc: error: undefined symbol '__addtf3'
tcc: error: undefined symbol '__unordtf2'
tcc: error: undefined symbol '__letf2'
```
The bigger issue is cross compiling to Linux/RISC-V. I personally want
to see the Schemes implementations running there. I thought that S7
would have no issues since running the REPL is only 2 compilation
files... But that was not the case.
I initially used a GCC-RISC-V cross-compiler [3] to get the repl running
on a Linux/RISC-V board that I have (it is actually an FPGA running
Linux). But it complained that it could not find/use libc_s7.so and
that it should be compiled by running `./repl libc_s7.scm` (this is
documented on a footnote in [1]). However, that requires and expects gcc
to be present on the system to run. My RISC-V board does not have a C
compiler (it only has 32MB of RAM).
Is this expected? I did not have to compile `libc_s7.scm` when
compiling natively... I also tried generating the `libc_s7.c` file
natively, then using the cross-compiler to generate a `libc_s7.so` for
RISC-V and transfering it over, but that also does not work (I cannot
remember the error). I also tried to link S7 staticly hoping that the
`libc_s7.so` requirement would not happen, but that did not help either.
Are there any recommendations as to how to better cross-compile S7?
[1] https://irvise.xyz/Blog/scheme-implementation-comparison.html
[2] https://bellard.org/tcc/
[3] https://toolchains.bootlin.com/releases_riscv32-ilp32d.html
Thank you very much for your time! Best regards,
Fernando Oleo Blanco
More information about the Cmdist
mailing list