1

Ubuntu 13.04 で apt からインストールされた SBCL を実行しており、quicklisp でインストールされた cl-ncurses を使用していますが、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

最後の 2 つの検索パスを追加した場所。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 をロードさせる方法についてのアイデアはありますか?

4

1 に答える 1

1

次のようにシンボリックリンクを追加することで、最終的にこれを機能させました。

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

32 ビット ビルドではなく 64 ビット ビルドをシンボリック リンクすることが重要でした。このアイデアは、この github ページから生まれました。

https://github.com/chadbraunduin/hackernews

于 2013-07-03T03:20:58.633 に答える