Search code examples
packagelispcommon-lispclisp

Clisp can't find package


I have been running a lisp program with allegro common lisp for a couple of days. I need to use clisp now but when I try to compile it I get:

SYSTEM::%FIND-PACKAGE: There is no package with name
      "COMMON-GRAPHICS-USER"

I am pretty new to lisp so I have been searching for a solution but I found none.

  • Where does clisp look for this packages?
  • How do I add them?

I suspect it is very basic but still I don't know how to solve it.


Solution

  • Packages are (essentially) namespaces in Common Lisp: symbols (ie names) are looked up using packages, usually live in packages, and there is a notion of the current package and packages know which other packages they are willing to look symbols up in and so on. So packages are not things which get loaded in the way they do, say, in Python, although packages may be created when something is loaded. (To add to the confusion, of course people call collections of code which do get loaded 'packages' as well!)

    So this kind of failure means that the current state of the package system is wrong, and in particular it is probably trying to look up a symbol (either via the reader or by some other mechanism) in a package whose name is COMMON-GRAPHICS-USER and this package does not exist. (It might also be trying to find a package directly, for instance when another package asks to use this package.)

    Unfortunately it is almost certainly the case that this package exists only in Allegro CL as part of Common Graphics, which is an ACL thing: it might be that someone has written a portable version, but I am not aware of it.

    So the chances are that the code you are trying to run is specific to Allegro CL, unfortunately.


    Note: the above is not a comprehensive description of the CL package system: if you want to understand it in detail, start with the standard. There is an old joke that there is a good reason why packages are described in chapter 11, although I personally think this is unjustified.