[zeromq-dev] Building PyZmq on Mac

Thomas Maslach tom at altair.com
Thu Apr 16 21:22:00 CEST 2015


I'm attempting to build pyzmq where it'll automatically put the zeromq libraries within in the pyzmq 'zmq' folder.

I am using my own build of python located in my home dir.  It will move around.

I first did the following:

../python27/python setup.py configure -zmq=../zeromq-4.0.4
../python27/python setup.py install

This installs everything, but does not put libzmq.dylib into the zmq folder.  Running otools -L libzmq.dylib also gives the id of that dylib as the full path to zeromq-4.04 + libzmq.3.dylib.  (Sorry about any confusing terminology - my mac knowledge is slim).

After looking on line some and at the setup.py code, I tried the following:

../python27/python setup.py configure -zmq=../zeromq-4.0.4
../python27/python setup.py bdist

It looks like bdist will make the bundle_libzmq_dylib property in setup.py return True, which will copy libzmq.dylib into pyzmq's zmq folder and call install_name_tool to change the id of zmq.  This seems to work.  But, I then get the following error in the output.  It seems that it is trying to build in the build folder, which means libzmq isn't up a level.

Any idea of how I use setup.py to accomplish what I want?  I just want a pyzmq build with my zeromq linked into it, and the python folder can be located anywhere on disk (and not necessarily on my machine).  I believe I can manually go to all the *.so files and call install_name_tool to redirect to my libzmq.  But, that doesn't seem like a clean solution.

Any help would be greatly appreciated - I've struggled on this for quite a bit!

Here is the output I got from running ../python27/python setup.py bdist
************************************************
Configure: Autodetecting ZMQ settings...
    Custom ZMQ dir:       ../zeromq-4.0.4
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../zeromq-4.0.4/include -Izmq/utils -Izmq/backend/cython -Izmq/devices -c build/temp.macosx-10.4-x86_64-2.7/scratch/vers.c -o build/temp.macosx-10.4-x86_64-2.7/scratch/vers.o
gcc -undefined dynamic_lookup build/temp.macosx-10.4-x86_64-2.7/scratch/vers.o -Lzmq -lzmq -o build/temp.macosx-10.4-x86_64-2.7/scratch/vers
Error running version detection script:

dyld: Library not loaded: @loader_path/../libzmq.dylib
  Referenced from: /users/tom/software/ipython_mac/python/pyzmq-14.1.1/build/temp.macosx-10.4-x86_64-2.7/scratch/vers
  Reason: image not found


error: Error running version detection script:

dyld: Library not loaded: @loader_path/../libzmq.dylib
  Referenced from: /users/tom/software/ipython_mac/python/pyzmq-14.1.1/build/temp.macosx-10.4-x86_64-2.7/scratch/vers
  Reason: image not found


Fatal: Falling back on bundled libzmq, but setup.cfg has explicitly prohibited building the libzmq extension.
hwbldmac-64-02 tom /users/tom/software/ipython_mac/python/pyzmq-14.1.1 240 > otool -L ../zeromq-4.0.4/lib/libzmq.dylib
../zeromq-4.0.4/lib/libzmq.dylib:
                /users/tom/software/ipython_mac/python/zeromq-4.0.4/lib/libzmq.3.dylib (compatibility version 5.0.0, current version 5.0.0)
                /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
                /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150416/2163c008/attachment.htm>


More information about the zeromq-dev mailing list