Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZMQ::Message#print fails with binding error #38

Open
wokibe opened this issue Mar 5, 2015 · 1 comment
Open

ZMQ::Message#print fails with binding error #38

wokibe opened this issue Mar 5, 2015 · 1 comment

Comments

@wokibe
Copy link

wokibe commented Mar 5, 2015

When executing the following ruby snippet:
module ZMQ
class Socket
def dump_messages
loop do
message = recv_message
message.print
break unless rcvmore?
end
end
end
end

I get this result:
dyld: lazy symbol binding failed: Symbol not found: _zmsg_dump
Referenced from: /Users/kittekat/.rvm/gems/ruby-2.1.3@noko/extensions/x86_64-darwin-13/2.1.0-static/rbczmq-1.7.8/rbczmq_ext.bundle
Expected in: flat namespace

The analysis showed, that this is related to a version mismatch of rbczmq and the czmq library.
I am using a brew installed czmq version 2.2.0 (see issue 36), but the rbczmq 1.7.8 seems to use version 2.0.1 (result of calling ZMQ.czmq_version).

The source of Message#print references zmsg_dump (ext/rbczmq/message.c):
static VALUE rb_czmq_message_print(VALUE obj)
{
ZmqGetMessage(obj);
ZmqReturnNilUnlessOwned(message);
zmsg_dump(message->message);
return Qnil;
}

But in the actual czmq socket.h the zmsg_dump has been depricated:
// Deprecated method aliases

define zmsg_dump(s) zmsg_print(s)

Do you have plans to update rbczmq to the actual czmq?

Best regards
Wokibe

@wokibe
Copy link
Author

wokibe commented Mar 6, 2015

As ad hoc workaround I defined the following monkey patch

require 'rbczmq'

module ZMQ
  class Message
    def print
      msg = self
      frame = msg.first
      while frame
        frame.print
        frame = msg.next
      end
    end
  end

  class Socket
    def dump_messages
      loop do
        message = recv_message
        message.print
        break unless rcvmore?
      end
    end
  end
end

Best regards
Wokibe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant