[zeromq-dev] Building PyZmq on Mac

Thomas Maslach tom at altair.com
Thu Apr 16 22:44:43 CEST 2015


Thanks for the quick response..

Regarding bdist, you said: Does it work if you specify an absolute path? I haven’t spent any time working on bdists other than the official ones I use, which always build libzmq, rather than linking to an existing one. It’s possible some args or flags should be different.

It does not work with an absolute path – just tried it.  To me, it looks like the process just has a few bugs in it.  Setting libzmq.dylib’s id to @loader_path/../libzmq.dylib makes some sense, but since it is building vers in build/temp.macosx-10.4…../scratch, it won’t find libzmq.dylib up one level. At least, that’s my understanding on how this stuff works, but I know I could be very wrong in this!

The delocate looks like the right way to go versus running install_name_tool many times.  I will look into it, but I’m hoping that I can get away with just using the setup script provided by pyzmq.  I still haven’t given up!

Tom


From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of MinRK
Sent: Thursday, April 16, 2015 3:54 PM
To: ZeroMQ development list
Subject: Re: [zeromq-dev] Building PyZmq on Mac


I think to properly find the libzmq.dylib during the checks when libzmq is not installed somewhere it will be found

On Thu, Apr 16, 2015 at 12:22 PM, Thomas Maslach <tom at altair.com<mailto:tom at altair.com>> wrote:

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).

That’s correct. When you do this, you are telling pyzmq where you have installed libzmq. It should be loadable from that location, and pyzmq shouldn’t touch it.

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.

Does it work if you specify an absolute path? I haven’t spent any time working on bdists other than the official ones I use, which always build libzmq, rather than linking to an existing one. It’s possible some args or flags should be different.

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.

There’s a great tool called delocate<https://pypi.python.org/pypi/delocate> that automates exactly this install_name_tool process. It may be what you are after.

-MinRK

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)



_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org<mailto:zeromq-dev at lists.zeromq.org>
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150416/87943059/attachment.htm>


More information about the zeromq-dev mailing list