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

Libsodium is not bundled when deploying the image

phoe opened this issue · comments

I tried to build a PZMQ application using Shinmera's Deploy. It has correctly found the libzmq foreign library, but it did not take into account that libzmq internally depends on libsodium. This causes the final bundle to not have the libsodium foreign library, and therefore the final executable fails to run.

A possible solution would be to manually define a CFFI libsodium dependency in PZMQ, so CFFI has a chance to list the library for later bundling by Deploy.

(cffi:define-foreign-library libsodium
  (:darwin "libsodium.dylib")
  (:unix "libsodium.so")
  (:windows "libsodium.dll")
  (t (:default "libsodium")))

(cffi:load-foreign-library 'libsodium)

I am open to other ways of solving this problem, if you have any - for instance, for libzmq builds that do not depend on libsodium (since I saw that there are builds like that).

@Shinmera, hi! Could you help with this issue? (I define the foreign library here, and libzmq.so can be built with or without dependence on libsodium.so.) It seems that Deploy does not copy dynamic dependencies of the libraries it copies. What would be a practical alternative to implementing that feature, that can be done by a user of Deploy or in pzmq?

@phoe, on Linux you could try ldcp on the resulting bin directory (e.g. ldcp bin bin/*).

There's only one practical solution, which is what phoe posted.

Analysing the dependencies of a shared object automatically would require parsing them (hard in and of itself) or using an external tool (brittle), and knowing at which point to stop walking the dependency tree, which is a hard problem.