在Ubuntu Hardy下,我如何使用clisp中的(require :PACKAGE)?

4

我正在尝试评估这里提供的答案,但是在使用clisp时出现错误:"A file with name ASDF-INSTALL does not exist"。

dsm@localhost:~$ clisp -q
[1]> (require :asdf-install)

*** - LOAD: A file with name ASDF-INSTALL does not exist
The following restarts are available:
ABORT          :R1      ABORT
Break 1 [2]> :r1
[3]> (quit)

dsm@localhost:~$ 

cmucl会抛出类似的错误:

dsm@localhost:~$ cmucl -q
Warning:  #<Command Line Switch "q"> is an illegal switch
CMU Common Lisp CVS release-19a 19a-release-20040728 + minimal debian patches, running on crap-pile
With core: /usr/lib/cmucl/lisp.core
Dumped on: Sat, 2008-09-20 20:11:54+02:00 on localhost
For support see http://www.cons.org/cmucl/support.html Send bug reports to the debian BTS.
or to pvaneynd@debian.org
type (help) for help, (quit) to exit, and (demo) to see the demos

Loaded subsystems:
    Python 1.1, target Intel x86
    CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (require :asdf-install)


Error in function REQUIRE:  Don't know how to load ASDF-INSTALL
   [Condition of type SIMPLE-ERROR]

Restarts:
  0: [ABORT] Return to Top-Level.

Debug  (type H for help)

(REQUIRE :ASDF-INSTALL NIL)
Source: 
; File: target:code/module.lisp
(ERROR "Don't know how to load ~A" MODULE-NAME)
0] (quit)
dsm@localhost:~$ 

但是sbcl完美地工作:

dsm@localhost:~$ sbcl -q
This is SBCL 1.0.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (require :asdf-install)

; loading system definition from
; /usr/lib/sbcl/sb-bsd-sockets/sb-bsd-sockets.asd into #<PACKAGE "ASDF0">
; registering #<SYSTEM SB-BSD-SOCKETS {AB01A89}> as SB-BSD-SOCKETS
; registering #<SYSTEM SB-BSD-SOCKETS-TESTS {AC67181}> as SB-BSD-SOCKETS-TESTS
("SB-BSD-SOCKETS" "ASDF-INSTALL")
* (quit)

有没有解决这个问题的想法?我在网上找到了这篇文章,但使用它也没有起作用。

是的,抱歉。我可能应该明确提到这只适用于SBCL,但我不知道有什么其他安装Lisp库的简便方法。我得找时间看看clbuild。 - Matthias Benkard
个人而言,我总是通过SBCL安装所有东西,并在之后的所有Lisp实现中使用它。我的所有Lisp编译器都使用相同的ASDF系统注册表。 - Matthias Benkard
4个回答

3

你得到的指示明确提到了SBCL,因此我认为使用SBCL会更好。其他一些Lisp没有ASDF或没有将其与CL:REQUIRE连接起来。在前一种情况下,您需要预先加载ASDF。在后一种情况下,您需要调用(asdf:oos 'asdf:load-op)而不是(require)。


3

在尝试其他任何操作之前,请尝试以下方法:

(require :asdf)

你可以从我们使用的环境中借鉴一些想法。它可以在以下链接找到:darcsweb
请查看 environment.lisp 文件,该文件为我们加载和设置 asdf。 (sbcl 已经加载了 asdf)

3

wget http://cclan.cvs.sourceforge.net/checkout/cclan/asdf/asdf.lisp

值得一提的是,可以尝试使用clbuild。http://common-lisp.net/project/clbuild/

只需以下步骤即可启动Lisp Web服务器:

darcs get http://common-lisp.net/project/clbuild/clbuild
cd clbuild
chmod +x ./clbuild
./clbuild check
./clbuild build slime hunchentoot
./clbuild preloaded

现在会启动一个Lisp REPL。在那里,您可以输入以下内容:
* (hunchentoot:start-server :port 8080)

测试服务器的响应:

wget -O - http://localhost:8080/

<html><head><title>Hunchentoot</title></head>
 <body><h2>Hunchentoot Default Page</h2>
  <p>This is the Hunchentoot default page....

1

在clisp中使用clc:clc-require。请参考'man common-lisp-controller'。我在clisp中遇到了同样的错误,并通过使用clc:clc-require解决了它。但是,sbcl只需要使用require就可以正常工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接