Question

I am running SBCL installed from apt on Ubuntu 13.04 with quicklisp-installed cl-ncurses and I am running into issues loading native ncurses via UFFI.

The initial session goes like this:

This is SBCL 1.1.1.0.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.
\* (asdf:oos 'asdf:load-op :cl-ncurses)
WARNING: Unable to load ncurses.

Which holds true, because attempting to run ncurses related code yields:

debugger invoked on a SB-KERNEL::UNDEFINED-ALIEN-FUNCTION-ERROR in thread
#<THREAD "main thread" RUNNING {10029C0E83}>:
  Attempt to call an undefined alien function.

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

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-KERNEL::UNDEFINED-ALIEN-FUNCTION-ERROR)

If I attempt to load it manually (stealing the relevant code from cl-ncurse's package.lisp), I get the following result:

\* (asdf:load-system 'uffi)

T
\* (uffi:find-foreign-library "libncurses" '("/usr/local/lib64/" "/usr/local/lib/" "/lib64/" "/lib/" "/usr/lib64/" "/usr/lib/" "/usr/lib32" "/usr/lib/x86_64-linux-gnu") :types '("so" "a"))

NIL

Where I added the last two search paths. libncurses5-dev is installed and applications running on ncurses run fine. Attempting to find the .so file on my machine, I get:

% locate libncurses.so
/lib/i386-linux-gnu/libncurses.so.5
/lib/i386-linux-gnu/libncurses.so.5.9
/lib/x86_64-linux-gnu/libncurses.so.5
/lib/x86_64-linux-gnu/libncurses.so.5.9
/lib32/libncurses.so.5
/lib32/libncurses.so.5.9
/usr/lib/x86_64-linux-gnu/libncurses.so
/usr/lib32/libncurses.so

The paths that reach a libncurses.so are included in the search path. Any ideas as to how to get UFFI to load ncurses?

Was it helpful?

Solution

I ultimately got this to work by adding a symlink, like the following:

% sudo ln -s /lib/x86_64-linux-gnu/libncurses.so.5.9 /usr/lib/libncurses.so 

It was important to symlink the 64-bit build rather than the 32-bit one. The idea came from this github page:

https://github.com/chadbraunduin/hackernews

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top