首页 > 解决方案 > 如何正确使用带有 quicklisp(和 sbcl)的 cxml/klacks 库?

问题描述

概述 我正在尝试运行此代码的简化版本,它需要用于 XML 解析的cxmlklacks库。(具体代码是《The Art of Postgresql》一书的第47章。)由于我对(Common)Lisp/ASDF/Quicklisp知之甚少,所以不知道如何正确安装所需的cxml/klacks库。

系统 如果有问题,我SBCL 1.5.5.debian在 Ubuntu 下使用(作为记录,我之前尝试clisp过,但我发现它带有一个非常过时的 ASDF 版本。)

到目前为止我所做的步骤

在 bash 中:

sudo apt-get install cl-cxml

(确实/usr/share/common-lisp/source/cxml//usr/share/common-lisp/source/cxml/klacks/现在出现在我的系统上。)

在 sbcl REPL 中:

(ql:quickload :cxml)

结果:一条很长的错误消息,其要点似乎是Component "cxml/dom" not found. (即使/usr/share/common-lisp/source/cxml/dom确实存在,但我不确定它是否重要。)请参阅最后的完整错误消息。

(ql:quickload :klacks)

结果:另一个长错误,其要点是System "klacks" not found(即使该目录再次存在于系统上)。

评论

用于qucikload其他库的作品,例如:

(ql:quickload :postmodern)
(ql:quickload :zip)
(ql:quickload :yason)

问题

简而言之:在上述系统上获取cxml和安装的正确方法是什么?klacks

除了解决这个具体问题之外,我还想更好地了解正在发生的事情,特别是:

详细的错误信息

* (ql:quickload :cxml)
;;; Checking for wide character support... WARNING: Lisp implementation doesn't use UTF-16, but accepts surrogate code points.
 yes, using code points.
To load "cxml":
  Load 1 ASDF system:
    cxml
; Loading "cxml"
;;; Checking for wide character support... WARNING: Lisp implementation doesn't use UTF-16, but accepts surrogate code points.
 yes, using code points.
.
;;; Checking for wide character support... WARNING: Lisp implementation doesn't use UTF-16, but accepts surrogate code points.
 yes, using code points.
;;; Checking for wide character support... WARNING: Lisp implementation doesn't use UTF-16, but accepts surrogate code points.
 yes, using code points.
;;; Building Closure with CHARACTER RUNES
To load "cxml/dom":
  Load 3 ASDF systems:
    closure-common puri trivial-gray-streams
  Install 1 Quicklisp release:
    cxml
; Loading "cxml/dom"
;;; Checking for wide character support... WARNING: Lisp implementation doesn't use UTF-16, but accepts surrogate code points.
 yes, using code points.
.
debugger invoked on a ASDF/FIND-COMPONENT:MISSING-COMPONENT in thread
#<THREAD "main thread" RUNNING {10005504C3}>:
  Component "cxml/dom" not found

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY                        ] Retry ASDF operation.
  1: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
                                     configuration.
  2:                                 Retry ASDF operation.
  3:                                 Retry ASDF operation after resetting the
                                     configuration.
  4: [ABORT                        ] Give up on "cxml/dom"
  5:                                 Give up on "cxml"
  6:                                 Exit debugger, returning to top level.

((:METHOD ASDF/OPERATE:OPERATE (SYMBOL T)) ASDF/LISP-ACTION:LOAD-OP "cxml/dom" :VERBOSE NIL) [fast-method]
   error finding frame source: Bogus form-number: the source file has probably
                               changed too much to cope with.
   source: NIL
0]

* (ql:quickload :klacks)

debugger invoked on a QUICKLISP-CLIENT:SYSTEM-NOT-FOUND in thread
#<THREAD "main thread" RUNNING {10005504C3}>:
  System "klacks" not found

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Try again
  1: [ABORT   ] Give up on "klacks"
  2:            Exit debugger, returning to top level.

((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "klacks")
   source: (CERROR "Try again" 'SYSTEM-NOT-FOUND :NAME NAME)

标签: xmlcommon-lispsbclquicklispasdf

解决方案


因为你可以加载其他系统,我假设你已经在你的系统上设置了 quicklisp。

quicklisp 上没有名为“klacks”的包。

您可以通过运行检查这一点:

(ql:system-apropos "klacks")

哪个输出:

#<SYSTEM cxml-klacks / cxml-20181018-git / quicklisp 2019-03-07>
#<SYSTEM cxml/klacks / cxml-20181018-git / quicklisp 2019-03-07>
#<SYSTEM fxml/klacks / fxml-20181210-git / quicklisp 2019-03-07>

所以你正在寻找的系统是cxml-klacks

加载它使用:

(ql:quickload "cxml-klacks")

加载很好。我的系统上的输出:

To load "cxml-klacks":
  Load 1 ASDF system:
    cxml-klacks
; Loading "cxml-klacks"
;;; Checking for wide character support... yes, using code points.
;;; Checking for wide character support... yes, using code points.
;;; Building Closure with CHARACTER RUNES

("cxml-klacks")

此外,cxml在我的系统上加载正常,但我使用的是 Clozure CL,我不确定该错误对你来说是什么。尝试加载cxml-klacks,看看是否适合您。

您也可以尝试 loading cxml/klacks,这可能是您想要的包。


推荐阅读