Deploying an application embedding Chibi-Scheme

88 views
Skip to first unread message

Dimitris Papavasiliou

unread,
Oct 1, 2022, 12:41:29 PM10/1/22
to chibi-scheme
Hello all,

I'm in the final stages of releasing an application that embeds Chibi-Scheme.  I'm working primarily on GNU/Linux, but hope to support other platforms too and up until now I've built Chibi-Scheme manually and installed it locally and its working fine, at least for development.

I'm not sure though that installing Chibi-Scheme system-wide and using it as a shared library would be appropriate for production use.  For one, this would make the assumption that two or more programs embedding Chibi-Scheme on the same system, would want to use the same, default configuration (i.e. whatever the system package maintainer chose).  This doesn't necessarily seem like a reasonable assumption (for instance, if I get something like PR#856 merged, I won't want to).

It would seem best to statically link Chibi-Scheme into the application, bundling together whatever system libraries are necessary.  I can build and link a static library and, although I haven't managed to make it work yet, probably bundle any C libraries using "make clibs.c" etc., but what about system libraries implemented in Scheme?  One approach might be to "make install" into a local directory of the embedding application then distribute the "installed" files along with it and set import paths accordingly.  I also notice support for images, which seem to be of particular interest in all this, but can't find any documentation on them.

I guess the question is, what would be the best way to truly embed Chibi-Scheme into an application?  Here "truly" is meant in the sense that Chibi-Scheme should become part of the application and be distributed with it and "best" is meant as least amount of work, complexity, potential for complications on other platforms and the like.

Thanks,
Dimitris

Dimitris Papavasiliou

unread,
Oct 4, 2022, 6:38:56 AM10/4/22
to chibi-scheme
On Saturday, 1 October 2022 at 19:41:29 UTC+3 Dimitris Papavasiliou wrote:
I guess the question is, what would be the best way to truly embed Chibi-Scheme into an application?  Here "truly" is meant in the sense that Chibi-Scheme should become part of the application and be distributed with it and "best" is meant as least amount of work, complexity, potential for complications on other platforms and the like.


I think I have an approach that works.  In essence, on a clean checkout of chibi-scheme's source, I do:

```
make clibs.c
make distclean
make libchibi-scheme.a SEXP_USE_DL=0 "CPPFLAGS=-DSEXP_USE_STATIC_LIBS -DSEXP_USE_STATIC_LIBS_NO_INCLUDE=0"
```

This creates a static library I can link with, which has all C system libraries baked in. Then, when installing the embedding application, I copy all `.scm` and `.sld` files from the `lib` directory in chibi-scheme's source, along with its own custom libraries.  I also pass this installation directory of system plus custom libraries to `add_module_directory`.  This seems to work fine and should work even if another version of chibi-scheme, with incompatible configuration, were installed at the system level, say via a package.

If anyone can see a problem with this approach, or can think of a better one, please let me know.
Reply all
Reply to author
Forward
0 new messages