Hello all

I could not find a proper documentation explaining each step explicitly 
regarding the compilation from source including leptonica and some other 
image libs. 

Therefore I created my own scripts and wanted to share them here. Hopefully 
others might benefit as well.

Starting with libpng, libjpeg and libtiff (looks like libz I had was 
already the most recent). 
Otherwise having the exact same issue as:
https://stackoverflow.com/questions/33659458/tesseract-image-issue

   - For libjepg:
   
#!/bin/sh

# Download package from:
# wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz
# Then extract to $base/jpeg/ folder.
# This script will take care of the rest. 

# Package details
base=$HOME/image-libs
pkg=jpeg
vrs=9c

# Go to source folder
cd $base/$pkg/$pkg-$vrs

# Run configure
./configure

# Compile and install
make
make test
sudo make install

   - For libpng:
   
#!/bin/sh

# Download package from:
# wget https://download.sourceforge.net/libpng/libpng-1.6.35.tar.gz
# Then extract to $base/png/ folder.
# This script will take care of the rest. 

# Package details
base=$HOME/image-libs
pkg=libpng
vrs=1.6.35

/home/fertinaz/image-libs/png/libpng-1.6.35
# Go to source folder
cd $base/png/$pkg-$vrs

# Run configure
./configure

# Compile and install
make check
sudo make install


   - For libtiff:
   
#!/bin/sh

# Download package from:
# wget http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz
# Then extract to $base/tiff/ folder.
# This script will take care of the rest. 

# Package details
base=$HOME/image-libs
pkg=tiff
vrs=4.0.9

# Go to source folder
cd $base/$pkg/$pkg-$vrs

# Run configure
./configure

# Compile and install
make
sudo make install

   - Assuming that everything went fine, you can move to next step which is 
   compiling leptonica:

#!/bin/sh

# Get the leptonica source. 
# I located it in $HOME/leptonica

# Package details
base=$HOME
pkg=leptonica

# Go to tesseract repo
cd $base/$pkg

# Start from scratch each time this script is called
rm -rf build && mkdir build && cd build

# Compile and install
cmake .. -DBUILD_PROG=1
make
sudo make install

   - Now you should be able to start compiling tesseract-ocr:
   
#!/bin/sh

# Created clone of the git repo under $base
# Then installed to $prf

# Package details
base=$HOME/Tesseract
pkg=tesseract

prf=$base/$pkg/install

# Go to tesseract repo
cd $base/$pkg

# Generates configuration script
./autogen.sh

# Run configure
./configure --prefix=$prf --enable-debug

# Compile and install -- optional check also not sure how necessary is 
ldconfig when prf is used
make
make check
make install
sudo ldconfig


   - Since this scripts installs tesseract to a specific location, you need 
   to declare the following variable:
   
export TESSDATA_PREFIX=${tesserac_root}/share/tessdata

   - You can put it to your run scripts or ".bashrc". That's up to you.
   
   - One thing that is forgotten is I guess following files needs to be 
   copied to "$install/share/tessdata":
   
$:~/Tesseract$ ls lang-packs/
eng.traineddata  eng.user-patterns  eng.user-words

Hope this helps to others who want to compile from scratch.

// Fatih

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/7569f18e-f1b0-4cf3-bf31-c39570d2d524%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to