zeromq / pyzmq

PyZMQ: Python bindings for zeromq
http://zguide.zeromq.org/py:all
BSD 3-Clause "New" or "Revised" License
3.74k stars 636 forks source link

Accessing the bundled libzmq.so #1412

Open nodakai opened 4 years ago

nodakai commented 4 years ago

Forgive my lack of knowledge on native dependencies, but I just noticed a change in the path of the "bundled" libzmq.so file between release 19.0 and 19.0.1:

$ python3 -m venv foo
$ python3 -m venv bar
$ python3 -m venv baz

$ foo/bin/pip install pyzmq
$ bar/bin/pip install pyzmq==19.0.1
$ baz/bin/pip install pyzmq==19.0

$ find foo bar baz -name libzmq-1358af2c.so.5.2.2
foo/lib/python3.7/site-packages/pyzmq.libs/libzmq-1358af2c.so.5.2.2
bar/lib/python3.7/site-packages/pyzmq.libs/libzmq-1358af2c.so.5.2.2
baz/lib/python3.7/site-packages/zmq/.libs/libzmq-1358af2c.so.5.2.2

I have a build script that references the .so for Cython build (something looks like

if sys.platform == 'linux':
    libzmq_path.append(':libzmq-1358af2c.so.5.2.2')
    libzmq_lib_path = [f"{x}/.libs" for x in zmq.get_library_dirs()]

which no longer works since 19.0.1)

I this is an out-of-warranty thing but, what motivated changing the path? My quick search can't seem to find relevant config items or commits which modified them. And are there any "official" APIs pointing me to the directory and the .so file? (I guess I'll just get my task done with [f"{x}/../pyzmq.libs" for x in zmq.get_library_dirs()] for now...)

minrk commented 4 years ago

libzmq is bundled using auditwheel. It appears this was caused by this change.

It is true that pyzmq's get_library_dirs() makes the promise that it will return the directory containing libzmq and the current linux wheel is putting that somewhere else, so I think there's a fix to be made in how get_library_dirs() locates libzmq. It should probably check for an include both of pyzmq/.libs and pyzmq/../pyzmq.libs if they exist.