orivej / pzmq

ZeroMQ 4.0+ Common Lisp bindings.

Home Page:http://orivej.github.io/pzmq/doc/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to load foreign library (LIBZMQ)

hufengtao opened this issue · comments

sbcl 2.0.9
(ql:quickload "pzmq")
libzmq.so installed under path /usr/local/lib
zmq.h installed under path /usr/local/include

Error opening shared object "libzmq.so":
libzmq.so: cannot open shared object file: No such file or directory.

This is an issue about configuring CFFI to look in /usr/local/lib and /usr/local/include.

  1. If you can edit the file sbcl.mk in your (uiop:lisp-implementation-directory), then add -L/usr/local/lib to its LDFLAGS and -I/usr/local/include to its CFLAGS, and restart sbcl.

  2. Otherwise try this before loading pzmq:

(ql:quickload "cffi")
(push #p"/usr/local/lib/" cffi:*foreign-library-directories*)
(push "-I/usr/local/include" cffi-toolchain:*cc-flags*)

(You can put this code into ~/.sbclrc to perform it on sbcl startup.)

  1. If you do not want to configure CFFI in Lisp or via sbcl.mk, you can add /usr/local/lib to LD_LIBRARY_PATH or /etc/ld.so.conf, but AFAIK there is no way to use /usr/local/include. (cffi/cffi#146 could have allowed you to export CFLAGS=/usr/local/include.)