|
Allegro CL version 11.0 |
Though there are many links to build-lisp-image in this document, essentially all relevant information about build-lisp-image is contained in this document.
The function build-lisp-image can be used to create a new image (dxl) file. This will be a fresh image, fresh in the sense that it inherits little from the running image (only values of certain global variables used as argument defaults). Typical reasons for building images with build-lisp-image include:
build-lisp-image is a lisp function, so it is called from a running Lisp. We distinguish between the image which calls build-lisp-image, the running image, from the image being created, the new image.
build-lisp-image spawns a separate process. On Windows, a "Create image" window displays information about the build process (you may have to expose this window). On Unix, information is printed to the listener. You will see many prompts: do not attempt to type to them.
Images can also be created with dumplisp, as described in the documentation for that function and in the document dumplisp.html. An image created by excl:dumplisp is essentially a copy of the currently running image, with all loaded functionality included and all values of variables preserved. In contrast, build-lisp-image spawns a separate process which builds a new image out of constituent parts. The currently running image supplies only default values for certain arguments. The new image does not capture loaded or newly-defined functionality of the running image (thus, if the function user::foo is defined in the currently running image, it will not be defined in the new image created by build-lisp-image).
This is why build-lisp-image can be used to create a new image with new patches. Patches in the currently running image are not captured by the newly created image. Instead (as described below), patch files are built into the newly created image but the patches in the current image are not involved.
Note that build-lisp-image calls dumplisp in the spawned process. All arguments accepted by dumplisp are also accepted by build-lisp-image except the name argument (which is accepted but ignored since the required argument to build-lisp-image specifies the new image name).
generate-application itself calls build-lisp-image. generate-application is designed to produce a directory of files suitable for shipping to another machine or site (note that you must be licensed to distribute software built in Allegro CL -- contact your Franz Inc. account manager if you are unsure of licensing terms). In contrast, build-lisp-image builds a single image file only. See the description of generate-application and the document delivery.html.
The "BUILD" module must be loaded for build-lisp-image to work (that is, "BUILD" should be on the modules list). It will be loaded automatically when build-lisp-image is called. You can force loading of the module by evaluating
require :build) (
build-lisp-image takes one required and many keyword arguments. The required argument must be a string naming a file, with or without path information. If no path information is specified, the image file will be placed in the current directory (as returned by current-directory). If relative path information is supplied, it will be resolved relative to the current directory. The image file name must have an extension (type). If it does not, it will not be found when Lisp is started. The standard extension (type) of an image file is .dxl but any extension will do. Note that on Windows machines, .dxl is registered and associated with Allegro CL, so double-clicking on a dxl file (in the Windows Explorer, say) executes mlisp.exe with -I [that file].dxl
as arguments. When mlisp.exe is called without an image specified with -I, it looks for an image (dxl) file with the same name (i.e. mlisp) and in the same directory. You can copy mlisp.exe to [anything else].exe if you want it to find a different image file named [anything else].dxl automatically.
Here is the template for a call to build-lisp-image:
(excl:build-lisp-image image-file
...keyword/value pairs... ...dumplisp-keyword/value pairs...)
Allegro CL supports two character sizes: 16-bit and 8-bit. Thus images and executables either use 16-bit characters or 8-bit characters. No image or executable supports characters of both sizes. See iacl.html for information on character sizes in Allegro CL.
build-lisp-image creates a 16-bit character or an 8-bit character image as the new image is created using a 16-bit executable (mlisp and alisp on UNIX, mlisp.exe and alisp.exe on Windows) or an 8-bit executable (mlisp8 and alisp8 on UNIX, mlisp8.exe and alisp8.exe on Windows). The build-executable keyword argument to build-lisp-image specifies the executable that will be used to create the new image. The value of that argument defaults to the executable used to start the running image.
Therefore, if you want the character size of the new image to be the same as the character size in the running image, you need not specify a value for the build-executable keyword argument. If you want a different character size, specify an appropriate executable as the value of that argument.
For example, if you are running a 16-bit character size image and you want to build an 8-bit character size image, call build-lisp-image like this:
"my-image.dxl"
(build-lisp-image "mlisp8" ;; On Windows "mlisp8.exe"
:build-executable ;; < other keyword arguments and values >
)
(That call also works if you are running an 8-bit executable already, of course.)
For example, if you are running an 8-bit character size image and you want to build a 16-bit character size image, call build-lisp-image like this:
"my-image.dxl"
(build-lisp-image "mlisp" ;; On Windows "mlisp.exe"
:build-executable ;; < other keyword arguments and values >
)
(That call also works if you are running a 16-bit executable already, of course.)
Note: Unless you have created your own executable (which is uncommon, but see main.html, all 16-bit character size executables are identical and all 8-bit character size executables are identical. Therefore, any executable of the correct character size may be specified.
Certain defaults for keyword arguments to build-lisp-image are inherited from the currently running image. It is important to understand that these inheritances are the only effect that values in the currently running image have on the new image being built.
:case-mode
:case-sensitive-lower
(the Modern Common Lisp value):case-insensitive-lower
:case-insensitive-upper
(the standard Common Lisp value):dst
t
, United States Daylight Savings Time schedules are used. If nil
, daylight savings time is assumed to never be in force. There is no direct support for non-United States schedules. Users outside the United States can contact Franz Inc. technical support ([email protected]) for assistance in implementing a different schedule.:include-clim
t
if CLIM is in the currently running image, nil
if it is not.:include-common-graphics
:include-ide
true and Common Graphics and the IDE will be in the image. If building an application image, use the project system in the IDE.:include-compiler
Default: t
if the compiler is in the currently running image, nil
if it is not.
When building a standard runtime image (i.e. when the :runtime
argument (in the next table) is specified :standard
) and you are calling generate-application, not build-lisp-image the compiler cannot be in the image created. Thus, either this argument must be specified nil
or both this argument and :discard-compiler
must be specified t
.
Description: when true, include the compiler as the resulting image is being built. Whether the compiler is in the built image depends on the value of the :discard-compiler
argument.
When nil
, the compiler will not be available at any point during the image building process or in the built image.
See the :discard-compiler
option in the next table.
:include-debugger
Default: t
Description: when true, include the debugger in the resulting image.
The default for this argument is not inherited from the running image, so this argument belongs in the next table. It is repeated here to be with the other :include-*
arguments.
:include-devel-env
t
if the development environment is in the currently running image (i.e. :develenv
is on thenil
if it is not.sys:;develenv.cl
(i.e. develenv.cl
in the Allegro directory) lists the modules (as arguments to require) that make up the development environment. This argument must be specified nil
when :runtime
is true since some modules are not allowed in a runtime image.:include-ide
t
if the IDE is in the currently running image, nil
if it is not.:include-tpl
t if the top level is in the currently running image,
nil` if it is not.nil
a minimal top level, as described in above, is available. Also specify nil
when supplying your own top level.:init-file-names
Default: *init-file-names*
Description: The value should be a list of strings naming files without directory information, like
".clinit.cl" "clinit.cl") (
The directories to be searched for these files is determined at runtime (the current directory and the home directory -- see startup.html).
The default comes from the value of the indicated variable in the running image. See also :read-init-files below.
:load-local-names-info
t
or nil
.:load-source-file-info
t
or nil
.:load-xref-info
Default: *load-xref-info*
Description: the value of this argument serves as the default value for *load-xref-info* in the image to be built. By default, the value is inherited from the value in the running image. The value can be t
or nil
.
When building a runtime (i.e. :runtime
is true), it is best to explicitly specify this argument nil
.
:pll-file
Default: (pll-file)
Description: the value can be a string naming an existing pll file or nil
. The default is the pll file used by the running image (as returned by pll-file). If nil
, no pll file will be used by the new image. Instead, data that would be placed in the pll file (code vectors and string constants) are placed in the Lisp heap.
If the value has no directory information (i.e. is just a filename or a filename and a file type), the pll file will be looked for on startup as described in the pll-file entry. If directory information is included, that location (relative to the current directory if relative), will be looked in but nowhere else. The file type defaults to .pll
if unspecified. Note that some pll files have type .epll
.
Note that build-lisp-image does not create a pll file so it is an error to specify a non-existent file as the value of this argument.
pll files are created by the program cvdcvt
. See the definition of that program and also the discussion of pll files in miscellaneous.html. See also generate-application and delivery.html.
:print-startup-message
:quiet
(ignored on Windows)
nil
nil
, output during the build is written to a temporary file. If the build completes with no error, the file is deleted. If an error is signaled during the build, the contents of the file are copied to terminal and then the file is deleted. Build output, particularly when build-lisp-image is called by generate-application or generate-executable can be voluminous and usually is only of interest when the build fails with some error. On Windows, output already goes to a new, temporary window and so this argument is ignored.:read-init-files
Default: *read-init-files*
Description: specifies the value of *read-init-files* in the new image. The value can be:
t
, meaning look in both the current directory and the home directory for init files and load sys:siteinit.cl
;
nil
, meaning read no initialization files;
:nohome
, meaning look only in the current directory and load sys:siteinit.cl
.
The default is the value of *read-init-files* in the running image.
See the document startup.html for information on initialization files and the meaning of the current and the home directories. See also :init-file-names
above.
:record-source-file-info
Default: *record-source-file-info*
Description: the value of this argument serves as the default value for *record-source-file-info* in the image to be built. By default, the value is inherited from the value in the running image.
When building a runtime (i.e. :runtime
is true), it is best to explicitly specify this argument nil
.
:record-xref-info
:require-search-list
:restart-app-function
Default: *restart-app-function*
Description: causes *restart-app-function* to be set to this value. The value must be a symbol (it cannot be a function object). See startup.html or delivery.html.
Warning 1: A function object is a legal value for *restart-app-function* but not a legal value for this argument. If the value of the variable is a function object and no value is specified for this argument, the build will fail.
Note that in earlier versions, the value of this variable in images that used the IDE (on Windows) was the function that started the IDE. In current versions, that function is the value of the *restart-init-function* described next.
:restart-init-function
Default: *restart-init-function*
Description: causes *restart-init-function* to be set to this value. The value must be a symbol (it cannot be a function object). See startup.html or delivery.html.
Note that the value of this variable on Windows in an image that starts the IDE, is cg:start-ide
. That value is likely not appropriate for an application and the build may fail if that value is used but necessary parts of Common Graphics code are not loaded into the image being built. Be sure to specify the value of this variable to be nil
or to a symbol naming a function of your own creation (or a list defining such a function) when building an image from a Lisp running the IDE.
If no value is specified for this argument, the value will default to the value of *restart-init-function* in the Lisp that's building the image.
Warning 1: In the IDE, the value of *restart-init-function* is a function that will start the IDE. So when building an image in the IDE, you should pass an explicit value for this argument unless you want the built image to start the IDE. You can pass :restart-init-function nil
to avoid running any init function.
Warning 2: A function object is a legal value for *restart-init-function* but not a legal value for this argument. If the value of the variable is a function object and no value is specified for this argument, the build will fail.
Most of the remaining keyword arguments are listed in the next table. The keyword arguments to dumplisp are also acceptable to build-lisp-image. None of these arguments inherit values from the currently running image.
:aclmalloc-heap-size
nil
(the value can come from an environment variable. See Arguments to build-lisp-image 3: defaults taken from environment variables.):aclmalloc-heap-start
nil
(the value can come from an environment variable. See Arguments to build-lisp-image 3: defaults taken from environment variables.):autoload-warning
Default: nil
Description: If true, then a report of autoloadable functions will be made to autoloads.out. If a string, it is interpreted as a filename which will be used in place of autoload.out for the report.
An autoloadable function is one for which the function definition is in fact not present in the image. Instead, instructions to load a particular file, usually a fasl file out of the bundle in the Allegro directory are present. Once the file is loaded, the true function definition is used to evaluate the call to the function that triggered the autoload.
The autoloading feature is designed to keep unneeded functionality from unnecessarily increasing the size of the running image, but to make use of functionality transparent to users. If you are building an image for use locally (say, making an image with patches) this report is likely of no interest since autoloading is typically transparent, as we said. If however, you are creating an application, you may want to know what functionality might be autoloaded since you are not permitted to distribute the files.bu bundle file from where most autoloading is done. For this reason, generate-application changes the default for this argument to t
.
The format of autoload.out is two columns, a fasl file name on the left and the function that triggers its loading on the right. Some files are loaded by many functions and so appear many times on the left.
The simplest thing to do when there are potentially autoloaded functions is to include the associated modules (by including a keyword naming the module in the list which is the value of the :lisp-files
argument). This may result in your image being larger than is actually necessary but means your app will never error because an autoload function is not available. If space is at a premium, you have to decide whether the functionality might in fact be called. Sometimes this is easy but sometimes not, as functions may be called unexpectedly by other functions you need. Careful testing is required to ensure that potentially autoloaded functions are in fact never called in your app.
:build-debug
t
t
(meaning provide extra debug information, but not interactively), :interactive
(meaning allow interactive debugging of the build), and nil
(meaning do not provide extra debug information -- this option is intended for batch builds). See Debugging an image build problem or failure.:build-input
nil
t
(meaning use the filename buildin.out or nil
(meaning do not write a file). This argument was previously called :internal-debug
.:build-output
nil
:dribble-file
.:build-executable
Default: Defaults to running image executable. Value, if specified, should be a string.
Description: this argument specifies the name of the Lisp executable that will be invoked when the process that builds the new image file is spawned. Typically, you specify a value for this argument only when
You want to use a custom executable built as described in main.html.
You want a character size in the new image that is different from the character size in the running image. See the section The character size in the resulting image for more information and examples.
Note: if build-lisp-image is being called by generate-application, the value of this argument is used by generate-application as well. The specified executable will be the one copied to the application directory. See delivery.html.
:c-heap-size
:aclmalloc-heap-size
.:c-heap-start
:aclmalloc-heap-start
.:close-oldspace
nil
:copy-shared-libraries
:debug-on-error
:discard-arglists
Default: nil
Description: Value can be nil
, :medium
, and t
.
nil
means keep all arglist information;
:medium
means discard actual symbols used and use dummy ones (thus reducing the number of symbols in the new image at the cost of the information contained in argument names);
t
means discard all arglist information.
:discard-compiler
nil
:include-compiler
must be t
if this argument is t
.:discard-local-name-info
t
t
, local name information is discarded. If nil
, it is maintained.:discard-source-file-info
(not [value of :load-source-file-info argument])
nil
.:discard-xref-info
Default: (not [value of :load-xref-info argument])
Description: Controls throwing away of cross reference information. A true value both discards cross reference info in the image being created and causes the initial value of record-xref-info and load-xref-info to be nil
.
When building a runtime (i.e. :runtime
is true), the value of this argument must be nil
. (This is counter-intuitive but since both :load-xref-info and :record-xref-info must be nil, there will be no xref info to discard.)
:dribble-file
nil
:build-output
although :dribble-file
is accepted for backwards compatibility. It is an error to specify both :dribble-file
and :build-output
. See the description of :build-output for details.:exit-after-image-build
:exit-on-missing-shared-library
nil
nil
, then any missing shared libraries implicitly reloaded when the application starts will cause the application to exit with a non-zero exit status after printing an appropriate error message.:generate-fonts
nil
ignore-command-line-arguments
nil
-
). Command-line arguments prefixed by a +
(used on Windows only) are never ignored. See the section Command line arguments in startup.html for details of command-line arguments.:include-*
:include-*
arguments except :include-debugger
, documented just below, are documented in Arguments to build-lisp-image 1 - defaults inherited from the running image above since their default values are inherited from the running image.:include-debugger
t
:initial-newspace
nil
. The value can come from an environment variable. See Arguments to build-lisp-image 3: defaults taken from environment variables.:initial-oldspace
:internal-debug
nil
:build-input
although :internal-debug
is accepted for backwards compatibility. It is an error to specify both :internal-debug
and :build-input
. See the description of :build-input for details.:lisp-heap-size
nil
(the value can come from an environment variable. See Arguments to build-lisp-image 3: defaults taken from environment variables.)(room t)
output (as resrve
). See gc.html for more general information on space allocation. Also see Table note 1: Finding available memory addresses.:lisp-heap-start
nil
(the value can come from an environment variable. See Arguments to build-lisp-image 3: defaults taken from environment variables.):lisp-files
Default: nil
Description: Allows Lisp files to be loaded before the image is created. The value of this argument is nil
or a list of files to load. The files can be a pathname, string or keyword. Keywords (examples would be :trace
and :defsys
), are passed to require. These files are loaded after custom.cl is loaded, as described below.
This argument is ignored by generate-application. Instead, files to load are specified by the required input-files argument.
:newspace
:oldspace
:opt-debug
:opt-safety
:opt-space
:opt-speed
:opt-compilation-speed
:post-load-form
nil
:lisp-files
are loaded.:pre-load-form
nil
:lisp-files
are loaded.:preserve-documentation-strings
Default: t
when build-lisp-image is called, nil
when generate-application is called.
Description: This argument sets the value of the *load-documentation* variable in the resulting image. If the value of that variable is true, then documentation strings are loaded into and can be created in the new image being created. If the value of that variable is nil
, no documentation strings are loaded and documentation strings appearing in definitions are ignored.
Note that the default value of this argument is different depending on whether build-lisp-image is called directly (default t
) or is called from generate-application (default nil
).
:restart-app-function
:restart-init-function
:runtime
Default: nil
Description: When calling build-lisp-image, the value must be nil
, as runtime images cannot be created with calls from build-lisp-image. Runtime images must be created with a call to generate-application. In a call to generate-application, the value can be nil
, :standard
, or :dynamic
. Must be nil
unless you have a runtime license and have installed necessary functionality. (Standard runtime is included with the Enterprise edition of Allegro CL and is not available with the Professional edition. Contact your account manager for information on upgrading Allegro CL Professional to Enterprise so you get Allegro Runtime, or for information on adding Allegro CL Dynamic Runtime to an enterprise edition.)
See runtime.html for more information. See particularly the discussion in that document of what values other arguments (such as :include-compiler and :include-devel-env) must be.
:server-name
nil
nil
.:show-window
:showna
:show-window
keyword to run-shell-command, used to start the process to build the image being created. See the page for run-shell-command to see the other allowable values for this argument.:splash-from-file
nil
:temporary-directory
:us-government
nil
t
by any user employed by or acting on behalf of the United States Government. The only effect is to change the copyright banner to include language required by US copyright laws relating to US Government use. All other users can specify nil
or leave unspecified. Only for the United States Federal Government. State and local governments in the United States and all governmental entities outside the United States can specify nil
or leave unspecified.:user-shared-libraries
<
nil
nil
, should be a list of pathnames or strings naming pathnames. These files are copied to the destination directory and they are loaded upon application image startup. An error will be signaled by generate-application if files listed cannot be found in order to be copied to the destination directory.:verbose
nil
:wait
To successfully allocate the heap, you will need to move the starting address of the Lisp heap to a location large enough to support a contiguous address range specified by the heap size you chose. If you evaluate the following forms in Allegro CL, a memory map of the current state of virtual memory on your machine will be printed to the file filename.ext (except on the IBM RS/6000 where the output file will say only that the information is not available). Note that you may use any filename and extension.
* :char)))
(ff:def-foreign-call memory_status_dump ((filename (nil :strings-convert t)
:arg-checking
"filename.ext") (memory_status_dump
The output differs for different platforms, but in all (except the RS/6000) cases, a set of address ranges is provided showing what ranges are allocated.
The value of the filename may be 0, causing the information to be printed to the terminal (on Windows, if the filename argument is 0, then the Console is used as output). You may get a warning if you specify 0 as the filename argument. It can be ignored.
Permissions on Windows are shown in the last four characters in the output:
r
- read accessw
- write accessx
- execute accessc
- mapped copy on write (and has not been copied yet).You will need to locate a large chunk of free memory and specify to build-lisp-image a starting address that will support your heap size.
The default value of the close-oldspace keyword arguments in nil
. If its value is specified true, the following is evaluated just before the image being built is created (newspace is the value of the :newspace
keyword argument described above, oldspace is the value of the :oldspace
keyword argument also described above):
(sys:resize-areas0
:old - (/ *newspace* 2) (* 1025 50))
:new (t
:global-gc t)
:tenure nil)
(sys:resize-areas :old *oldspace* :sift-old-areas setf (sys:gsgc-parameter :open-old-area-fence) -1) (
See:
:open-old-area-fence
gsgc parameter is described and closed old areas are described. The value -1 means close all old areas except the newest one.As described in gc.html, closed old areas are never gc'ed, so objects in them and objects they point to are never considered garbage. The idea is that the image being created is an application, and the application machinery is being loaded. That machinery will never become garbage, so it saves time if the garbage collector never looks at it. Data to be used by the application is loaded after the image is created. That data will be tenured to the open old areas, and thus will be garbage collected. This allows faster global gc's to clear out data sets when they are no longer needed.
The arguments aclmalloc-heap-start, aclmalloc-heap-size, initial-newspace, initial-oldspace, lisp-heap-start, lisp-heap-size, newspace, and oldspace all take a number of bytes as a value. You can express this number as a positive integer or as a string which is a decimal or hex integer optionally followed by the letter k
, m
, or g
(case does not matter). k
means multiple the integer by 1024 (i.e. kilobytes), m
by 10241024 (i.e. megabytes), and g
by 10241024*1024 (i.e. gigabytes). Hex values should be prefixed by "0x" or #x". So 1048576, "1048576", "1024K", "0x400k" and "#x400K" are all the same as "1m"; "168577466368", 168577466368, "164626432k", "0x9d00000K", and "160768m" are all the same a "157g". We recommend using letter modifiers for large values as sometimes very large integers can overflow when read.
The value of the :splash-from-file
argument, if non-nil
, must be a string naming a BMP file. There are other image file formats (jpg, png, etc.) but the Windows system code (called by Allegro CL) which displays the spash screen is hardwired for BMP files only. Non-BMP image file can be converted to BMP image files in Common Graphics (see load-pixmap and save-pixmap. Other programs outside of Allegro CL can also make that conversion.
build-lisp-image will take certain defaults from the values of environment variables if these are set when build-lisp-image is called. The following table shows the arguments and the name of the associated environment variable.
All these arguments do not inherit values from the running Lisp image (the one which calls build-lisp-image). See Arguments to build-lisp-image 2 - defaults not inherited from the running image above for more information on these argument and their default values.
If an environment variable has a value, it overrides a specified value in the call to build-lisp-image. This allows having different values then called for in scripts without modifying the script.
Argument | Associated Environment Variable |
---|---|
:aclmalloc-heap-size |
ACL_BUILD_ACLMALLOC_HEAP_SIZE |
:aclmalloc-heap-start |
ACL_BUILD_ACLMALLOC_HEAP_START |
:initial-newspace |
ACL_BUILD_INITIAL_NEWSPACE |
:initial-oldspace |
ACL_BUILD_INITIAL_OLDSPACE |
:lisp-heap-size |
ACL_BUILD_LISP_HEAP_SIZE |
:lisp-heap-start |
ACL_BUILD_LISP_HEAP_START |
:newspace |
ACL_BUILD_NEWSPACE |
:oldspace |
ACL_BUILD_OLDSPACE |
Starting in Allegro CL 6.2, the method for debugging a failed or problematic image build has been simplified, and unified for all platforms. (In earlier releases, behavior was different for Windows and UNIX.) As part of the changes, the debug-on-error, exit-after-image-build, and wait keyword arguments to build-lisp-image (and therefore to generate-application) have been removed. An error is signaled if they are specified. In their place is a new keyword argument build-debug. In this section, we discuss that argument and the general issue of debugging builds.
build-lisp-image spawns another Lisp to build the desired image (that is one reason why the new image does not inherit from the calling image). If there is a problem, it is this spawned image that one wants to debug. Debugging the image in which you called build-lisp-image or generate-application is not useful because the problem is not manifested in that image.
The problem is usually caused by a Lisp error being signaled. If the spawned image exits at that point, it will exit with a non-zero status. As we describe just below, specifying the build-debug keyword argument as :interactive
causes the spawned image not to exit and allows interactive debugging.
It is possible that a warning will be signaled during the build. Warnings will not typically cause the build to fail, but are legitimate causes for concern. If you want to debug a warning, call build-lisp-image or generate-application specifying :pre-load-form '(setf *break-on-signals* t)
. This will cause an error when the warning is signaled.
The choices for debugging are:
Interactively debugging the spawned process. For this option, specify :build-debug :interactive
(see :build-debug). In the event of an error, the spawned process started to build the image does not exit, allowing the problem to be debugged. When you find the cause of the problem, correct the argument values or the input files and run build-lisp-image or generate-application again. Do not try to continue the process you are debugging through to a new image or distribution.
Get debugging information but do not debug interactively. For this option, specify :build-debug t
or leave the value unspecified, as t
is the default (see :build-debug). The spawned process will exit with a non-zero status at the end of the build, error or not, but will print a backtrace at the point of error. On Windows, the default behavior, with no + command-line arguments, is that when Lisp exits with a non-zero status, the console requires manual closing.
Get minimal debugging information. For this option, which is intended for batch (no operator) builds, specify :build-debug nil
(see :build-debug). The spawned process is invoked with -batch command-line argument. No backtrace is provided. The console will close automatically regardless of error status.
Here are examples using the various values of build-debug. The file foo.cl includes the form at the top-level (setq x y)
, but y
does not have a value.
This call in the calling process spawns the process which will attempt the build. Note that :build-debug is t, so the spawned process will exit (its window will remain, however, until you close it by clicking on the Close button).
3): (build-lisp-image "foo.dxl"
cl-user("foo.cl") :build-debug t)
:lisp-files '(= 1
Initial generation spread 10492920 bytes for old space
Allocated 5242880 bytes for new space
Allocated ;;;;;;;;;;...
...#|
(let ((*libfasl* nil) (*global-gc-behavior* nil))
(tenuring (load "foo.cl")))
|#
; Loading /stuff1/acl/acl70/src/foo.cl
error): Script /tmp/genappa149d19b aborted due to error:
Error (from the value of the unbound variable
Attempt to take
`y'.
Evaluation stack:
"Error" #<simple-error @ #x71f252aa>
(excl::internal-invoke-debugger nil)
error "Script ~a aborted due to error: ~a" #1="/tmp/genappa149d19b"
(#x71f2507a>)
#<unbound-variable @ 1#)
(excl::process-script #
->(tpl:start-interactive-top-level0/1 @
#<terminal-simple-stream [initial terminal io] fd #x711751f2>
nil)
#<Function top-level-read-eval-print-loop>
(excl::start-lisp-execution); Auto-exit
; Exiting Lisp
the exit status]
[Perhaps a messsage about ;; You may examine the window of the spawned Lisp.
;; When you have finished examining it, click the Close
;; button to close it, and then you will see back in the
;; calling process:
Error: image creation failedcondition type: simple-error]
[
Restart actions (select using :continue):0: Return to Top Level (an "abort" restart).
1: Abort entirely from this process.
1] cl-user(4): [
This call in the calling process spawns the process which will attempt the build. Note that :build-debug is nil, so the spawned process will exit.
5): (build-lisp-image "foo.dxl" :lisp-files '("foo.cl")
cl-user(nil)
:build-debug = 1
Initial generation spread 10492920 bytes for old space
Allocated 5242880 bytes for new space
Allocated ;;;;;;;...
...#|
(let ((*libfasl* nil) (*global-gc-behavior* nil))
(tenuring (load "foo.cl")))
|#
; Loading /stuff1/acl/acl70/src/foo.cl
error): Script /tmp/genappa149d19c aborted due to error:
Error (from the value of the unbound variable
Attempt to take
`y'.; Auto-exit
; Exiting Lisp
Error: image creation failedcondition type: simple-error]
[
Restart actions (select using :continue):0: Return to Top Level (an "abort" restart).
1: Abort entirely from this process.
1] cl-user(6): [
This call in the calling process spawns the process which ;; will attempt the build. Note that :build-debug is :interactive, ;; so the spawned process will not exit.
1): (build-lisp-image "foo.dxl" :lisp-files '("foo.cl")
cl-user(
:build-debug :interactive); Fast loading /stuff1/acl/acl70/src/code/build.fasl
= 1
Initial generation spread 10492920 bytes for old space
Allocated 5242880 bytes for new space
Allocated ;;;;;;...
...#|
(let ((*libfasl* nil) (*global-gc-behavior* nil))
(tenuring (load "foo.cl")))
|#
; Loading /stuff1/acl/acl70/src/foo.cl
the value of the unbound variable `y'.
Error: Attempt to take condition type: unbound-variable]
[
Restart actions (select using :continue):0: Try evaluating y again.
1: Use :y instead.
2: Set the symbol-value of y and use its value.
3: Use a value without setting y.
4: retry the load of foo.cl
5: skip loading foo.cl
6: recompile /stuff1/acl/acl70/src/foo.cl
7: Abort entirely from this process.
[Current process: Initial Lisp Listener]1] cl-user(1): :zo :all t
[
Evaluation stack:
4 more newer frames ...
...
5 y)
(excl::cer-general-error-handler-one
(sys::..context-saving-runtime-operation)
(sys::..runtime-operation)eval y)
(excl::%setq x y)
->(eval ]
[... excl::%eval (setq x y))
(
(excl::sloload
#<file-simple-stream"/stuff1/acl/acl70/src/foo.cl" for input pos 32 @
#p#x71f237ba>)
(excl::load-from-stream-or-bundle
#<file-simple-stream"/stuff1/acl/acl70/src/foo.cl" for input pos 32 @
#p#x71f237ba>
"/stuff1/acl/acl70/src/foo.cl" ...)
#p-2 "foo.cl" t ...)
(excl::load
... more older frames ...
[Current process: Initial Lisp Listener]1] cl-user(2):
[
;; You are still at a prompt in the spawned process.
It is possible that the spawned image will fail without signaling a Lisp error. In that case, it will also exit with a non-zero status, but interactive debugging is not, of course, possible. However, this is rare. If it happens, please save any messages that are printed and try the build again (to ensure that it was not a transient problem that caused the failure). If the retry fails, send a bug report to [email protected].
To get maximal information about the invocation of the spawned process caused by your call to build-lisp-image (or generate-application add the arguments:
"input.txt" :verbose t :build-output "output.txt" :build-input
"input.txt" and "output.txt" are filenames -- any filename with any valid path will do, of course. Here is what the build-lisp-image form looks like:
(excl:build-lisp-image <image-file> "input.txt" :verbose t
:build-input "output.txt"
:build-output <your arguments>)
This causes the actual command starting the Lisp that builds the new dxl (along with other stuff) to be printed to the listener where the build-lisp-image command was issued.
Generated (by the :build-input argument) is the file "input.txt" which contains the Lisp forms passed to the spawned Lisp. It looks roughly like:
(excl:set-case-mode :case-sensitive-lower) (common-lisp:force-output)
(common-lisp:progn (common-lisp:setq excl::*store-documentation* common-lisp:nil)
(common-lisp:setq excl:*record-source-file-info* common-lisp:nil)
(common-lisp:setq excl:*load-local-names-info* common-lisp:nil) [...]
Generated (by the :build-output argument) is the file "output.txt" which contains essentially a dribble output from the spawned process.
The file sys:custom.cl in the Allegro directory is loaded into the new image at the end of the building process but just before the files specified by :lisp-files
are loaded. If you are running generate-application, sys:custom.cl is loaded before the files specified by the (required) input-files argument are loaded.
sys:custom.cl, as delivered, contains various things, either commented out or marked with #+ignore
. For example, certain forms setting values to the defaults used in previous versions of Allegro CL are provided, preceded by #+ignore
so they will not be read unless the #+ignore
is removed. (See the section Features present or missing from *features* in Allegro CL in implementation.html for information on #+ignore
.)
During the build, all patch files in [Allegro Directory]/update relevant to the products included in the image (as coded by the filenames) are loaded into the image during the build.
When building a lisp image, specifying nil
for include-tpl will cause a greatly reduced top-level functionality to be built into the lisp. The sole purpose of this minimal top-level is to reduce the space used by the full top-level. Applications which do not require a top-level or which provide their own will often specify include-tpl nil
. The minimal top level described here will be available in such images.
The entire text of the minimal top level functionality is given below. Note that this code is loaded only if include-tpl is nil
. The top-level code when include-tpl is true is quite different.
defpackage :top-level
(:nicknames :tpl)
(:use :common-lisp :excl)
(20)
(:size
(:import-from :excl excl::read-eval-print-loop)
;; These are the function handlers for the top-level commands.
;; They are user visible.
; user-defined read-eval-print-loop
(:export #:*read-eval-print-loop* ; the top-level reader
#:*read* ; the top-level evaler
#:*eval* ; the top-level printer
#:*print*
))
provide :tpl-user)
(
in-package :top-level)
(
;; simple default tpl handlers:
defvar *read-eval-print-loop* 'default-read-eval-print-loop)
(setq *read* 'read)
(setq *eval* 'eval)
(setq *print* 'print)
(
declaim (special *break-level*))
(setq *break-level* 0)
(
defun start-interactive-top-level (*terminal-io*
(function args
&key initial-bindings
&aux vars vals)
declare (:discard-source-file-info))
(setf (getf (excl::stream-property-list *terminal-io*) 'initial-listener)
(
sys::*current-process*)
;; Compute the list of special variables and bindings for progv.
dolist (b initial-bindings)
(unless (member (car b) vars :test #'eq)
(push (car b) vars)
(push (eval (cdr b)) vals)))
(progv vars vals
(setq vars nil vals nil) ;free up space
(apply function args)))
(
defun top-level-read-eval-print-loop ()
(declare (:discard-source-file-info))
(loop
(setq *evalhook* nil *applyhook* nil)
(catch ':top-level-reset (read-eval-print-loop :level 0))
(
))
defun read-eval-print-loop (&key &allow-other-keys)
(declare (:discard-source-file-info))
(let (pop-type cval1 cval2)
(loop
(multiple-value-setq (pop-type cval1 cval2)
(catch 'top-level-break-loop
(funcall *read-eval-print-loop*)))
(;; If we get here and pop-type is not null, then a throw
;; to 'top-level-break-loop was done (by a different toplevel)
case pop-type
(
((:pop :debug-pop)when (plusp cval1)
(
(excl::funcall-in-package :debug-pop :debuggernil (1- cval1) (1- cval2))))
error "user toplevel can't handle this pop type: ~s" pop-type)))))
(
defun default-read-eval-print-loop ()
(loop
(;; print the prompt
fresh-line *terminal-io*)
(princ "// " *terminal-io*)
(force-output *terminal-io*)
(let* ((exp (funcall *read*))
(funcall *eval* exp)))
(res (funcall *print* res *terminal-io*)))) (
The minimal top-level is set up by default to issue a "//" prompt. It only accepts lisp evaluable expressions as "commands", and does not interpret any other top-level commands.
Example on a sparc:
$ mlisp -I umsloadxcomp.dxl -qq
Loading /release/duane/acl70/src/libacl70pf23.so.
Mapping umsloadxcomp.dxl...done.
Mapping umclxcomp.pll.
Allegro CL 7.0
Copyright (C) 1985-2004, Franz Inc., Oakland, CA, USA. All Rights Reserved.
// (room)
area address(bytes) cons symbols other bytes
8 bytes each 24 bytes each
(free:used) (free:used) (free:used)
Top #x81dc000
New #x8180000(376832) 918:3158 254:0 246536:37944
New #x8124000(376832) ----- ----- -----
Old #x8000c40(1192896) 781:15523 135:5628 518896:397344
Root pages: 34
Lisp heap limit: 67108864
NIL
// (exit)
; Exiting Lisp
$
If the power of the normal top-level is needed after a (non-runtime) minimal top-level lisp is built, :toplevel
can be required. However, simply requiring :toplevel
is not enough to start the regular top-level listener; instead, the listener must be invoked recursively, either by an error or by any command (such as inspect) that starts a new listener level. At that time, top-level commands (such as :zoom, etc) can be invoked.
Note however that when :toplevel
is required, the read-eval-print-loop is reset, and so a :reset command will make it appear as if the Lisp had always had a normal top-level.
;; In this example, an error can be debugged after the fact by requiring
;; the normal top-level.
$ mlisp -I umsloadxcomp.dxl -qq
Loading /release/duane/acl70/src/libacl70pf23.so.
Mapping umsloadxcomp.dxl...done.
Mapping umclxcomp.pll.
Allegro CL 7.0
Copyright (C) 1985-2004, Franz Inc., Oakland, CA, USA. All Rights Reserved.
// (require :toplevel)
; Fast loading /acl70/src/code/toplevel.fasl
; Fast loading /acl70/src/code/frame.fasl
; Fast loading /acl70/src/code/r/rframe.fasl
T
// a
Error: Attempt to take the value of the unbound variable `A'.
[condition type: UNBOUND-VARIABLE]
Restart actions (select using :continue):
0: Try evaluating A again.
1: Use :A instead.
2: Set the symbol-value of A and use its value.
3: Use a value without setting A.
[1] USER(1): :zo
; Autoloading for TOP-LEVEL::ZOOM-COMMAND:
; Fast loading /acl70/src/code/tpl-debug.fasl
; Autoloading for package "DEBUGGER":
; Fast loading /acl70/src/code/debug.fasl
Evaluation stack:
->(EXCL::INTERNAL-INVOKE-DEBUGGER "Error" #<UNBOUND-VARIABLE @ #x81b9f8a> ...)
(ERROR #<UNBOUND-VARIABLE @ #x81b9f8a>)
(SYS::..CONTEXT-SAVING-RUNTIME-OPERATION)
(EVAL A)
(TPL:TOP-LEVEL-READ-EVAL-PRINT-LOOP)
(TPL:START-INTERACTIVE-TOP-LEVEL #<BIDIRECTIONAL-TERMINAL-STREAM [initial terminal io] fd 0/1 @ #x80439ba>
#<Function TOP-LEVEL-READ-EVAL-PRINT-LOOP @ #x804d22a> ...)
(to see any ghost frames, the disassembler must be loaded)
[1] USER(2): :res
USER(1):
;; Note in this example a variable is inspected after setting it,
;; to indicate the state of the lisp before the new top-level is
;; pulled into the lisp. Note also that we wrap a progn which will
;; return a final nil value, so as not to see a huge printout due to
;; the lack of *print-level*/*print-length* controls.
$ mlisp -I umsloadxcomp.dxl -qq
Loading /acl70/src/libacl70pf23.so.
Mapping umsloadxcomp.dxl...done.
Mapping umclxcomp.pll.
Allegro CL 7.0
Copyright (C) 1985-2004, Franz Inc., Oakland, CA, USA. All Rights Reserved.
// (progn (setq x (excl::get-objects 7)) nil)
NIL
// (require :toplevel)
; Fast loading /acl70/src/code/toplevel.fasl
; Fast loading /acl70/src/code/frame.fasl
; Fast loading /acl70/src/code/r/rframe.fasl
T
// (inspect x)
; Autoloading for INSPECT:
; Fast loading /acl70/src/code/inspect.fasl
A simple T vector (5649) @ #x81a506a
0-> fixnum 5629 [#x000057f4]
1-> The symbol CL:NIL
2-> The symbol T
3-> The symbol EXCL::ER-WNAERR
4-> The symbol EXCL::ER-GENERAL-ERROR-HANDLER-ZERO
5-> The symbol EXCL::ER-GENERAL-ERROR-HANDLER-ONE
6-> The symbol EVAL
7-> The symbol EXCL::INTERPRETED-FUNCALL
8-> The symbol EXCL::+_2OP
9-> The symbol EXCL::GC-AFTER
10-> The symbol EXCL::*WITHOUT-INTERRUPTS*
11-> The symbol EQUAL
12-> The symbol *PACKAGE*
13-> The symbol *LISP-PACKAGE*
14-> The symbol *KEYWORD-PACKAGE*
15-> The symbol EXCL::INTERN*
16-> The symbol EXCL::FASL-FIND-PACKAGE
17-> The symbol EXCL::CONVERT-TO-INTERNAL-FSPEC
18-> The symbol *COMPILER-PACKAGE*
19-> The symbol *SYSTEM-PACKAGE*
20-> The symbol EXCL::CONVERT-TO-EXTERNAL-FSPEC
21-> The symbol SYS::LISP-BREAKPOINT
22-> The symbol EXCL::HANDLE-PENDING-SIGNAL
23-> The symbol EXCL::SET-FUNCTION
24-> The symbol EXCL::.INV-MACRO-FUNCTION
...
5648-> The symbol NIL
[1i] USER(1):
The following variables are maintained or used by the minimal top-level:
tpl:*read-eval-print-loop*
: Must be true - the function to be used as the read-eval-print-loop. Initially set to the tpl::default-read-eval-print-loop
as shown in the code above, where tpl::default-read-eval-print-loop
is also defined. This variable only exists in minimal top-level lisps. This variable does not have a separate descriptions page.If *read-eval-print-loop*
is set to a value other than tpl::default-read-eval-print-loop
, then the three read/eval/print variables are not used. Normally, this variable should not be set unless it is desired to remove all possible user interaction with lisp. If a replacement top-level is supplied, it is recommended that all possible errors be handled explicitly with handlers.
The top-level variables in the table with links are also discussed in Top-level variables in top-level.html.
Copyright (c) Franz Inc. Lafayette, CA., USA. All rights reserved.
|
Allegro CL version 11.0 |