otiai10/gosseract

Compilation error

asimakos opened this issue · 18 comments

I have followed all your installation instructions to use your great golang package for tesseract-ocr 4.0 (dev) (Windows environment) for golang 1.14 in order to run the example app in your github repo, but unfortunately i get the following error:

# github.com/otiai10/gosseract
tessbridge.cpp:5:34: fatal error: leptonica/allheaders.h: No such file or directory
 #include <leptonica/allheaders.h>
                                  ^
compilation terminated.

For your better assistance, i attach you the following information regarding my golang environment:

info

Any hint would be convenient to me!

Regards

Because you didn't install leptonica

I just found the following list of leptonica developer and build packages for Windows here.
I would like your assistance, if possible regarding leptonica build package that contains only two folders (include and lib) of where exactly i place them.

That would help me a lot!

Regards

I had read the following interesting article to install and use tesseract-ocr-setup-4.00.00dev.exe, but now i just found the following list that might help.

I am afraid that it is a whole process to compile tesseract in Windows that may not succeed.

Regards

Did you check this? #132

could be helpful, then

Sorry for the late response!

Unfortunately the above link did not help me and I made a little research and i found that it's possible to install leptonica and tesseract via msys2 packages for Windows 32-bit and 64-bit for tesseract and leptonica.

I managed to install them via this useful package manager, but i get the same error when i run go get command.

# github.com/otiai10/gosseract
tessbridge.cpp:5:34: fatal error: leptonica/allheaders.h: No such file or directory
 #include <leptonica/allheaders.h>
                                  ^
compilation terminated.

I think it would be better to try yourself via msys2 and tell me where i make the error.

That would help me a lot!

Regards

The only thing I can say is either your INCLUDE_PATH is wrong or you didn't install header files for leptonica which can be install via such as leptonica-dev.

Sorry again for the late response!

For your better assistance, i attach you several images where i have installed leptonica and tesseract via msys2 package manager.

Additionally i define the following environment variables:
CGO_CFLAGS=-I C:\msys32\mingw32\include\
CGO_LDFLAGS=-L C:\msys32\mingw32\lib\

but i receive the same error!

Regards

pic1

pic2

pic3

pic4

pic5

Same problem,too. I dont want to compile full tesseract-ocr on win10.Is there any solution?

Same problem. Struggling to install/run Gosseract for last 3 days.
Tried with tesseract 5.0 Alpha and Tesseract 4.0. I copied all header files from Leptonica/Tesseract inside gosseract/leptonica and gosseract/tesseract folders . It got success but then running the program throws the error-
got this error : exit status 3221226356
Environment- Windows 10 / golang 1.15/

I'm facing the same problem "#include <leptonica/allheaders.h>". Would be great to have building instructions for Windows, I've tried compiling liptonica etc but always face the same issue

@otiai10 Can you help us? 😄

Working on it but not able to take so much time currently 🙇

Skwol commented

I have the same error on mac (big sur 11.2.3). I'm not sure what caused this but for some reason gosseract is looking for includes in some unexpected place, I've forked code and changed cpp bridge from:
#include <leptonica/allheaders.h> #include <tesseract/baseapi.h>
to:
#include "/usr/local/include/leptonica/allheaders.h" #include "/usr/local/include/tesseract/baseapi.h"

What is causing this? Am I missing some env variable? Everything installed via brew and tesseract works fine.

@Skwol Did setting the absolute path worked for you?

Skwol commented

@Skwol Did setting the absolute path worked for you?

yes, it did help

我也遇到了同样的问题,并且通过这种方式安装了leptonica
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh # "./bootstrap-vcpkg.bat" for powershell
./vcpkg integrate install
./vcpkg install leptonica

@asimakos Your leptonica and tesseract libraries files in mingw32/include , try mingw32.exe instead of msys2.exe .