Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tesseract 3.04.01 looks for liblept-4.dll #258

Closed
Shreeshrii opened this issue Mar 8, 2016 · 15 comments
Closed

tesseract 3.04.01 looks for liblept-4.dll #258

Shreeshrii opened this issue Mar 8, 2016 · 15 comments
Labels

Comments

@Shreeshrii
Copy link
Collaborator

I am building tesseract on msys2 on windows. I am using the latest version of leptonica (1.73) which generates liblept-5.dll However, when I run tesseract 3.04.01 it gives the following error.

User@HP MINGW32 ~/tesseract-ocr
$ tesseract -v
C:/msys32/mingw32/bin/tesseract.exe: error while loading shared libraries: liblept-4.dll: cannot open shared object file: No such file or directory

I copied liblept-5.dll as liblept4.dll and was able to run the program - see below.

User@HP MINGW32 ~/tesseract-ocr
$ tesseract -v
tesseract 3.04.01
leptonica-1.73
libgif 5.1.2 : libjpeg 8d (libjpeg-turbo 1.4.2) : libpng 1.6.21 : libtiff 4.0.6 : zlib 1.2.8 : libwebp 0.5.0

Wiki states:
* 3.04 requires at least v1.71 of Leptonica.*

Is 3.04.01 compatible with leptonica 1.73?

@zdenop
Copy link
Contributor

zdenop commented Mar 8, 2016

This is not tesseract problem, but problem how you maintain your system. Compiling from source requires you are familiar with your system.
Building tools requires to links against leptonica. And you system (base how you maintain it) says it should link against liblept-4.dll.
Coping liblept-5.dll as liblept-4.dll is very bad idea.
Maintain you system correctly and you will get good result.

@zdenop zdenop closed this as completed Mar 8, 2016
@amitdo
Copy link
Collaborator

amitdo commented Mar 8, 2016

Did you recompile (./configure, make, sudo make install, sudo ldconfig) tesseract after you recompiled leptonica 1.73?

@Shreeshrii
Copy link
Collaborator Author

Yes, I had used a PKGBUILD similar to the following, without the prepare
section. After Zdenko's comment I have added autogen.sh to it also. Need to
build it again to test.

Maintainer: Alexey Pavlov alexpux@gmail.com

Maintainer: Ray Donnelly mingw.android@gmail.com

_realname=tesseract-ocr
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.04.01
pkgrel=2
pkgdesc="Tesseract OCR (mingw-w64)"
arch=('any')
url="https://github.com/tesseract-ocr/tesseract"
license=("Apache License 2.0")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=(${MINGW_PACKAGE_PREFIX}-cairo
${MINGW_PACKAGE_PREFIX}-gcc-libs
${MINGW_PACKAGE_PREFIX}-icu
${MINGW_PACKAGE_PREFIX}-leptonica
${MINGW_PACKAGE_PREFIX}-pango
${MINGW_PACKAGE_PREFIX}-zlib
${MINGW_PACKAGE_PREFIX}-tesseract-data-eng)

source=(${_realname}-${pkgver}.tar.gz::
https://github.com/tesseract-ocr/tesseract/archive/${pkgver}.tar.gz

https://github.com/tesseract-ocr/tessdata/raw/master/osd.traineddata )
sha256sums=('57f63e1b14ae04c3932a2683e4be4954a2849e17edd638ffe91bc5a2156adc6a'

'9cf5d576fcc47564f11265841e5ca839001e7e6f38ff7f7aacf46d15a96b00ff')

options=('!libtool' 'strip')

prepare() {
cd "${srcdir}/tesseract-${pkgver}"
./autogen.sh
}

build() {
cd "${srcdir}/tesseract-${pkgver}"
[[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}

local -a extra_config
if check_option "debug" "y"; then
extra_config+=( --enable-debug )
fi

../tesseract-${pkgver}/configure
--build=${MINGW_CHOST}
--host=${MINGW_CHOST}
--target=${MINGW_CHOST}
--prefix=${MINGW_PREFIX}
LIBLEPT_HEADERSDIR=${MINGW_PREFIX}/include
"${extra_config[@]}"

make
}

package() {
cd "${srcdir}/build-${CARCH}"
make DESTDIR="${pkgdir}" install
make training
make DESTDIR="${pkgdir}" training-install

mkdir -p $pkgdir/${MINGW_PREFIX}/share/tessdata
install -Dm0644 $srcdir/osd.traineddata
$pkgdir/${MINGW_PREFIX}/share/tessdata/osd.traineddata
cp $srcdir/tessdata/eng.* $pkgdir/${MINGW_PREFIX}/share/tessdata
cp $srcdir/tessdata/configs/bazaar
$pkgdir/${MINGW_PREFIX}/share/tessdata/configs
find $pkgdir/${MINGW_PREFIX}/share/tessdata -type f -exec chmod 0644 {} ;
}

ShreeDevi


भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com

On Wed, Mar 9, 2016 at 12:26 AM, Amit Dovev notifications@github.com
wrote:

Did you recompile (./configure, make, sudo make install, sudo ldconfig)
tesseract after you recompiled leptonica 1.73?


Reply to this email directly or view it on GitHub
#258 (comment)
.

@zdenop
Copy link
Contributor

zdenop commented Mar 9, 2016

rebuilding tesseract does not help unless leptonica instalation is not fixed within msys...

@Shreeshrii
Copy link
Collaborator Author

I have built Leptonica 1.73 on msys2 locally. It is not yet reflected in
Msys2 repository.

ShreeDevi


भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com

On Wed, Mar 9, 2016 at 1:05 PM, zdenop notifications@github.com wrote:

rebuilding tesseract does not help unless leptonica instalation is not
fixed within msys...


Reply to this email directly or view it on GitHub
#258 (comment)
.

@amitdo
Copy link
Collaborator

amitdo commented Mar 10, 2016

Do you have liblept.dll?
It should be a symlink to liblept-5.dll

@Shreeshrii
Copy link
Collaborator Author

No liblept.dll.

I have liblept.a and liblept.dll.a in lib directory and liblept-5.dll in
bin directory.

ShreeDevi


भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com

On Thu, Mar 10, 2016 at 6:57 PM, Amit Dovev notifications@github.com
wrote:

Do you have liblept.dll?
It should be a symlink to liblept-5.dll


Reply to this email directly or view it on GitHub
#258 (comment)
.

@amitdo
Copy link
Collaborator

amitdo commented Mar 11, 2016

As zdenko said, something is wrong with your leptonica installation.

Here are the files in my linux system:

/usr/local/lib/liblept.a
/usr/local/lib/liblept.la
/usr/local/lib/liblept.so symlink to /usr/local/lib/liblept.so.5.0.0
/usr/local/lib/liblept.so.5 symlink to /usr/local/lib/liblept.so.5.0.0
/usr/local/lib/liblept.so.5.0.0

@zdenop
Copy link
Contributor

zdenop commented Mar 11, 2016

Real problem is that he has several installation of leptonica but msys instruct linker to use older leptonica version (which could be reasonable if older version was installed by msys packagin system and new version "by hand") . There are several ways how to solve it:

  1. Learn how your environment/system is working, how to manage it
  2. If 1. is not option - wait for official packages and do to try to compile from source
  3. Use only one version of software => do not use packaging system, but compile from source. From my experience, this option will sooner or later lead to the current status (something goes wrong and I have not clue why) ;-).

@amitdo
Copy link
Collaborator

amitdo commented Mar 11, 2016

Shree,

Here are the commands I ran on Linux:

cd path/to/leptonica-1.73

./configure
make
sudo make install
sudo ldconfig

cd path/to/tesseract-ocr
./autogen.sh
./configure  --enable-debug
make
sudo make install
sudo ldconfig
make training
sudo make training-install

Did you run sudo ldconfig ?

@Shreeshrii
Copy link
Collaborator Author

Amit & Zdenko.

Yes, the problem on msys2 maybe because I am trying to use the PKGBUILD
system for building the software (which is what was recommended by the
msys2 developers when I was trying to build the earlier release by hand).

I was able to build and run 1.73 leptonica and the latest source of
tesseract on ubuntu 14.04 without problems.

Thanks!

ShreeDevi


भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com

On Fri, Mar 11, 2016 at 5:41 PM, zdenop notifications@github.com wrote:

Real problem is that he has several installation of leptonica but msys
instruct linker to use older leptonica version (which could be reasonable
if older version was installed by msys packagin system and new version "by
hand") . There are several ways how to solve it:

  1. learn how you environment/system is working, how to manage it
  2. If 1. is not option - wait for official packages and do to try to
    compile from source
  3. Use only one version of software => do not use packaging system,
    but compile from source. From my experience, this option will sooner or
    later lead to the current status (something goes wrong and I have not clue
    why) ;-).


Reply to this email directly or view it on GitHub
#258 (comment)
.

@Shreeshrii
Copy link
Collaborator Author

I did not run
sudo ldconfig
after building leptonica, but did after building tesseract.

I used the following commands:

./autogen.sh
./configure
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make
sudo make install
sudo ldconfig
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make training
sudo make training-install

ShreeDevi


भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com

On Fri, Mar 11, 2016 at 7:41 PM, Amit Dovev notifications@github.com
wrote:

Shree,

Here are the commands I ran on Linux:

cd path/to/leptonica-1.73

./configure
make
sudo make install
sudo ldconfig

cd path/to/tesseract-ocr
./autogen.sh
./configure --enable-debug
make
sudo make install
sudo ldconfig
make training
sudo make training-install

Did you run sudo ldconfig ?


Reply to this email directly or view it on GitHub
#258 (comment)
.

@amitdo
Copy link
Collaborator

amitdo commented Mar 13, 2016

Shree,

About your Compiling wiki edit.

You need to run sudo ldconfig after every time you manually (not with package manager) update, add or remove a shared library (*.so / *.dll).

./autogen.sh
./configure
make
sudo make install
sudo ldconfig

Here sudo ldconfig is needed because sudo make install installed a library - libtesseract.so.3, in your system.

However, sudo ldconfig is not needed after

make training
sudo make training-install

because sudo make training-install only install some programs, but does not install any library.

@amitdo
Copy link
Collaborator

amitdo commented Mar 13, 2016

@Shreeshrii
Copy link
Collaborator Author

Thanks, please change the wiki.

ShreeDevi


भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com

On Sun, Mar 13, 2016 at 8:24 PM, Amit Dovev notifications@github.com
wrote:

http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html


Reply to this email directly or view it on GitHub
#258 (comment)
.

@amitdo amitdo added the question label Jun 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants