tesseract: unclear "leptonica not found" message
$ sudo apt-get install liblept4
Reading package lists... Done
Building dependency tree
Reading state information... Done
liblept4 is already the newest version.
liblept4 set to manually installed.
The following packages were automatically installed and are no longer required:
linux-image-4.2.0-23-generic linux-image-extra-4.2.0-23-generic
linux-signed-image-4.2.0-23-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 16 not upgraded.
teo@xxx1:~/temp/tesseract$ ./configure
checking for g++... g++
...
checking for mbstate_t... yes
checking for leptonica... configure: error: leptonica not found
OR the error message needs to be more precise about how to get leptonica
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (4 by maintainers)
@teo1978: this is standard autotools error message. You will get it for all libraries. ./configure is tool not a teacher. Name of needed package could be different base on distribution.
If you are not familiar with compiling software on your operation system it is not tesseract problem.
Thanks a lot, adgaudio! I was getting the error message “configure: error: Leptonica 1.74 or higher is required.” Try to install libleptonica-dev package". Your solution worked like a charm!!!
I know this is an old closed issue, but I found a solution to this issue and will share my solution, since it was not obvious.
The short summary: I tried building latest tesseract (and leptonica) from source using cmake for both libs. The tesseract cmake step could not find leptonica. My solution was to set PKG_CONFIG_PATH before cmake. My exact steps to address the problem are below.
I will assume you have installed other pre-requisites (like giflib) as specified by both libraries.
After pre-requisites, I installed Leptonica to a custom location:
Then, I installed Tesseract to the same custom location. Note the use of PKG_CONFIG_PATH.
Finally, I use tesseract by exporting these variables in my bash profile. The only one you probably need is PATH…
And an example run:
A single file containing all above code is here: https://gist.github.com/adgaudio/f772004444dc808e900c057d45f8b52e
FYI: If you prefer to use the
./autogen.shapproach, you should be able to replace./configurewithPKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig ./configure --prefix=$INSTALL_PREFIX --with-extra-libraries=$INSTALL_PREFIX/lib. (I just tried it and it worked).I hope you find this helpful 😃
What about fixing the bug instead, so that the error message is clear enough and there’s nothing to figure out?