Giter Club home page Giter Club logo

Comments (8)

4F2E4A2E avatar 4F2E4A2E commented on August 20, 2024

Hi there!

Which version of tess4j and centos are you using?

Am 20.01.2016 um 19:53 schrieb lukiant-dev [email protected]:

Hello!
Unfortunately I am not able to run tesseract through tess4j on Linux (CentOS).
I think that tesseract is being loaded correctly with JNA, but for some reason he can't find liblept.so.
Is it possible to somehow tell tesseract which is loaded through JNA where he should look for liblept.so?
Or maybe it would be possible to compile tesseract in such way that leptonica shared library wouldn't be needed at execution time?

NOTE1: I can't set LD_LIBRARY_PATH environment variable. It solves the problem but cannot be done on my system.
NOTE2: Leptonica is not installed on local machine.
NOTE3: I have compiled Tesseract from the source (tried github master branch and 3.02 from sourceforge).


Reply to this email directly or view it on GitHub.

from tess4j.

lukiant-dev avatar lukiant-dev commented on August 20, 2024

tess4j src from master branch
CentOS 6.7 x64

from tess4j.

guggi1 avatar guggi1 commented on August 20, 2024

Hi, I am having the same issue.

Using Tess4j-2.0.1.jar which comes with Tesseract 3.03 and Leptonica 1.7.

It works fine on Tomcat under Windows but Linux won't work.
I have compiled Tesseract and Leptonica on my Linux Servers and taken the libtesseract.so file and it recognizes it. So far so good. However the liblept.so.4 is not recognized anywhere.
I have tried the following:

  1. gave full permission (chmod 777 liblept.so.4)
  2. placed the liblept.so.4 under user/local
  3. placed the liblept.so.4 under user/local/share
  4. added the liplept.so.4 to the tess4j JAR (together with libtesseract.so) under /linux-x86-64
  5. placed the liblept.so.4 under TOMCAT_HOME/lib and set the path in the wrapper of tomcat.config
    (wrapper.java.additional.4=-Djna.library.path=%TOMCAT_HOME%/lib)
  6. tried to work with LD_LIBRARY_PATH
  7. Placed it under WEB-INF/classes

Always the same error:
UnsatisfiedLinkError: liblept.so.4: cannot open shared object file: No such file or directory

from tess4j.

 avatar commented on August 20, 2024

Had the same problem, solved it for me by loading liblept.so in the static-block in LoadLibs. So leptonica.so is loaded before tesseract is loaded by calling getTessAPIInstance.

from tess4j.

guggi1 avatar guggi1 commented on August 20, 2024

Very smart approach. I will try it. Did you use the static function?
System.loadLibrary("liblept");

from tess4j.

 avatar commented on August 20, 2024

Yes, I packed liblept.so.4 with tess4j, extracted it to the tempdir like tess4j does with tesseract and called
System.load(targetTempFolder + "/liblept.so.4");

from tess4j.

guggi1 avatar guggi1 commented on August 20, 2024

People, mhinters rules! Thanks. It worked.

Please note:

  1. Using System.loadLibrary("liblept") did not work although the file was present in the java.library.path (Tesseract tries to load from a different place)
  2. We have also tried renaming "liblept.so.4" to "liblept.so" which did not work

The only thing was to give the real full path of "liblept.so.4" to the static function and calling it before Tesseract does, like this:

System.load("/opt/tomcat7/project/liblept.so.4") ;

mhinters, thanks again.

PS: Make sure the file has the right permissions

from tess4j.

4F2E4A2E avatar 4F2E4A2E commented on August 20, 2024

You can also create a symlink.

from tess4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.