I'm trying to setup the tesseract-ocr
gem in my rails environment. I have ran brew install tesseract
and then ran a bundle install on the app and that all runs without errors however when starting the app (rails s
) the following error is throw:
/Users/xxxx/.rvm/gems/ruby-1.9.2-p290@xxxx/gems/ffi-inline-0.0.4.3/lib/ffi/inline/compilers/gcc.rb:35:in `compile': compile error: see logs at /var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.log (CompilationError)
It reference the following log file:
g++ -dynamic -bundle -fPIC -L/usr/local/Cellar/tesseract/3.02.02/lib -I/usr/local/Cellar/tesseract/3.02.02/include -o /var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.dylib /var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.cpp -llept 2>>/var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.log
/var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.cpp:1:10: fatal error: 'leptonica/allheaders.h' file not found
#include <leptonica/allheaders.h>
I followed these two issues: https://github.com/meh/ruby-tesseract-ocr/issues/3 and https://github.com/meh/ruby-tesseract-ocr/issues/21
It talks about setting ENV vars which i have done. I created a test.rb file in the initalizers folder with the following vars set:
ENV['CFLAGS'] = '-I/usr/local/Cellar/tesseract/3.02.02/include'
ENV['LDFLAGS'] = '-L/usr/local/Cellar/tesseract/3.02.02/lib'
However this makes no difference to the error when starting the app.
I don't understand what it means when it says update the headers. I was wondering if someone could tell me exactly what to do to get this working.
Thanks.