Ticket #605 (closed defect: wontfix)

Opened 5 years ago

Last modified 4 years ago

Saving runtime options in CCL:SAVE-APPLICATION

Reported by: Adlai Owned by: gb
Priority: normal Milestone:
Component: project hosting Version: unspecific
Keywords: application command-line kernel Cc:

Description

SBCL has an option when you dump an executable image to have the new image start up with the same amount of reserved heap space, stack space, etc, as the current image. Also, using this option means that the all command-line arguments are passed directly to the executable image.

Currently, the CCL kernel handles some command-line arguments unconditionally, which is a nuisance for producing completely stand-alone applications. Having this option would both enable complete control of command-line argument handling, and would let a saved application start up with a specified amount of heap space, stack space, etc, rather than the defaults.

Example:

; Currently (ccl:save-application "frob-text"

:prepend-kernel t :toplevel-function #'main)

... $ ./frob-text document.txt Couldn't load lisp heap image from document.txt

; Ideally (ccl:save-application "frob-text"

:prepend-kernel t :toplevel-function #'main :save-runtime-options t)

... $ ./frob-text document.txt <frobs document.txt>

Change History

comment:1 Changed 5 years ago by Adlai

I messed up the Wiki markup for that example:

; Currently
(ccl:save-application "frob-text"
                      :prepend-kernel t
                      :toplevel-function #'main)
...
$ ./frob-text document.txt
Couldn't load lisp heap image from document.txt

; Ideally
(ccl:save-application "frob-text"
                      :prepend-kernel t
                      :toplevel-function #'main
                      :save-runtime-options t)
...
$ ./frob-text document.txt
<frobs document.txt>

comment:2 Changed 5 years ago by rme

One way to deal with this without needing to make any changes to how the lisp saves and restores heap images would be to use a wrapper shell script. The lisp kernel will not process any arguments after a double dash --, so a wrapper shell script like this would provide all command-line arguments to the lisp in *COMMAND-LINE-ARGUMENT-LIST*:

#!/bin/sh
# This wrapper would go in /usr/local/bin or someplace like that.

# Path to saved image with prepended kernel; adjust as required
CCL=/usr/local/libexec/my-ccl 

exec CCL -n -- "$@"

Of course, this doesn't result in a completely stand-alone binary.

comment:3 Changed 4 years ago by rme

  • Status changed from new to closed
  • Resolution set to wontfix

I think we've concluded that a wrapper shell script is the way to go.

The wrapper approach leaves the kernel options visible and easily changeable.

Also, this (kernel + heap image + shell script) is not really that different from an executable + shared library, so it's not really an unconventional thing to do.

Note: See TracTickets for help on using tickets.