无法使用UFFI加载libncurses

时间:2013-07-02 02:29:33

标签: ubuntu lisp common-lisp ncurses quicklisp

我在Ubuntu 13.04上使用quicklisp安装的cl-ncurses运行从apt安装的SBCL,我遇到了通过UFFI加载本机ncurses的问题。

初始会议如下:

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.

这是正确的,因为尝试运行ncurses相关代码会产生:

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)

如果我尝试手动加载它(从cl-ncurse的package.lisp中窃取相关代码), 我得到以下结果:

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

我添加了最后两个搜索路径。安装libncurses5-dev并运行应用程序 在ncurses运行正常。试图在我的机器上找到.so文件,我得到:

% 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

到达libncurses.so的路径包含在搜索路径中。关于如何让UFFI加载ncurses的任何想法?

1 个答案:

答案 0 :(得分:1)

我最终通过添加符号链接来实现这一点,如下所示:

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

对符号链接64位构建而不是32位构建很重要。这个想法来自这个github页面:

https://github.com/chadbraunduin/hackernews