Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unable to load foreign library (LIBZMQ) #33

Open
hufengtao opened this issue Oct 21, 2020 · 1 comment
Open

Unable to load foreign library (LIBZMQ) #33

hufengtao opened this issue Oct 21, 2020 · 1 comment

Comments

@hufengtao
Copy link

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.

@orivej
Copy link
Owner

orivej commented Oct 22, 2020

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. (Respect CFLAGS env var and support MacPorts include directory cffi/cffi#146 could have allowed you to export CFLAGS=/usr/local/include.)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants