[I sent this message on the 15th of May, 2018. But it got stuck in the moderation queue.]
Hi,
On OpenBSD when trying to load libreadline (or libereadline), one gets:
* (cffi:load-foreign-library "libreadline.so") sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgetnum' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgoto' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgetflag' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tputs' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgetent' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgetstr'
debugger invoked on a CFFI:LOAD-FOREIGN-LIBRARY-ERROR: Unable to load foreign library (LIBREADLINE.SO-431). Error opening shared object "libreadline.so": Cannot load specified object.
This is since libreadline is sometimes not linked directly against ncurses or termcap (to allow the user to decide which of the two to use). On many GNU/Linux systems, libreadline is already linked against libtinfo which provides those functions; so on those systems this is not an issue. But on OpenBSD, libreadline is not linked against it, and one needs to explicitly pass -ltinfo (or similar).
Is there some fancy way of passing the extra needed libraries in cffi?
Hello Alfred,
Have you tried explicitly loading the unlinked libraries beforehand with LOAD-FOREIGN-LIBRARY?
Cheers, Luís
(sent from my phone)
On Wed, May 29, 2019, 9:57 PM Alfred M. Szmidt ams@gnu.org wrote:
[I sent this message on the 15th of May, 2018. But it got stuck in the moderation queue.]
Hi,
On OpenBSD when trying to load libreadline (or libereadline), one gets:
- (cffi:load-foreign-library "libreadline.so")
sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgetnum' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgoto' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgetflag' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tputs' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgetent' sbcl:/usr/lib/libreadline.so.4.0: undefined symbol 'tgetstr'
debugger invoked on a CFFI:LOAD-FOREIGN-LIBRARY-ERROR: Unable to load foreign library (LIBREADLINE.SO-431). Error opening shared object "libreadline.so": Cannot load specified object.
This is since libreadline is sometimes not linked directly against ncurses or termcap (to allow the user to decide which of the two to use). On many GNU/Linux systems, libreadline is already linked against libtinfo which provides those functions; so on those systems this is not an issue. But on OpenBSD, libreadline is not linked against it, and one needs to explicitly pass -ltinfo (or similar).
Is there some fancy way of passing the extra needed libraries in cffi?
Have you tried explicitly loading the unlinked libraries beforehand with LOAD-FOREIGN-LIBRARY?
That is a good suggestion, though...
Since I upgraded the machine to OpenBSD 6.5, I cannot reproduce the failure:
* (cffi:load-foreign-library "libreadline.so") #<CFFI:FOREIGN-LIBRARY LIBREADLINE.SO-431 "libreadline.so">
And cl-readline loads file (and works). Seems that this got fixed in OpenBSD on January 15th, 2019?
https://github.com/openbsd/src/commit/ec6ecd8a570a22f0beb913e5159081d1dba024...
Thanks!