3
votes

I'm trying to install cffi package into sbcl. First, I tried clbuild that is recommended on the cffi installation page. When I tried to run :

clbuild quickload cffi

I was given an error saying :

The function ASDF::SOURCE-REGISTRY is undefined.

I then tried asdf-install, it end up complaining about

Component "cffi-examples" not found

Any help on this would be appreciated.

UPDATE

For asdf-install, I'm running sbcl with slime. It seems that whenever it complains about a component that is missing, that component is actually installed. I just have to abort the debugger and restart Emacs, start slime, and do that install again, and it will finish successfully. If I don't run it with slime, just running it inside sbcl prompt in terminal, it will keep complaining about the component missing nonstop.

So to get cffi installed with asdf-install, I had to restart Emacs for about 4-5 times.

I'm not sure if there is configuration issue with sbcl?

I suppose I should ask this question in different thread.

2

2 Answers

9
votes

It's pretty easy with Quicklisp. To install Quicklisp:

Then you can install and load CFFI like so:

  • (ql:quickload "cffi")

I wrote a bit about how I manage small projects and their required libraries at Making a small Lisp project with quickproject and Quicklisp.

3
votes

Here are the exact steps for manual installation under Windows 7:

First, download and install SBCL from:

http://www.sbcl.org/platform-table.html

Then download and untar (tar xzf ...) babel, alexandria, trivial-features, and cffi.

Then, start SBCL, load ASDF, and add the paths to these systems to asdf:*central-registry*:

C:\Program Files\Steel Bank Common Lisp\1.0.49>sbcl.exe --core sbcl.core
This is SBCL 1.0.49, 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.

This is experimental prerelease support for the Windows platform: use
at your own risk.  "Your Kitten of Death awaits!"
* (load "asdf/asdf")

T
* (push "C:/Users/dhl/build/asdf/babel_0.3.0/" asdf:*central-registry*)

("C:/Users/dhl/build/asdf/babel_0.3.0/")
* (push "C:/Users/dhl/build/asdf/alexandria/" asdf:*central-registry*)

("C:/Users/dhl/build/asdf/alexandria/" "C:/Users/dhl/build/asdf/babel_0.3.0/")
* (push "C:/Users/dhl/build/asdf/trivial-features_0.6/" asdf:*central-registry*)

("C:/Users/dhl/build/asdf/trivial-features_0.6/"
 "C:/Users/dhl/build/asdf/alexandria/" "C:/Users/dhl/build/asdf/babel_0.3.0/")
* (push "C:/Users/dhl/build/asdf/cffi_0.10.6/" asdf:*central-registry*)

("C:/Users/dhl/build/asdf/cffi_0.10.6/"
 "C:/Users/dhl/build/asdf/trivial-features_0.6/"
 "C:/Users/dhl/build/asdf/alexandria/" "C:/Users/dhl/build/asdf/babel_0.3.0/")
*

(Of course, you'd have to give your paths to the libraries instead of `"C:/Users/dhl/...")

Then, you can load CFFI:

* (asdf:load-system 'cffi)
[much compilation output]
T
*

Now, that's pretty much the bare bones way to install systems for Common Lisp. Nowadays, there is Quicklisp, which is easy to use and covered by Xach's answer. Also, note that there are better ways to register your systems with asdf, like symlinking the asd-files to a single directory on platforms that support symlinking, and ASDF 2 provides a source-registry facility, so you won't have to deal with asdf:*central-registry* at all (I still like it for REPL use).

All in all, I guess Xach's answer provides the easiest way to get a working installation of CFFI, so I recommend his answer and will vote it up, but I already started writing my article before he posted it, and maybe its of some use to you to know how to do things manually.