Attilio
Attilio

Reputation: 1722

How to properly use cxml/klacks library with quicklisp (and sbcl)?

Overview I'm trying to run a simplified version of this code, that needs the cxml and klacks library for XML parsing. (The concrete code is Chapter 47 of the book "The Art of Postgresql".) Since I know very little about (Common) Lisp/ASDF/Quicklisp, I don't know how to properly install the required cxml/klacks library.

System In case that matters, I'm using SBCL 1.5.5.debian under Ubuntu (For the records, I had tried clisp previously, but I found that it comes with a very outdated version of ASDF.)

Steps I did so far

In bash:

sudo apt-get install cl-cxml

(Indeed /usr/share/common-lisp/source/cxml/ and /usr/share/common-lisp/source/cxml/klacks/ are now present on my system.)

In sbcl REPL:

(ql:quickload :cxml)

Result: a long error message, whose gist seems to be Component "cxml/dom" not found. (Even though /usr/share/common-lisp/source/cxml/dom does exist, but I'm not sure it matters.) See complete error message at the end.

(ql:quickload :klacks)

Result: another long error, whose gist is System "klacks" not found (even though, again, the directory is present on the system).

Remark

Using qucikload for other libraries works, e.g.:

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

Questions

In short: what is the proper way of getting cxml and klacks installed on the above system?

Besides the solution to this concrete issue, I'd like to understand a bit better what is going on, in particular:

Detailed error messages

* (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)

Upvotes: 0

Views: 279

Answers (2)

Gwang-Jin Kim
Gwang-Jin Kim

Reputation: 10108

The most important is that you have installed quicklisp in your system.

Follow for that exactly the installations in grey box of here.

In short, this is:

# in mac:
$ curl -O https://beta.quicklisp.org/quicklisp.lisp
# or in linux do:
$ wget https://beta.quicklisp.org/quicklisp.lisp
# in windows download manually https://beta.quicklisp.org/quicklisp.lisp

# $ curl -O https://beta.quicklisp.org/quicklisp.lisp.asc # this I leave out
# $ gpg --verify quicklisp.lisp.asc quicklisp.lisp

# start SBCL
$ sbcl --load quicklisp.lisp # path to the downloaded quicklisp.lisp!

# in SBCL REPL install quicklisp by:
* (quicklisp-quickstart:install)

# it says:
#   ==== quicklisp installed ====
# 
#     To load a system, use: (ql:quickload "system-name")
# 
#     To find systems, use: (ql:system-apropos "term")# 
# 
#     To load Quicklisp every time you start Lisp, use: (ql:add-to-init-file)
# 
#     For more information, see http://www.quicklisp.org/beta/
# 

# test by installing vecto package:
* (ql:system-apropos "vecto")

; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp/2010-10-07/systems.txt">
; 45.30KB
==================================================
46,386 bytes in 0.50 seconds (89.70KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp/2010-10-07/releases.txt">
; 83.49KB
==================================================
85,490 bytes in 0.53 seconds (157.22KB/sec)
#<SYSTEM cl-vectors / cl-vectors-20101006-git / quicklisp 2010-10-07>
#<SYSTEM lispbuilder-sdl-cl-vectors / lispbuilder-20101006-svn / quicklisp 2010-10-07>
#<SYSTEM lispbuilder-sdl-cl-vectors-examples / lispbuilder-20101006-svn / quicklisp 2010-10-07>
#<SYSTEM lispbuilder-sdl-vecto / lispbuilder-20101006-svn / quicklisp 2010-10-07>
#<SYSTEM lispbuilder-sdl-vecto-examples / lispbuilder-20101006-svn / quicklisp 2010-10-07>
#<SYSTEM static-vectors / static-vectors-20101006-git / quicklisp 2010-10-07>
#<SYSTEM vecto / vecto-1.4.3 / quicklisp 2010-10-07>
NIL

# load it:
* (ql:quickload "vecto")
To load "vecto":
  Install 5 Quicklisp releases:
    cl-vectors salza2 vecto zpb-ttf zpng
; Fetching #<URL "http://beta.quicklisp.org/archive/salza2/2010-10-06/salza2-2.0.7.tgz">
; 14.84KB
==================================================
15,197 bytes in 0.12 seconds (125.77KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/zpng/2010-10-06/zpng-1.2.tgz">
; 38.59KB
==================================================
39,521 bytes in 0.37 seconds (103.47KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/zpb-ttf/2010-10-06/zpb-ttf-1.0.tgz">
; 42.59KB
==================================================
43,611 bytes in 0.39 seconds (110.33KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-vectors/2010-10-06/cl-vectors-20101006-git.tgz">
; 40.40KB
==================================================
41,374 bytes in 0.37 seconds (109.20KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/vecto/2010-10-06/vecto-1.4.3.tgz">
; 75.71KB
==================================================
77,526 bytes in 0.49 seconds (153.57KB/sec)
; Loading "vecto"
..................................................
[package zpb-ttf].................................
[package salza2]..................................
[package zpng]....................................
[package net.tuxee.paths].........................
[package net.tuxee.aa]............................
[package net.tuxee.aa-bin]........................
[package net.tuxee.vectors].......................
[package vecto]........
("vecto")

# highly recommended - do:
* (ql:add-to-init-file)

# this will give:

I will append the following lines to #P"/Users/quicklisp/.sbclrc":

  ;;; The following lines added by ql:add-to-init-file:
  #-quicklisp
  (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
                                         (user-homedir-pathname))))
    (when (probe-file quicklisp-init)
      (load quicklisp-init)))

Press Enter to continue. # do that!


#P"/Users/quicklisp/.sbclrc"
* (quit)
$ 

The before-last step adds the load command for setup.lisp of quicklisp to .sbclrc . Add it to any config file of the implementation you use, e.g. for clisp ad it to ~/.clisp which you create if there is none.

When installing let it install to home folder (~/quicklisp). So that path is ~/quicklisp/setup.lisp. In sbcl, you can start quicklisp by (load "~/quicklisp/setup.lisp"). If not added this load command into your ~/.sbclrc file.

Install/import klacks by:

(ql:quickload :cxml)

;; then use it by:
(klacks:<klacks-function> <args>)

;; it is one of the few packages, where you install by another name
;; but then have several names available for sub-packages!

Upvotes: 1

Capstone
Capstone

Reputation: 2282

Since you can load other systems, I assume you've gone through setting up quicklisp on your system.

There is no package named "klacks" on quicklisp.

You can check this by running:

(ql:system-apropos "klacks")

Which outputs:

#<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>

So the system you are looking for is cxml-klacks

Load it using:

(ql:quickload "cxml-klacks")

Which loads fine. Output on my system:

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")

Also, cxml loads fine on my system but I'm using Clozure CL, I'm not sure what that error is for you. Try loading cxml-klacks and see if that works for you.

You can also try loading cxml/klacks, which maybe the package you want.

Upvotes: 1

Related Questions