2

tesseract-ocr gem 安装正确(包括依赖项)。但是,在启动 rails 服务器时,出现以下编译错误。在这个阶段我从来没有收到过编译错误,所以我会很感激任何帮助。

server:brandlove n$ rails s
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/ffi-inline-0.0.4/lib/ffi/inline/compilers/gcc.rb:29:in `compile': compile error: see logs at /var/folders/hm/6n4h3d1s49b_pxt2m51gr39c0000gn/T/.ffi-inline-501/793babd774d7ac74de2eb789882efa735f45b30b.log (CompilationError)
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/ffi-inline-0.0.4/lib/ffi/inline/builders/c.rb:114:in `shared_object'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:90:in `block in build'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:87:in `instance_eval'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:87:in `build'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/ffi-inline-0.0.4/lib/ffi/inline/inline.rb:54:in `singleton_inline'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/ffi-inline-0.0.4/lib/ffi/inline/inline.rb:39:in `inline'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:34:in `<module:C>'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:31:in `<module:Tesseract>'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:29:in `<top (required)>'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/api.rb:26:in `require'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/api.rb:26:in `<top (required)>'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract-ocr.rb:35:in `require'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract-ocr.rb:35:in `<top (required)>'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
    from /Users/n/Desktop/brandlove/config/application.rb:7:in `<top (required)>'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:53:in `require'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:50:in `tap'
    from /Users/n/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
server:brandlove n$ 

日志文件:

/var/folders/hm/6n4h3d1s49b_pxt2m51gr39c0000gn/T/.ffi-inline-501/793babd774d7ac74de2eb789882efa735f45b30b.cpp:1:30: error: tesseract/strngs.h: No such file or directory
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:51: error: expected constructor, destructor, or type conversion before ‘*’ token
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:57: error: variable or field ‘destroy_string’ declared void
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:57: error: ‘STRING’ was not declared in this scope
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:57: error: ‘value’ was not declared in this scope
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:63: error: ‘STRING’ was not declared in this scope
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:63: error: ‘value’ was not declared in this scope
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:63: error: expected ‘,’ or ‘;’ before ‘{’ token
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:69: error: ‘STRING’ was not declared in this scope
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:69: error: ‘value’ was not declared in this scope
/Users/n/.rvm/gems/ruby-1.9.3-p0/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:69: error: expected ‘,’ or ‘;’ before ‘{’ token
4

1 回答 1

5

据我所知,您使用 mac os ...解决任何安装错误的最简单方法是全新安装 :)tesseractgem 'tesseract-ocr'

如果您安装了自制软件,这很容易

$ brew install tesseract

这将需要一些时间,并将安装 tesseract 本身和所有必要的库

之后,当然

$ gem install 'tesseract-ocr'

(或者$ bundle install如果您将其添加到 Gemfile)

于 2013-01-26T18:25:24.543 回答