0

I am trying to build a Tesseract lib according to this manual: Tesseract (master) installation by using git-bash (version>=2.14.1) and cmake (version >=3.9.1) (certainly, I've also installed OpenCV with its contribute modules beforehand, which went smoothly).

No matter what I do and how it fails for the same reason - when it comes to leptonica on which Tesseract depends, I see the error which looks like this:

Could not find a package configuration file provided by "SW" with any of the following names:

SWConfig.cmake

sw-config.cmake

I've put sw.exe to a location indicated by PATH, but it didn't help - the error remains. Is it possible that an sw cmake config file is missing from the repo?

Community
  • 1
  • 1
James Frezz
  • 39
  • 1
  • 10
  • I have the same problem. If you switch to 1.78.0 branch, you can compile it. I opened an issue on [466](https://github.com/DanBloomberg/leptonica/issues/466) on leptonica repository. – Soruk Nov 27 '19 at 07:43
  • Compile by means of what? The same way I've gone through already? – James Frezz Nov 27 '19 at 07:45
  • If I follow this [wiki](https://github.com/charlesw/tesseract/blob/develop/docs/Compling%20tesseract%20and%20leptonica.md), leptonica compiles using the tag 1.78.0. But master branch no. – Soruk Nov 27 '19 at 07:46
  • Wow, looks rather comprehensive. Thank you, sir! I'll try this as soon as I reach my work station. – James Frezz Nov 27 '19 at 07:55
  • I hope that it will be helpful. FYI, I have an issue [497](https://github.com/charlesw/tesseract/issues/497) with leptonica / tesseract wrapper on Windows Server... – Soruk Nov 27 '19 at 08:07
  • `vcpkg` approach from th wiki didn't work, unfortunately... I'll try to stick to the manual referenced in the main post but switch the tag as you proposed. – James Frezz Nov 27 '19 at 08:55
  • The [Wiki's post](https://github.com/charlesw/tesseract/issues/497#issuecomment-559014587) was updated – Soruk Nov 27 '19 at 16:14

2 Answers2

1

There are several problems:

  • You are using outdated manual. Leptonica is in release process of version 1.79 (manual is referring to 1.74.4 which was release June 11, 2017). Why you do not use official manual compiling tesseract on windows?
  • Related to point above - the latest Tesseract needs recent compiler so build for "Visual Studio 14 2015" could bring other problems.
  • If you are using Git master branch (in any project) - you must be familiar with project, its changes and to be able solve build problems. If you are not capable to do it - use the latest stable/released version. It should work ;-)
  • Windows builds of Tesseract and Leptonica are switching from cppan to sw, so playing with master without needed know-how could be difficult for newcomers. Official tutorials states that tesseract sw build should be started with sw build org.sw.demo.google.tesseract.tesseract-master.
  • vcpkg approach from the wiki didn't work, unfortunately... - What does it mean? See e.g. this tutorial for latest stable releases of tesseract and leptonica.
  • You are not seeing the real problem (I'm completely assured that open source is pure evil) - the problem is you're missing experience of tools you would like to use (e.g. if you are familiar with cmake, you could find by yourself build option SW_BUILD=OFF) and skipping to read official documentation.
halfer
  • 19,824
  • 17
  • 99
  • 186
user898678
  • 2,994
  • 2
  • 18
  • 17
  • I'll give my answer to each point mentioned: 1) I didn't use the official manual, because it didn't satisfy my needs. Besides, none of the methods listed in the official worked for me, no matter how hard I tried. 2) This stands to reason. 3) This also does. 4) The problem is that sw doesn't work for me at all - I can't even run `sw build`. 5) I tried exactly this tutorial - it failed to compile the very first lib. 6) I just meant to say that when you pay, eveything works out of the box (mostly). You might assume it's my first go with open source software, but it's not true. – James Frezz Nov 27 '19 at 15:41
  • Actually, that might even be overkill - I think, I'll gor for [this approach](https://stackoverflow.com/questions/18180824/how-to-implement-tesseract-to-run-with-project-in-visual-studio-2010). It doesn't help with incorporating into openCV either (that is what I meant by "satisfying my need") but at least that is something in my grasp. Anyways, thanks for your time, sir! – James Frezz Nov 27 '19 at 15:43
  • I forgot to mention that I added SW_BUILD=OFF to cmake (after doing some research). However, when it came to building tesseract, it failed to find leptonica installation files... As for compiler - I changed it to a recent one, which I have installed, but it didn't solve the problem. However, adding to my general overview, if a manual says I can `git clone` a repo, I assume that it **should** be stable. If I clone a repo and a build fails, there is a bug - it has nothing to do with my experience :) I guess, @Soruk is more experienced, but he couldn't compile master branch either. – James Frezz Nov 27 '19 at 16:12
  • With updated [wiki page](https://github.com/charlesw/tesseract/wiki/Compiling-Tesseract-and-Libleptonica-(using-vcpkg)) specifes SW_BUILD=OFF and I was able to build *leptonica* – Soruk Nov 27 '19 at 16:28
  • if official tutorial does not work for you - you can/need to open issue with all details (your setup and errors). Just stated that it does not work is not helping anybody BTW: there are plenty satisfied developers (windows, mac and linux) for which put these tutorials together, so they works ;-) ) – user898678 Dec 01 '19 at 17:35
1

The vcpkg install tesseract:x64-windows approach from the official manual worked! However, I had to take some extra steps, which are described in the issue I opened.

I do not see any reason why it should be such a burden, though. Tesseract does have a Windows binary installer, which is good with the only exception – you don't have access to ANY dev-tools – only executables which are of no use, if you want API.

halfer
  • 19,824
  • 17
  • 99
  • 186
James Frezz
  • 39
  • 1
  • 10