Skip to content
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

Binaries for windows #209

Closed
BorisBrock opened this issue Feb 4, 2016 · 39 comments
Closed

Binaries for windows #209

BorisBrock opened this issue Feb 4, 2016 · 39 comments

Comments

@BorisBrock
Copy link

Where can I download Tesseract for Windows?
All Links point to code.google.com, but since Tesseract has moved here all links are dead.

Also I would like to downoad different versions (2.x, 3.x) to see if any of them works.
The version I have right now (3.05 Setup) does not read any images but produces errors instead.

@stweil
Copy link
Member

stweil commented Feb 4, 2016

That might be caused by missing permissions: all but the very latest version try to create temporary files in the root directory c:. You will need a Tesseract build with a very new version of Leptonica to fix this problem, see DanBloomberg/leptonica@3038a70.
See also issue #171.

@egorpugin
Copy link
Contributor

Leptonica can be built on windows. But by default it is built without any image libraries (i.e. cannot load/save images). So, no png,gif,tiff,... functions available.
In such mode tesseract will only handle raw image input from api, not from any exe calls.

@BorisBrock
Copy link
Author

OK, thanks for the replies. Can I download a version somewhere that
a) Does not have the bug mentioned by stweil
b) Includes the image loading functionality

On https://github.com/tesseract-ocr/tesseract/wiki/Downloads it says "Currently, there is no official Windows installer for newer versions." :-(
The 3.05 setup from https://github.com/UB-Mannheim/tesseract/wiki does also not work (as mentioned above).

@egorpugin
Copy link
Contributor

Try these binaries compiled by me.
https://www.dropbox.com/s/8t54mz39i58qslh/tesseract-3.05.00dev-win32-vc19.zip?dl=1
You have to install VC2015 x86 redist from microsoft.com in order to run them.
Leptonica is built with all libs except for libjp2k.

@amitdo
Copy link
Collaborator

amitdo commented Feb 5, 2016

Also I would like to downoad different versions (2.x, 3.x) to see if any of them works.

http://sourceforge.net/projects/tesseract-ocr-alt/files/

@bantilan
Copy link

Hi, I made a step by step guide how to compile Tesseract on Windows.. You can check my guide's here: http://gensanblog.com/2016/01/28/how-to-compile-tesseract-git-project-on-windows/

You can also download the compiled version..

@zdenop
Copy link
Contributor

zdenop commented Feb 13, 2016

@bantilan: please add it https://github.com/tesseract-ocr/tesseract/wiki/Compiling#windows (every github used can modify it)

@egorpugin
Copy link
Contributor

It's a bad guide. Do not add it anywhere.

  1. Windows binaries should be made with MSVC, not cygwin. Why do you install Visual Studio and do not use it? You use only cygwin stuff. Which won't run if you distribute it without cygwin.
  2. https://github.com/egorpugin/leptonica.git is not correct leptonica repository anymore. Use official https://github.com/DanBloomberg/leptonica/releases 1.73+ release.

@egorpugin
Copy link
Contributor

I uploaded my local branch with almost all leptonica's deps sources to https://github.com/egorpugin/leptonica/tree/with_libs. You can find them in /dep. Most of those were taken from opencv distribution. They can be somewhere misconfigured etc. Also that branch is following master branch of leptonica, so probably it's not so stable as release.
When you build this leptonica branch, result library will support many image libraries, therefore tesseract does too when linked with it.

@bantilan
Copy link

Hi Egor, thank you for correcting.. I am new to this and I made lots of edit's on the guide.. I will edit my post and focus on cygwin, I also added dll's so that it can run without cygwin.. I'll create a new guide for MSVC..

@Shreeshrii
Copy link
Collaborator

@egorpugin : Could you also build the training program - text2image for windows

@egorpugin
Copy link
Contributor

No, I can't.
That's the single binary that cannot be easily built with MSVC.

@Shreeshrii
Copy link
Collaborator

@egorpugin: OK.

@zdenop : There are a number of older requests/issues for windows build. I'll add a comment to refer to this issue and you could close them. Thanks!

@Shreeshrii
Copy link
Collaborator

@egorpugin - Are the windows binaries at
https://www.dropbox.com/s/8t54mz39i58qslh/tesseract-3.05.00dev-win32-vc19.zip?dl=1
for the current development version (after the release of 3.04.01)?

Thanks!

@egorpugin
Copy link
Contributor

They are from master branch. Probably on this commit ec44221

@Shreeshrii
Copy link
Collaborator

Thanks for clarifying, @egorpugin .

I was confused after seeing the following on the releases page:

on Jul 22, 2015 
3.05.00dev  …
increase version number
 71e226c   zip   tar.gz

@nickbe
Copy link

nickbe commented May 31, 2016

This build does not create PDFs, but the cygwin from http://3.onj.me/tesseract/ build does.
So currently the VS build is not usable.

@amitdo
Copy link
Collaborator

amitdo commented Jun 2, 2016

@egorpugin, can you confirm this?

@egorpugin
Copy link
Contributor

Did not run tests on my binaries, so it's possible.

@amitdo
Copy link
Collaborator

amitdo commented Jun 2, 2016

@stweil
Copy link
Member

stweil commented Jun 2, 2016

The installers (made with MinGW-w64) are at https://github.com/UB-Mannheim/tesseract/wiki.

@amitdo
Copy link
Collaborator

amitdo commented Jun 2, 2016

Yeah. For some reason I omitted the 'wiki' part from the link.

@nickbe
Copy link

nickbe commented Jun 2, 2016

https://github.com/UB-Mannheim/tesseract doesn't seem to provide binaries right now.

@stweil
Copy link
Member

stweil commented Jun 2, 2016

@nickbe, just add /wiki to that URL...

@nickbe
Copy link

nickbe commented Jun 3, 2016

But these do not seem to be the VC binaries, or are they? There's only a problem with generating PDFs with the VC runtimes.

@stweil
Copy link
Member

stweil commented Jun 3, 2016

That's right, the UB Mannheim executables are built with Mingw-w64.

@jbreiden
Copy link
Contributor

jbreiden commented Jun 3, 2016

What is this business about certain builds not supporting PDF output? There is nothing special or weird with that section of code. Are they just old builds from before the feature was created, or is there something else going on?

@egorpugin
Copy link
Contributor

Is there a simple command to check pdf generation?
I'll try to debug the issue (if any).

@amitdo
Copy link
Collaborator

amitdo commented Jun 3, 2016

The discussion about the PDF issue in egor's build should be continued in #338

@amitdo amitdo closed this as completed Jun 3, 2016
@Shreeshrii
Copy link
Collaborator

Latest VC binaries by @egorpugin with PDF generation are at following link, as per #338: https://www.dropbox.com/s/pxu2hp6mg1a64zj/tesseract-3.05.00dev-win32-vc19-2016-jun-03.zip?dl=1

@nickbe
Copy link

nickbe commented Jun 18, 2016

Great. Thanks !

@egorpugin
Copy link
Contributor

Hi!

I'd like to share one more way of building tesseract(+leptonica+other_image_libraries) on Windows. Linux probably will work too.

  1. Download and install Git, CMake and put them in PATH.
  2. Download the latest CPPAN (C++ Archive Network https://cppan.org/) client from https://cppan.org/client/. CPPAN is a source package distribution system. (Like biicode or conan but for sources. Also the idea came from CPAN/CTAN/CRAN.) Add CPPAN client in PATH too. (VS2015 redist is required.)
  3. Run
git clone https://github.com/tesseract-ocr/tesseract tesseract
cd tesseract
cppan
mkdir build && cd build
cmake .. -DSTATIC=1
  1. Build a solution in VS tesseract.sln

So, the build should be pretty straightforward and available for everyone with installed Visual Studio. You can try it on any version supported by tesseract.

If you like the way of building tesseract with CPPAN, I could implement such easy way of integration of tesseract into user (your) apps.

Sorry for the noise.

@zdenop
Copy link
Contributor

zdenop commented Jun 30, 2016

@egorpugin: thanks! I tried it in VS2010 and I face one problem:
this version of giflib can not be built by VS2010 (Cannot open include file: 'stdbool.h': No such file or directory). Is it possible to make it optionable (to ignore gif library) or to use other version of library (older 4.? was possible to build with VS2010)?

@egorpugin
Copy link
Contributor

During normal workflow this is not possible.

Because of the following:
tesseract is binded to leptonica (some version, e.g. future 1.74);
leptonica is binded to giflib (e.g. v5.1.2).

So you cannot control leptonica's dependencies.
And you must use appropriate and supported compilers of these libraries to compile your project.
Now you'd like to use an older version of giflib. The idea is clear, I understand this, you want to work on older compiler. But using old version of libraries can bring (and it does) potential security breaches.

But now it's possible to introduce some changes to demo giflib itself. I've added some ifdefs to control usage of stdbool.h, so you can check if it works. Just re-run cppan command in tesseract dir and try to build a VS solution.

@M1chae1
Copy link

M1chae1 commented Jul 8, 2016

@egorpugin I follow the instructions.

However CPPAN returns

Requesting dependency list
SSL connect error

Is that any configuration I am missing?

@egorpugin
Copy link
Contributor

Usually it means that you don't have a letsencrypt certificate installed on your system (old ubuntu etc.). I've added an option ('-k' or '--ignore-ssl-checks') to skip strict ssl checks. Please, re-download the client and run 'cppan -k'. For more info see 'cppan -h'. On windows you can upgrade the client with 'cppan --self-upgrade' (only if this option is available, check 'cppan -h').

@egorpugin
Copy link
Contributor

egorpugin commented Jul 11, 2016

FYI I've added simple guide on how to build tesseract on Windows https://github.com/tesseract-ocr/tesseract/wiki/Compiling#master-branch-305-and-later
Also the simple user app example with tesseract (using cmake+cppan) is available here https://github.com/tesseract-ocr/tesseract/wiki/User-App-Example
https://github.com/cppan/tesseract_example

@avestnik
Copy link

@egorpugin I tried your way for getting static lib with -DSTATIC=1

I'd like to share one more way of building tesseract(+leptonica+other_image_libraries) on Windows. Linux probably will work too.

I built && installed it w/o any issues but linking my app with it failed with two issues:

  • Error LNK1104 cannot open file 'tesseract.lib'
    I fixed it in [install-folder]/cmake/TesseractConfig.cmake
    set(Tesseract_LIBRARIES tesseract) => set(Tesseract_LIBRARIES libtesseract)

  • Error LNK1104 cannot open file 'pvt.cppan.demo.danbloomberg.leptonica.lib'
    I fixed it by editing [install-folder]/cmake/TesseractTargets-debug.cmake and removing the following line

    set_target_properties(libtesseract PROPERTIES
    IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
    IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "Ws2_32;pvt.cppan.demo.danbloomberg.leptonica"
    IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/tesseract400d.lib"
    )

please advise if it is correct

@egorpugin
Copy link
Contributor

This guide is quite old. I think it's about tesseract building, not linking to your app. It's quite different or might have additional steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests