STklos icon indicating copy to clipboard operation
STklos copied to clipboard

Split stklos into lib and binary (so STklos will be embeddable)

Open jpellegrini opened this issue 2 years ago • 7 comments

So we can have an embedable libstklos in the near future. A small patch, as you can see!

I'll work on an example program embedding STklos.

Pending:

  • Don't clutter $PREFIX/include with socket.h, extraconf.h etc.
  • Maybe have three targets, install-base, install-dev and install? (Not sure if this is needed)

jpellegrini avatar Sep 04 '21 15:09 jpellegrini

One more thing: the binary can't find the library and I had to set LD_LIBRARY_PATH manually. I think there is a way to fix this.

jpellegrini avatar Sep 04 '21 16:09 jpellegrini

An I'd have to study the STkos boot process. I though I knew how it worked, but it's more complicated than my initial understanding. The idea would be to have something similar to a boot image, but without the REPL, just so the user can load the basic libraries.

jpellegrini avatar Sep 04 '21 23:09 jpellegrini

I haven't given up on this :) I'll try to work on it later... The tricky part is to adjust the boot process.

jpellegrini avatar Nov 24 '22 18:11 jpellegrini

One more thing: the binary can't find the library and I had to set LD_LIBRARY_PATH manually. I think there is a way to fix this.

The first versions of STklos used this approach (look at the file etc/simple-stklos.c which is here from the beginning, and permitted to use a customized boot image). However, I gave up with this approach, because it was difficult to have a portable way to test STklos without installing it, ans it was a real headache. In particular, LD_LIBRARY_PATH didn't seem to be universally used to denote the places where the library are placed. At the time, STklos was available on a larger number of systems . Things are a little simpler now, but at least on MacOs, the name of the variable is different (DYLD_LIBRARY_PATH is I remember), and is not passed to subprocesses depending on the security options the user has set. I think that it is important that the make test can be run as a normal user before running make install. However, if you have a solution, it would be really really cool.

egallesio avatar Nov 28 '22 17:11 egallesio

So we can have an embedable libstklos in the near future.

I'm surprised because:

https://github.com/egallesio/STklos/blob/590c727038b2790ff047008035072f031eb399d3/README.md?plain=1#L14-L15

Is the README wrong?

ryandesign avatar Mar 11 '23 06:03 ryandesign

Is the README wrong?

I think @egallesio forgot to remove that part of the README. As he mentioned in this PR, STkos used to be embeddable.

By the way, he explained what the problem is, and if there is a solution then STklos cold be embeddable again...

jpellegrini avatar Mar 11 '23 08:03 jpellegrini

Is the README wrong?

For now, it is. I have suppressed this sentence from the README. I'll reintegrate it when this will be again possible.
This will be done after v2.00.

egallesio avatar Mar 18 '23 13:03 egallesio