开发者

Missing functions in ruby 1.8

开发者 https://www.devze.com 2022-12-30 09:57 出处:网络
I have a ruby gem that I developed with ruby 1.9, and it works. With ruby 1.8, though, it says this when I try to run it:

I have a ruby gem that I developed with ruby 1.9, and it works. With ruby 1.8, though, it says this when I try to run it:

dyld: lazy symbol binding failed: Symbol not found: _RBIGNUM_SIGN
  Refere开发者_如何学编程nced from: /Users/Adrian/Desktop/num_to_bytes/ext/num_to_bytes/num_to_bytes.bundle
  Expected in: flat namespace

dyld: Symbol not found: _RBIGNUM_SIGN
  Referenced from: /Users/Adrian/Desktop/num_to_bytes/ext/num_to_bytes/num_to_bytes.bundle
  Expected in: flat namespace

Trace/BPT trap

If I comment out the line that uses RBIGNUM_SIGN, it complains about other functions like rb_big_modulo. Some things work, like NUM2LONG. Here are some things I have tried:

  • In http://github.com/ruby/ruby/blob/ruby_1_8_7/ruby.h, RBIGNUM_SIGN is defined. But in all versions of ruby I have tried, it is not there.
  • I guessed that maybe it was defined in a different .h file. Knowing that Hpricot works with 1.8, I looked at http://github.com/hpricot/hpricot/blob/master/ext/hpricot_scan/hpricot_scan.h. It doesn't include any other files that #define it.
  • Putting things like extern VALUE rb_big_modulo(VALUE x); at the beginning of my extension don't help.
  • Using a brand new Ubuntu installation, I apt-getted ruby, tried to install the gem, and it didn't work either.
  • Putting have_library 'ruby', 'rb_big_modulo' in my extconf.rb didn't work.

As you can probably see, I am getting desperate (after weeks of trying things!). So, how can I get this to work?

Here is the gem: http://rubygems.org/gems/num_to_bytes

Here is the source: http://gist.github.com/404584


You could try requiring the backports gem. This provides some of the functionality of newer ruby versions for older ruby interpreters.


  • For RBIGNUM_SIGN, define it again in the source.
  • For rb_big_modulo(x, y), use rb_funcall(x, '%', 1, y).
0

精彩评论

暂无评论...
验证码 换一张
取 消