[zeromq-dev] pyzmq curve example code

Greg Ward greg at gerg.ca
Wed Feb 26 16:17:11 CET 2014

On 26 February 2014, I said:
> Cannot confirm your fix yet, as I'm battling a CFFI error.
> In case anyone can throw me a hint, the problem I'm now having is:
> $ PYTHONPATH=/data/src/pyzmq python generate_certificates.py 
> /data/src/pyzmq/zmq/backend/cffi/__pycache__/_cffi__x5368a726x67d4e236.c:153:17: fatal error: zmq.h: No such file or directory
>  #include <zmq.h>
>                  ^
> compilation terminated.

Progress. Turns out that distutils (and thus CFFI) understand CPPFLAGS
and LDFLAGS environment variables. If I run

  $ CPPFLAGS=-I/usr/local/zmq4/include LDFLAGS=-L/usr/local/zmq4/lib PYTHONPATH=/data/src/pyzmq/build/lib.linux-x86_64-2.7 python generate_certificates.py

then the CFFI problem goes away and is replaced by

  Traceback (most recent call last):
    File "generate_certificates.py", line 15, in <module>
      import zmq.auth
    File "/data/src/pyzmq/build/lib.linux-x86_64-2.7/zmq/__init__.py", line 73, in <module>
      from zmq import devices
    File "/data/src/pyzmq/build/lib.linux-x86_64-2.7/zmq/devices/__init__.py", line 17, in <module>
      from zmq.devices import basedevice, proxydevice, monitoredqueue, monitoredqueuedevice
    File "context.pxd", line 26, in init zmq.devices.monitoredqueue (zmq/devices/monitoredqueue.c:5018)
    File "/data/src/pyzmq/build/lib.linux-x86_64-2.7/zmq/backend/cython/__init__.py", line 26, in <module>
      from . import (constants, error, message, context,
  ImportError: cannot import name constants

which makes no sense, since constants.so is *right there* in
zmq/backend/cython. Weird. More digging...

Running bleeding-edge pyzmq out of its source tree with libzmq in a
custom prefix is *tricky*!


More information about the zeromq-dev mailing list