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.