home texts sources

Lisp on FreeBSD notes

Author: Yegor Samusev <yegor@samusev.pp.ru>
Modified:2010-07-02

Contents

Implementations of Common Lisp

Implementation URL Compiler? Port
CLISP http://clisp.cons.org/   lang/clisp
Clozure CL (CCL) http://clozure.com/clozurecl.html + lang/ccl
Embeddable Common Lisp (ECL) http://ecls.sourceforge.net/   lang/ecl
Steel Bank Common Lisp (SBCL) http://www.sbcl.org/ + lang/sbcl

SBCL

SBCL already has the ASDF and the ASDF-Install packages.

Base actions on SBCL

Install a package (it is a bad way):

(require :asdf-install)

(asdf-install:install :package)
; or
(asdf-install:install "http://example.org/package.tar.bz2")
; or
(asdf-install:install "/tmp/package.tar.bz2")

Load a package:

(require :asdf)
(require :package) ; or (asdf:load-system :package)

Load a Weblocks example:

(push #p"/tmp/clbuild/source/weblocks/examples/simple-blog/" asdf:*central-registry*)
(require :simple-blog)
(simple-blog:start-simple-blog :port 8888)

.sbclrc

You saw how it's horrible to load packages. Make life simpler. Just add in your .sbclrc:

(require :asdf)
(setq asdf:*central-registry* nil)
(push (pathname (concatenate 'string
                             (sb-unix::posix-getenv "HOME")
                             "/clbuild/systems/"))
      asdf:*central-registry*)
(push (pathname (concatenate 'string
                             (sb-unix::posix-getenv "HOME")
                             "/clbuild/source/weblocks/examples/simple-blog/"))
      asdf:*central-registry*)

Now you can easily load any package:

(require :package)

Hacks for bugs

CL-PNG

URL:http://www.cliki.net/CL-PNG
Version:0.6

You can test the package by defining and calling the rotate function:

(rotate
 (concatenate 'string
              (sb-unix::posix-getenv "HOME")
              "/.sbcl/site/cl-png-0.6/PngSuite/basn0g01.png")
 "/tmp/output.png")
grovel.lisp

Change the include directory:

(flag "-I/usr/local/include")
libpng.lisp

Change the prefix for the shared library:

(define-foreign-library libpng
;;  (:unix (:or "libpng12.0.dylib" "libpng12.dylib" "libpng12.so.0"))
  (t (:default "libpng")))

Change the constant for the current libpng version:

(defconstant +png-libpng-ver-string+ (symbol-name '|1.4.1|))

LIFT

URL:http://www.cliki.net/LIFT
Version:1.7.0

It can be an error message while compiling the package:

;   READ failure in COMPILE-FILE:
;     SB-INT:SIMPLE-READER-PACKAGE-ERROR at 7651 (line 199, column 39) on #<SB-S
YS:FD-STREAM
;                                                                           for
"file /usr/home/garcon/.sbcl/site/lift/dev/utilities.lisp"
;                                                                           {5A3
91AF1}>:
;       package "MOP" not found
; compilation aborted after 0:00:03.076

I've found the same problem in the message of the lift-devel mailing list. There are also two patches:

by Warren Lynn which I tried to use manually but in my case they doesn't help me... There was another compilation error...

There is the similar discussion thread ru in the fucking LOR community ru but there is no an answer.

The main solution for the current time (I hope in the future the maintainer will fix the bug) is to use the clbuild script to install packages. I have successfully installed the Hunchentoot web server and all its dependences. The LIFT package wasn't compiled (because there isn't need) but the server worked well.

CLISP

You must install the ASDF first of all:

%cd $HOME
%mkdir -p lisp
%cd lisp
%fetch http://common-lisp.net/project/asdf/asdf.lisp
asdf.lisp                                     100% of  135 kB   64 kBps

Then run the CLISP and try to load the ASDF:

> (load "asdf.lisp")
;; Loading file asdf.lisp ...
;; Loaded file asdf.lisp
T

If all is OK, you can see a version of the package:

> (asdf:asdf-version)
"2.000"

Base actions on CLISP

Load a package:

(load "asdf.lisp")
(push (pathname "/tmp/clbuild/systems/") asdf:*central-registry*)
(asdf:load-system :package)

.clisprc.lisp

(load "asdf.lisp")
(push (pathname "...") asdf:*central-registry*)

Hacks for bugs

CL-JSON

I've got an error when try to load CL-JSON:

;; Compiling file /tmp/lispdev/clbuild/source/cl-json/src/encoder.lisp ...
*** - SYSTEM::LINE-COMMENT-READER: Invalid byte #xC3 in CHARSET:ASCII
      conversion

Maybe it helps:

(setf *default-file-encoding* charset:utf-8)

THREADS (?)

I've got an error when try to load BORDEAUX-THREADS:

;; Compiling file /tmp/lispdev/clbuild/source/bordeaux-threads/src/impl-clisp.lisp ...
*** - READ from
       #<INPUT BUFFERED FILE-STREAM CHARACTER
         #P"/tmp/lispdev/clbuild/source/bordeaux-threads/src/impl-clisp.lisp"
         @90>
      : #<PACKAGE THREADS> has no external symbol with name "THREAD-JOIN"

USOCKET

I've got an error when try to load USOCKET:

;; Loading file /usr/home/garcon/.cache/common-lisp/clisp-2.48-unix-x86/tmp/lispdev/clbuild/source/usocket/backend/clisp.fas ...
** - Continuable Error
FFI::FIND-FOREIGN-FUNCTION: foreign function "gethostname" does not exist

Use the patch by Stas Boukarev or just add the string in the right place of backend/clisp.lisp:

#-win32 (:library :default)

IDE