2013-02-01 60 views
2

總的noob在這裏,但無法弄清楚如何克服這個錯誤。我希望在運行Centos 6的Linux服務器上安裝並運行'tesseract'gem。結果似乎是-ltesseract應該位於/ usr/bin/ld中,但不是...tesseract gem不會在Ruby中編譯

我已閱讀了其他tesseract/Ruby問題,但我認爲我沒有遇到任何這些問題。

任何幫助,非常感謝。


錯誤消息

g++ -shared -fPIC -o /tmp/.ffi-inline-0/3751549a49315e9a7703c6e20a39e587297ce8a8.so /tmp/.ffi-inline-0/3751549a49315e9a7703c6e20a39e587297ce8a8.cpp -ltesseract 2>>/tmp/.ffi-inline-0/3751549a49315e9a7703c6e20a39e587297ce8a8.log 
/usr/bin/ld: cannot find -ltesseract 
collect2: ld returned 1 exit status 

錯誤動作

[[email protected] ~]# irb 
1.9.3-p327 :001 > require 'tesseract' 
CompilationError: compile error: see logs at /tmp/.ffi-inline-0/3751549a49315e9a7703c6e20a39e587297ce8a8.log 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/ffi-inline-0.0.4.2/lib/ffi/inline/compilers/gcc.rb:31:in `compile' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/ffi-inline-0.0.4.2/lib/ffi/inline/builders/c.rb:114:in `shared_object' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/ffi-inline-0.0.4.2/lib/ffi/inline/builders.rb:90:in `block in build' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/ffi-inline-0.0.4.2/lib/ffi/inline/builders.rb:87:in `instance_eval' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/ffi-inline-0.0.4.2/lib/ffi/inline/builders.rb:87:in `build' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/ffi-inline-0.0.4.2/lib/ffi/inline/inline.rb:54:in `singleton_inline' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/ffi-inline-0.0.4.2/lib/ffi/inline/inline.rb:39:in `inline' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:34:in `<module:C>' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:31:in `<module:Tesseract>' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:29:in `<top (required)>' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/tesseract-ocr-0.1.5/lib/tesseract/api.rb:26:in `<top (required)>' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/tesseract-ocr-0.1.5/lib/tesseract-ocr.rb:35:in `<top (required)>' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
     from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/tesseract-ocr-0.1.5/lib/tesseract.rb:25:in `<top (required)>' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require' 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require' 
     from (irb):1 
     from /usr/local/rvm/rubies/ruby-1.9.3-p327/bin/irb:13:in `<main>'1.9.3-p327 

寶石版本

[[email protected] ~]# gem list 
[...] 
tesseract-ocr (0.1.5) 
[...] 

版本的GCC

[[email protected] ~]# gcc --version 
gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4) 
[...] 

OS

[[email protected] ~]# cat /etc/*release* 
CentOS release 6.3 (Final) 

的Ruby版本

[[email protected] ~]# ruby -v 
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux] 

RVM版本(以防萬一)

[[email protected] ~]# rvm -v 
rvm 1.17.2 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] 

回答

0

嘗試在您的系統中安裝tesseract軟件包。 我認爲這樣yum install tesseract

+0

'$ sudo的百勝安裝的Tesseract加載的插件:fastestmirror,優先級,刷新PackageKit的,從緩存HOSTFILE 安全 加載速度鏡*基地:mirrors.vooservers.com * EPEL:mirror.bytemark。 co.uk * extras:mirror.sov.uk.goscomb.net *更新:mirrors.vooservers.com 設置安裝過程 沒有可用的軟件包tesseract。 錯誤:無所事事' – Sam

+0

從 下載rpm包[鏈接](http://rpm.pbone.net/index.php3/stat/4/idpl/21766020/dir/centos_6/com/tesseract-3.02。 02-3.1.i686.rpm.html) – user1201917

+0

然後使用_yum -nogpgcheck安裝tesseract-3.02.02-3.1.i686.rpm_(cd to _dir-with-package_) PS:您應該始終檢查來自不可信來源 – user1201917