且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用SBCL正确保存Common Lisp图像?

更新时间:2023-11-28 19:21:46

感谢@jkiiski的帮助,此处提供了完整的说明和解决方案:

Thanks for the help from @jkiiski here is the full explanation and solution:


  1. SBCL使用额外的模块( SB-SPROF SB-POSIX 等),它们并不总是加载到图像中。这些模块位于 contrib 目录中,该目录位于 SBCL_HOME 环境变量指向的位置(如果已设置)或图像所在的位置(例如,在 / usr / local / lib / sbcl / 中)。

  1. SBCL uses extra modules (SB-SPROF, SB-POSIX and others) that are not always loaded into the image. These module reside in contrib directory located either where SBCL_HOME environment variable pointing (if it is set) or where the image resides (for example, in /usr/local/lib/sbcl/).

当映像时保存在另一个位置,并且如果未设置 SBCL_HOME ,SBCL将无法找到 contrib ,因此我看到的错误。

When an image is saved in another location and if SBCL_HOME is not set, SBCL won't be able to find contrib, hence the errors that I saw.

将SBCL_HOME设置为指向 contrib 位置(或复制 contrib 移至图像位置或将新图像移至 contrib 位置)即可解决此问题。

Setting SBCL_HOME to point to contrib location (or copying contrib to image location or new image to contrib location) solves the problem.

最后,关于roswell:roswell参数 -m 在特定位置搜索图像。对于SBCL( sbcl-bin ),它类似于〜/ .roswell / impls / x86-64 / linux / sbcl-bin / 1.3。 7 / dump / 。其次,SBCL的映像名称必须采用< name> .core 的形式。要启动它,请使用: ros -m< name> -L sbcl-bin运行。 (快速编辑:更好地使用 ros dump 使用罗斯韦尔向我指出来保存图像)

Finally, about roswell: roswell parameter -m searches for images in a specific location. For SBCL (sbcl-bin) it would be something like ~/.roswell/impls/x86-64/linux/sbcl-bin/1.3.7/dump/. Secondly, the image name for SBCL must have the form <name>.core. And to start it, use: ros -m <name> -L sbcl-bin run. (Quick edit: better use ros dump for saving images using roswell as it was pointed out to me)