how to deploy minimally?

50 views
Skip to first unread message

fahptv

unread,
May 25, 2018, 6:39:47 PM5/25/18
to chibi-scheme
Hi,

I did the following to cross-compile and deploy to another machine -- all told it was 9+ Mb. Please let me know if I did anything wrong or if there's a way to make it take less space, like eliminating unused code. Thanks!
  1. make and install chibi-scheme for my dev machine
  2. define CC in the makefile to point to my cross compiler
  3. replace ./chibi-scheme in the makefile to point to my dev machine's chibi-scheme
  4. make clean ; make
  5. move the following to the target machine (9+ mb)
    1. chibi-scheme
    2. libchibi*.so
    3. lib/
  6. run compile-r7rs from https://srfi.schemers.org/srfi-138/srfi-138.html on my hello world scm file to create an executable
  7. move executable to target and run

The reason lib/ seemed necessary is because it looks for init-7.scm when it runs.


My hello world executable looked like this:


#! /bin/sh
#|
chibi-scheme -A /tmp/lib -I /tmp -- "$0" "$@"
exit $?
|#
(import (chibi))
(display "Hello world from Scheme.")


I'm interested in making both pure-scheme and mixed-c-and-scheme programs on the target machine.

Alex Shinn

unread,
May 25, 2018, 7:03:28 PM5/25/18
to chibi-...@googlegroups.com
Technically you only need libchibi-scheme which is ~200k and can be trimmed to ~70k with compile-time options.  This will work with -Q.

For most standard R5RS procedures you probably want init-7.scm (and meta-7.scm for the module system).  These will work with -q.

You need a lot more for the (scheme small) language which is the default, but nowhere near 9MB.  Delete the lib/*.img files, they are taking all the space and are not needed.

--
Alex

--
You received this message because you are subscribed to the Google Groups "chibi-scheme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chibi-scheme+unsubscribe@googlegroups.com.
To post to this group, send email to chibi-...@googlegroups.com.
Visit this group at https://groups.google.com/group/chibi-scheme.
For more options, visit https://groups.google.com/d/optout.

fahptv

unread,
May 25, 2018, 7:31:15 PM5/25/18
to chibi-scheme
  1. Where do -Q and -q go? In the Makefile? As part of which variable? (Sorry, I'm a complete noob, not just to chibi but also to Makefiles)
  2. How can it be that I need only libchibi-scheme.so? Don't I also need the chibi-scheme executable itself to interpret a program that is pure scheme?


Alex Shinn

unread,
May 25, 2018, 11:39:40 PM5/25/18
to chibi-...@googlegroups.com
-Q and -q are command-line options to the chibi-scheme executable.

If you're just embedding in a C program you only need the library, not the executable.
When loading the initial Scheme environment from a C program you can specify the equivalent of -Q or -q as needed.

--
Alex

On Sat, May 26, 2018 at 7:31 AM, fahptv <fah...@gmail.com> wrote:
  1. Where do -Q and -q go? In the Makefile? As part of which variable? (Sorry, I'm a complete noob, not just to chibi but also to Makefiles)
  2. How can it be that I need only libchibi-scheme.so? Don't I also need the chibi-scheme executable itself to interpret a program that is pure scheme?


Reply all
Reply to author
Forward
0 new messages