meh / ruby-tesseract-ocr

A Ruby wrapper library to the tesseract-ocr API.
629 stars 74 forks source link

FFI Compilation Error #17

Closed maxl0rd closed 11 years ago

maxl0rd commented 11 years ago

I'm having trouble getting this set up under Mac OS X.

Installed tesseract and dependencies with homebrew

tesseract -v
tesseract 3.02.02
 leptonica-1.69
  libjpeg 8d : libpng 1.2.46 : libtiff 4.0.3 : zlib 1.2.3

Version 0.1.5 of the gem...

$ gem list
ffi (1.4.0)
ffi-extra (0.1.0)
ffi-inline (0.0.4.2)
...
tesseract-ocr (0.1.5)

Mac OS X 10.6.8 Ruby ruby-1.9.2-p320

Compilation error is the following. Any ideas? Is it just not finding the lib?

Thanks for any tips...

$ tesseract.rb
/Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/ffi-inline-0.0.4.2/lib/ffi/inline/compilers/gcc.rb:29:in `compile': undefined method `write' for File:Class (NoMethodError)
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/ffi-inline-0.0.4.2/lib/ffi/inline/builders/c.rb:114:in `shared_object'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/ffi-inline-0.0.4.2/lib/ffi/inline/builders.rb:90:in `block in build'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/ffi-inline-0.0.4.2/lib/ffi/inline/builders.rb:87:in `instance_eval'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/ffi-inline-0.0.4.2/lib/ffi/inline/builders.rb:87:in `build'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/ffi-inline-0.0.4.2/lib/ffi/inline/inline.rb:54:in `singleton_inline'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/ffi-inline-0.0.4.2/lib/ffi/inline/inline.rb:39:in `inline'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:34:in `<module:C>'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:31:in `<module:Tesseract>'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:29:in `<top (required)>'
    from /Users/mlord/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/mlord/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/tesseract-ocr-0.1.5/lib/tesseract/api.rb:26:in `<top (required)>'
    from /Users/mlord/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/mlord/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/tesseract-ocr-0.1.5/lib/tesseract-ocr.rb:35:in `<top (required)>'
    from /Users/mlord/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/mlord/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/tesseract-ocr-0.1.5/lib/tesseract.rb:25:in `<top (required)>'
    from /Users/mlord/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/mlord/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/gems/tesseract-ocr-0.1.5/bin/tesseract.rb:3:in `<top (required)>'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/bin/tesseract.rb:19:in `load'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/bin/tesseract.rb:19:in `<main>'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/mlord/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `<main>'
meh commented 11 years ago

I just pushed a new version of ffi-inline, try again after updating it please.

maxl0rd commented 11 years ago

Yes! ffi-inline-0.0.4.3 fixes this bug.

Thanks for the quick fix, and your awesome work on this lib.

meh commented 11 years ago

You're welcome.

I'd just like to understand where the heck I came up with File.write, because it's present on my system and worked for others but it's not documented; I'm puzzled.