rbzmq icon indicating copy to clipboard operation
rbzmq copied to clipboard

Please UPDATE gem to work with 0MQ 3.x.x ... current gem won't build w/ 3.0

Open mistergibson opened this issue 12 years ago • 13 comments

The 3.0 guide is brilliant and I find it humorous. However, if you have a link to the 2.1.x guide - I might get more use out of that.

Currently, this gem will only work with 2.1.x zeromq and won't build on my system with 3.2.x for love or money. ... A lot of "ZMQ_HWM, ZMQ_SWAP, .." undeclared errors.

2.1.x is nice, and it is all good fun until you actually try to follow along at home with the web example code ... Poller? What's that in 2.x.x? That, and the break of API should have got this gem updated some time ago, or at least gotten a zmq3 gem out in the wild by now. Just saying.

-or-

if there is some magic incantation I'm just unaware of ... let me know the secrets of the universe, my gem won't build.

Thanks, and great work on the 3.0 guide - excellent.

mistergibson avatar Nov 03 '12 04:11 mistergibson

Second. Can't get the gem to build. Python is great. I have a reason to use ruby. zeromq 3.2 is stable and recommended for use with new projects, unless those projects are ruby? What's the deal?

tr3buchet avatar Nov 24 '12 06:11 tr3buchet

Can someone submit a pull request for 3.x support, please?

Or coordinate with 0MQ leadership to take over as maintainer of this gem?

I don't have any active projects using 0MQ at this time and have not been following the 3.x development, so I'm not even really sure what changed.

bwbuchanan avatar Dec 12 '12 17:12 bwbuchanan

Would also love to see this fixed.

tcurdt avatar Jan 24 '13 12:01 tcurdt

I pushed some changes to the "zeromq3" topic branch that make the build succeed with version 3.x of the zeromq library. Please test.

bwbuchanan avatar Feb 20 '13 17:02 bwbuchanan

Using the zeromq3 branch, the gem builds, but when I try to run the hwclient.rb I get "./hwclient.rb:17:in `send': Socket operation on non-socket (ZMQ::Error)"

The changes I had to make to the hwclient.rb listing in the guide, to get this far, are;

# require 'ffi-rzmq'
require 'zmq'

  # requester.send_string "Hello"
  requester.send "Hello"

digitalronin avatar Apr 07 '13 11:04 digitalronin

@digitalronin did you found already a fix for this issue?

bigbentobox avatar Apr 29 '13 14:04 bigbentobox

I will put here the errors caused in "gem install zmq" in case someone want to work in a pull request.

ERROR: Error installing zmq: ERROR: Failed to build gem native extension.

    /Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb

checking for zmq.h... yes checking for zmq_init() in -lzmq... yes Cool, I found your zmq install... creating Makefile

make compiling rbzmq.c rbzmq.c:968:7: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC' case ZMQ_RECOVERY_IVL_MSEC: ^ rbzmq.c:990:10: error: use of undeclared identifier 'ZMQ_HWM' case ZMQ_HWM: ^ rbzmq.c:991:10: error: use of undeclared identifier 'ZMQ_SWAP' case ZMQ_SWAP: ^ rbzmq.c:995:10: error: use of undeclared identifier 'ZMQ_MCAST_LOOP' case ZMQ_MCAST_LOOP: ^ rbzmq.c:1292:10: error: use of undeclared identifier 'ZMQ_HWM' case ZMQ_HWM: ^ rbzmq.c:1293:10: error: use of undeclared identifier 'ZMQ_SWAP' case ZMQ_SWAP: ^ rbzmq.c:1297:10: error: use of undeclared identifier 'ZMQ_MCAST_LOOP' case ZMQ_MCAST_LOOP: ^ rbzmq.c:1315:10: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC' case ZMQ_RECOVERY_IVL_MSEC: ^ rbzmq.c:1443:81: error: too few arguments to function call, expected 4, have 3 send_args->rc = zmq_send(send_args->socket, send_args->msg, send_args->flags); ~~~~~~~~ ^ /usr/local/include/zmq.h:349:1: note: 'zmq_send' declared here ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); ^ /usr/local/include/zmq.h:50:27: note: expanded from macro 'ZMQ_EXPORT'

define ZMQ_EXPORT attribute ((visibility("default")))

                      ^

rbzmq.c:1517:38: error: too few arguments to function call, expected 4, have 3 rc = zmq_send (s, &msg, flags); ~~~~~~~~ ^ /usr/local/include/zmq.h:349:1: note: 'zmq_send' declared here ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); ^ /usr/local/include/zmq.h:50:27: note: expanded from macro 'ZMQ_EXPORT'

define ZMQ_EXPORT attribute ((visibility("default")))

                      ^

rbzmq.c:1541:81: error: too few arguments to function call, expected 4, have 3 recv_args->rc = zmq_recv(recv_args->socket, recv_args->msg, recv_args->flags); ~~~~~~~~ ^ /usr/local/include/zmq.h:350:1: note: 'zmq_recv' declared here ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); ^ /usr/local/include/zmq.h:50:27: note: expanded from macro 'ZMQ_EXPORT'

define ZMQ_EXPORT attribute ((visibility("default")))

                      ^

rbzmq.c:1602:38: error: too few arguments to function call, expected 4, have 3 rc = zmq_recv (s, &msg, flags); ~~~~~~~~ ^ /usr/local/include/zmq.h:350:1: note: 'zmq_recv' declared here ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); ^ /usr/local/include/zmq.h:50:27: note: expanded from macro 'ZMQ_EXPORT'

define ZMQ_EXPORT attribute ((visibility("default")))

                      ^

rbzmq.c:1675:50: error: use of undeclared identifier 'ZMQ_HWM' rb_define_const (zmq_module, "HWM", INT2NUM (ZMQ_HWM)); ^ /Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:973:35: note: expanded from macro 'INT2NUM'

define INT2NUM(v) INT2FIX((int)(v))

                              ^

/Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:225:45: note: expanded from macro 'INT2FIX' #define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG)) ^ rbzmq.c:1676:51: error: use of undeclared identifier 'ZMQ_SWAP' rb_define_const (zmq_module, "SWAP", INT2NUM (ZMQ_SWAP)); ^ /Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:973:35: note: expanded from macro 'INT2NUM'

define INT2NUM(v) INT2FIX((int)(v))

                              ^

/Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:225:45: note: expanded from macro 'INT2FIX' #define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG)) ^ rbzmq.c:1683:57: error: use of undeclared identifier 'ZMQ_MCAST_LOOP' rb_define_const (zmq_module, "MCAST_LOOP", INT2NUM (ZMQ_MCAST_LOOP)); ^ /Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:973:35: note: expanded from macro 'INT2NUM'

define INT2NUM(v) INT2FIX((int)(v))

                              ^

/Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:225:45: note: expanded from macro 'INT2FIX' #define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG)) ^ rbzmq.c:1698:64: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC' rb_define_const (zmq_module, "RECOVERY_IVL_MSEC", INT2NUM (ZMQ_RECOVERY_IVL_MSEC)); ^ /Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:973:35: note: expanded from macro 'INT2NUM'

define INT2NUM(v) INT2FIX((int)(v))

                              ^

/Users/paulocheque/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:225:45: note: expanded from macro 'INT2FIX' #define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG)) ^ 16 errors generated. make: *** [rbzmq.o] Error 1

paulocheque avatar May 04 '13 19:05 paulocheque

I can build from the zeromq3 branch fine, but I'm getting the 'Socket operation on non-socket' error as well. Ruby 1.9.3, 0MQ 3.2.3.

jtobin avatar Jun 26 '13 04:06 jtobin

We really need this too, please consider fixing this!

MSch avatar Jul 09 '13 09:07 MSch

@MSch I'm currently running this gem with no problems, using the version included in the latest pull request I've made. It might work for you guys.

jtobin avatar Jul 09 '13 14:07 jtobin

I got a same exception on ruby1.9.3. i got the lastest pull request,and compiled them, but it doesn't work. this is my code:

#!/usr/bin/env ruby #encoding utf-8

require 'rubygems' require 'zmq'

context = ZMQ::Context.new 1

socket = context.socket ZMQ::REQ

puts 'starting connect a tcp zmq server'

socket.connect('tcp://127.0.0.1:5555')

socket.send 'hello'

stenote avatar Aug 14 '13 03:08 stenote

@xjmarui What exception did you see? Your code works fine for me.

jtobin avatar Aug 14 '13 04:08 jtobin

@jtobin I got a error said 'Socket operation on non-socket'. I merged 'https://github.com/zeromq/rbzmq/pull/31' this commit, and recompile the rbzmq, it works!!! I don`t know more about C, but yours request is userful for me. thanks a lot

stenote avatar Aug 14 '13 15:08 stenote