Re: Build tesseract without root access

1,927 views
Skip to first unread message

Nick White

unread,
Sep 19, 2012, 4:56:37 AM9/19/12
to tesser...@googlegroups.com
Hi,

I built and installed tesseract without root access, as I needed to
run it on a cluster (well, wanted to, for extra cool points.)

I built them like this:

leptonica:
./configure --prefix=$HOME/local/
make install

tesseract:
LIBLEPT_HEADERSDIR=$HOME/local/include ./configure \
--prefix=$HOME/local/ --with-extra-libraries=$HOME/local/lib
make install

That should be all you need. Let me know if you run into issues.

Nick

zdenko podobny

unread,
Sep 19, 2012, 5:43:43 AM9/19/12
to tesser...@googlegroups.com
Additionally I would suggest to use 3.02 version (in svn) with configure option "--disable-tessdata-prefix" (a.k.a. windows behavior ;-) ). This will cause tesseract will expect to have tessdata directory in the same directory where is tesseract executable (useful if you need portable tesseract).

If you do not use this option - tesseract will use built-in variable pointing to $PREFIX directory when searching for tessdata directory.
Of course there is possibility (in both cases) to use environment variable TESSDATA_PREFIX.

-- 
Zdenko


--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesser...@googlegroups.com
To unsubscribe from this group, send email to
tesseract-oc...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en


zdenko podobny

unread,
Sep 23, 2012, 3:34:53 PM9/23/12
to tesser...@googlegroups.com
On Sat, Sep 22, 2012 at 8:42 PM, operE Aperte <opereap...@gmail.com> wrote:
Based on your tips i submitted this script to make leptonica and tesseract:


#!/bin/sh

#leptonica:
cd leptonica-1.69 
./configure --prefix=$HOME/local/ 
make install 
 
#tesseract: 
cd ../tesseract-3.01

LIBLEPT_HEADERSDIR=$HOME/local/include ./configure \ 
  --prefix=$HOME/local/ --with-extra-libraries=$HOME/local/lib 
make install 

The result is ok for building leptonica, but the script fails with tesseract, reporting this:

11:12:06: [www] configure: WARNING: you should use --build, --host, --target
11:12:06: [www] configure: WARNING: invalid host type:
11:12:06: [www] config.sub: missing argument
11:12:06: [www] Try `config.sub --help' for more information.
11:12:06: [www] configure: error: /bin/bash config/config.sub   failed
11:12:06: [www] ./prebuild.sh: 17: --prefix=/home/dotcloud/local/: not found
11:12:06: [www] make: *** No rule to make target `install'.  Stop.
11:12:07: [www] checking build system type... -- Build failed: "chmod +x ./prebuild.sh ; ./prebuild.sh" failed with return code 2
11:12:08: [www] Build failed for service (www)
11:12:08: --> Deployment of application (dotcloudtest) aborted due to 1 build error(s)

1. This does not look like (standard) configure output.
2. There is no ./prebuild.sh within tesseract. It looks like there are several problems within this script.
3. run ./autogen.sh before configure
4. you do not need sudo/root access for building tesseract. You need in only for installing to restricted locations.

--
Zdenko

Francisco Loché Costa

unread,
Sep 24, 2012, 3:27:19 PM9/24/12
to tesser...@googlegroups.com
Maybe this can help you in some way. Tray to download pytesser:

http://code.google.com/p/pytesser/

Even if you don´t know python or you can work with it, this module cames with all you need to run tesseract propiertly. all you need (i think) is to make another script in a language you know to call tesseract. Read the documentation and look to the python script, it´s easy to understand.

I don´t know if Leptonica is included, but you don´t loose anything on trying.

2012/9/18 operE Aperte <opereap...@gmail.com>
Hi,
I'm trying to deploy a webapp that features OCR on uploaded images, but I have no root access to build tesseract3 and leptonica on hosting machine (ubuntu 10.04).
How can I do that without sudo?

thx 

--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesser...@googlegroups.com
To unsubscribe from this group, send email to
tesseract-oc...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en



--
  Francisco Loché Costa,
  Ingeniero Técnico de Telecomunicación, esp. Telemática.

zdenko podobny

unread,
Oct 21, 2012, 3:55:38 PM10/21/12
to tesser...@googlegroups.com


On Sun, Oct 21, 2012 at 8:17 PM, operE Aperte <opereap...@gmail.com> wrote:
Finally I got building tesseract, but honestly i don't know how ... I submitted many times the same code you posted, but only few days ago it worked.

Here is the working Prebuild.sh:
#!/bin/sh


#leptonica:
cd leptonica-1.69 
./configure --prefix=$HOME/local/ 
make install 

#tesseract: 
cd ../tesseract-3.01 
cp -R tessdata $HOME/local/share
./autogen.sh
LIBLEPT_HEADERSDIR=$HOME/local/include
./configure --prefix=$HOME/local/ --with-extra-libraries=$HOME/local/lib
export TESSDATA_PREFIX=$HOME/local/share/
make install 

chmod +x $HOME/local/bin/tesseract

Attached to this post you find the full building log.

It looks like you forget to attach it.
 
You can see few warning/errors that seem not to stop the building process,

Warnings are not problem.
 
but that end up to affect tesseract execution because if I run this basic python code:

wsgi.py:
import subprocess
def application(environ, start_response):
    status = '200 OK'
    response_headers = [('Content-type', 'text/plain')]
    start_response(status, response_headers)
    
    args = ['/home/dotcloud/local/bin/tesseract', 'eurotext.tif','eurotext.txt']
    p = subprocess.Popen(args, stdout = subprocess.PIPE, stdin = subprocess.PIPE, stderr = subprocess.STDOUT)
    preprocessed, _ = p.communicate()  
    
    return [preprocessed]+[_]

I got this:

Error in findTiffCompression: function not present
Error in pixReadStreamTiff: function not present
Error in pixReadStream: tiff: no pix returned
Error in pixRead: pix not read
Tesseract Open Source OCR Engine v3.01 with Leptonica
Unsupported image type.

This indicates you have no support for tiff in leptonica. Have a look at config.log in leptonica directory or catch output of leptonica configure information with:
   ./configure 2>&1 | tee log_configure
Screen output will be in log_configure file.
 
I'm sure what I miss are those libs (http://code.google.com/p/tesseract-ocr/wiki/ReadMe):

sudo apt-get install autoconf automake libtool
sudo apt
-get install libpng12-dev
sudo apt
-get install libjpeg62-dev
sudo apt
-get install libtiff4-dev
sudo apt
-get install zlib1g-dev

but, again, I don't how to install them without sudo.

You can build them from source the same way (command) as you built leptonica. Maybe it would make sense to build only static libraries.

-- 
Zdenko
 
Thank you all
fabio 
--
Reply all
Reply to author
Forward
0 new messages