Search code examples
tesseractleptonica

Tesseract 4.00.00alpha compilation


I installed tesseract 4.00.00alpha and leptonica in ubuntu 16.04 x86. When i am using the following command,

tesseract -v

The output is

tesseract 4.00.00alpha
 leptonica-1.74
  libjpeg 8d (libjpeg-turbo 1.4.2) : libpng 1.2.54 : libtiff 4.0.6 : zlib 1.2.8

 Found AVX
 Found SSE

Which is desired.

But while i am trying to compile my following code,

#include<baseapi.h>
#include<allheaders.h>
int main(){
tesseract::TessBaseAPI *first=new tesseract::TessBaseAPI();
printf("Tesseract version %s\n",first->Version());
printf("leptonica version %s\n",getLeptonicaVersion());
return 0;
}

with the command,

g++ sample.cpp -o sample.out -I/usr/local/include/leptonica -I/usr/local/include/tesseract -llept -ltesseract

The output is,

Tesseract version 3.04.01
leptonica version leptonica-1.74

Why the previous tesseract version is being shown? Is there any problem with the library files of tesseract and leptonica? Thank you!


Solution

  • The problem was while installing leptonica 1.74, i used a command,

    sudo apt-get install libleptonica-dev
    

    and while building tesseract 4.00.00 from source, i used a command,

    sudo apt-get install libtesseract-dev
    

    These above two commands are creating the problem. Actually we dont need install libleptionica-dev and libtesseract-dev since you are building tesseract from source.

    I uninstalled both packages and reran my code.

    sudo apt-get remove libleptonica-dev libletesseract-dev
    

    It then worked successfully.