rmculpepper / racket-zeromq

Racket bindings for ZeroMQ
3 stars 2 forks source link

Cannot find libzmq foreign library on macOS #6

Open emeinhardt opened 3 years ago

emeinhardt commented 3 years ago

Steps to reproduce:

  1. brew install zeromq
  2. raco pkg install zeromq-r-lib

The last few lines of the install console output will be

WARNING: Cannot find libzmq foreign library (see "ZeroMQ Requirements"). ffi-lib: couldn't open "libzmq.5.dylib" (dlopen(libzmq.5.dylib, 6): image not found)

It's not clear to me where libzmq.5.dylib is expected to be, but here's where brew currently puts libzmq.5.dylib:

$ ls -l /usr/local/lib | grep libzmq
lrwxr-xr-x   1 emeinhardt  admin        41 Nov 18 19:57 libzmq.5.dylib -> ../Cellar/zeromq/4.3.3/lib/libzmq.5.dylib
lrwxr-xr-x   1 emeinhardt  admin        35 Nov 18 19:57 libzmq.a -> ../Cellar/zeromq/4.3.3/lib/libzmq.a
lrwxr-xr-x   1 emeinhardt  admin        39 Nov 18 19:57 libzmq.dylib -> ../Cellar/zeromq/4.3.3/lib/libzmq.dylib
rmculpepper commented 3 years ago

I would expect that location for libzmq.5.dylib to work. Does it work if you link or copy libzmq.5.dylib to one of the directories returned by (begin (require setup/dirs) (get-lib-search-dirs))?

rmculpepper commented 3 years ago

Update: This seems to be a consequence of restrictions that Mac OS places on dlopen for signed executables. I hope to fix the problem at the Racket FFI level. Meanwhile, the workaround above should work.