cl-ncurses
vindarel opened this issue · 5 comments
Hello!
As a blog comment, here's my complain: I was excited, thanks for the snippet, but failed to run the ncurses example :(
(ql:quickload :cl-ncurses)
(defpackage :curse
(:use :cl
:cl-ncurses)
(:shadowing-import-from :cl-ncurses
:timeout))
(in-package :curse)
(defun main (&rest argv)
"This example is based on:
https://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/windows.html"
(declare (ignorable argv))
(initscr)
(start-color)
(init-pair 1
color_red
color_black)
…
sbcl --load ncurses.lisp
=>
; Loading "cl-ncurses"
;
; caught STYLE-WARNING:
; Undefined alien: "stdscr"
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
While evaluating the form starting at line 71, column 0
of #P"/home/vince/bacasable/bacalisp/ncurses.lisp":
debugger invoked on a SB-KERNEL::UNDEFINED-ALIEN-FUNCTION-ERROR in thread
#<THREAD "main thread" RUNNING {10005E85B3}>:
The alien function "initscr" is undefined.
I installed ncurses-dev
, alias libncurses5-dev libncursesw5-dev
, to no avail. Not searching longer :]
ps: if you want blog comments, I like blog comments linked to Github with Uterances: https://utteranc.es/
pps:
Full examples are available here: --no link--
Which OS do you have?
And which libraries were loaded by UFFI?
I have OSX and for me it shows:
POFTHEDAY> uffi::*loaded-libraries*
("/usr/lib/libncurses.dylib")
Which is a symlink to /usr/lib/libncurses.5.4.dylib
not Debian actually but Ubuntu, and *loaded-libraries*
returns NIL. I'll try to install more ncurses[-dev] dependencies.
I found that cl-ncurses has these paths built in:
(defvar *ncurses-search-paths*
#-win32'("/usr/local/lib64/" "/usr/local/lib/" "/lib64/" "/lib/" "/usr/lib64/" "/usr/lib/")
#+win32'("/users/jacob/src/pdc31dll/"))
But on Ubuntu Bionic libncurses lies here:
/lib/x86_64-linux-gnu/libncurses.so.5.9
Add this line before (initscr)
in the main function:
(uffi:load-foreign-library "/lib/x86_64-linux-gnu/libncurses.so.5.9"
:module "cl-ncurses")
BTW, thank you, @vindarel! I've added comments to the site!
Great*2! it works for me.