Leptoncia vs libleptonica-dev

1,002 views
Skip to first unread message

Ning Zhao

unread,
Jun 13, 2018, 2:16:18 AM6/13/18
to tesseract-ocr
Hi all,

The question in my mind now is whether leptonica and libleptonica-dev are the same thing as leptonica doesn't provide an executable. How can I check I have installed them/it successfully?

Here is how this question came into my mind:

I'm following these links to install tesseract on Ubuntu 16.04:
https://github.com/tesseract-ocr/tesseract/wiki/Compiling-–-GitInstallation

For the leptonica part, I followed this link and installed leptonica 1.76.0:

When I move on to the tesseract part, `./configure --prefix=$HOME/miniconda3/envs/cheetoh` (I'm using conda) complained:

checking for LEPTONICA... no

configure: error: Leptonica 1.74 or higher is required. Try to install libleptonica-dev package.


Also tried `LIBLEPT_HEADERSDIR=$HOME/miniconda3/envs/cheetoh/include ./configure --prefix=$HOME/miniconda3/envs/cheetoh` resulting the same error message.

I don't know whether I have installed leptonica successfully. How can I check?

What I can think of:

$ ls ~/miniconda3/envs/cheetoh/lib

liblept.a  liblept.la  liblept.so  liblept.so.5  liblept.so.5.0.3  pkgconfig

$ ls ~/miniconda3/envs/cheetoh/include/leptonica/

allheaders.h   bmfdata.h     environ.h  list.h    readbarcode.h  watershed.h

alltypes.h     bmf.h         gplot.h    morph.h   recog.h

arrayaccess.h  bmp.h         heap.h     pix.h     regutils.h

array.h        ccbord.h      imageio.h  ptra.h    stack.h

bbuffer.h      dewarp.h      jbclass.h  queue.h   stringcode.h

bilateral.h    endianness.h  leptwin.h  rbtree.h  sudoku.h


Cheers,
Ning

Marco Atzeri

unread,
Jun 13, 2018, 3:12:10 AM6/13/18
to tesser...@googlegroups.com
On 6/13/2018 8:16 AM, Ning Zhao wrote:
> Hi all,
>
> The question in my mind now is whether leptonica and libleptonica-dev
> are the same thing as leptonica doesn't provide an executable. How can I
> check I have installed them/it successfully?
>

leptonica is a library.
As any library is usually provided in any distribution as

- shared library to be used by programs
- import library and header (development) to allow compilation and
link to the shared one

If you compile tesseract from source you need both, if you are
using tessseract compiled by someone else you need only the shared library

In debian

https://packages.debian.org/sid/liblept5
https://packages.debian.org/sid/libleptonica-dev

similar in other distribution

Ning Zhao

unread,
Jun 13, 2018, 3:51:19 AM6/13/18
to tesseract-ocr
Thanks marco for you explanation.

As I can find liblept.{a,la,so} in lib folder and leptonica in include folder, I assume I have installed leptonica successfully. So the question would be how to let tesseract/configure know where the libs and headers are when I try to compile tesseract. Is that correct?

Ning

Ning Zhao

unread,
Jun 13, 2018, 4:22:21 AM6/13/18
to tesseract-ocr
I finally got ./configure passed. The solution is in the "Common Errors" section of the compiling guide, quoted here:

If configure fails with such error "configure: error: Leptonica 1.74 or higher is required." Try to install libleptonica-dev package.
If you are sure you have installed leptonica (for example in /usr/local) then probably pkg-config is not looking at your install folder (check with pkg-config --variable pc_path pkg-config).
A solution is to set PKG_CONFIG_PATH : example :PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

What I did was (assuming leptonica 1.76.0 installed successfully):
export PKG_CONFIG_PATH=$HOME/miniconda3/envs/cheetoh/lib/pkgconfig
./configure --prefix=$HOME/miniconda3/envs/cheetoh

Ning
Reply all
Reply to author
Forward
0 new messages