rbzmq icon indicating copy to clipboard operation
rbzmq copied to clipboard

ruby: symbol lookup error: /home/vagrant/.rvm/gems/ruby-2.2.1/gems/zmq-2.1.4/lib/zmq.so: undefined symbol: rb_thread_blocking_region

Open slava-vishnyakov opened this issue 10 years ago • 2 comments

Hi,

I have a test code:

require 'rubygems'
require 'zmq'

context = ZMQ::Context.new
chan    = ARGV[0]
user    = ARGV[1]
pub     = context.socket ZMQ::PUB
pub.setsockopt ZMQ::IDENTITY, "test1-test2"

pub.bind 'tcp://*:5555'

while true
  pub.send "chan1 #{rand.to_s()}"
  sleep(1.0)
end

$ ruby -v ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

When trying to run that I get ruby: symbol lookup error: /home/vagrant/.rvm/gems/ruby-2.2.1/gems/zmq-2.1.4/lib/zmq.so: undefined symbol: rb_thread_blocking_region

when code reaches pub.send

Works fine on Ruby 2.1.5

slava-vishnyakov avatar Jul 13 '15 23:07 slava-vishnyakov

Yes this call has been deprecated for a while in the Ruby C API and has then been removed in Ruby 2.2. I have a fix in https://github.com/ameuret/rbzmq/tree/fix-rb-thread-blocking-region. You can check it out very simply by pointing your Gemfile to it with:

gem 'zmq', :git => "git://github.com/ameuret/rbzmq.git", :branch => 'fix-rb-thread-blocking-region'

It has received very limited testing for now and is not even backward-compatible with Rubies <2.2 but it WORKSFORME(tm) :-)

ameuret avatar Nov 09 '15 11:11 ameuret

I'm getting the same issue, when trying to load the gem:

irb(main):001:0> require 'zmq'
LoadError: /var/lib/gems/2.3.0/gems/zmq-2.1.4/lib/zmq.so: undefined symbol: rb_thread_blocking_region - /var/lib/gems/2.3.0/gems/zmq-2.1.4/lib/zmq.so
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
	from (irb):1
	from /usr/bin/irb:11:in `<main>'

Is this project dead? This issue seems to be quite old.

xfbs avatar Apr 10 '18 22:04 xfbs