-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error setting up the tesseract OCR in gem in rails #24
Comments
Are the environment variables set before the gem is required? |
Hi, thanks for replying, here's some more details to answer you question... I haven't put 'require' anywhere yet because the rails server is throwing the error on start up. The only place 'tesseract-ocr' is referenced is in the Gemfile and the Gemfile.lock file. The ENV vars are sat in the initializer folder. However I tried putting them in the application.rb before the rails app is initialized and even putting them at the start of the Gemfile before |
I don't know much about rails, so I don't know when it runs the |
I tried running:
In the shell before running 'rails s' however that still threw the same error on start up. I don't know if this is relevant but I'm on Mavericks. |
Could you give me the output of |
Sure it's: /usr/local/Cellar/tesseract/3.02.02/include |
Oh right, it was looking for the leptonica headers, I think you have to also add the path to leptonica. |
Ok, how do I do that? Do I first need to brew install leptonica too? (thanks for your help by the way) |
No, it's a dependency of tesseract, it should have installed it along, you just have to find where it put it. |
I did a locate and found /usr/local/Library/Formula/leptonica.rb and brew says it's already installed. Sorry about all the questions, now where do I put the reference to '/usr/local/Library/Formula/leptonica.rb' does this need another env var? |
It's not that one, it should have its own include dir like tesseract, try installing it tho. |
I've brew re-installed leptonica and it has it's own dir like tesseract now in '/usr/local/Cellar/leptonica/1.69' with a lib and bin, however the error is still getting throw. |
So there's no include dir? The error is thrown because it can't find leptonica's headers. Try running a locate for |
Yep, there's an include folder too with those files in it: /usr/local/Cellar/leptonica/1.69/include/leptonica So that's all there too. |
Then just add those paths to the two env vars too. |
Thanks! That's it, perfect! My guess is this is Mavericks related. Just incase anyone else has a problem here's exactly how it was fixed in mine: Firstly had to run both: Then in the Gemfile NOT in an initializer you have to put both paths to the libraries as env vars: ENV['CFLAGS'] = '-I/usr/local/Cellar/tesseract/3.02.02/include -I/usr/local/Cellar/leptonica/1.69/include' |
Thanks for summing it up. |
Hi guys!
|
Maybe it's helpful.
-I/usr/local/Cellar/leptonica**[unuseful space]**/1.72/include |
I have the same error with tesseract 3.04 and leptronica 1.72 installed via brew. I tried setting the ENV flags according to above and reinstalling the ffi and ffi-inline gems. The log file output:
Was there a breaking API change? |
@travisgalloway - I was able to past this by following the instructions found here.
Then I had to updated my |
I'm trying to setup the
tesseract-ocr
gem in my rails environment. I have ranbrew 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:It reference the following log file:
I followed these two issues:
#3 and #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:
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.
The text was updated successfully, but these errors were encountered: