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

leptonica 1.78 make install successfully, but tesseract/configure: error: Leptonica 1.74 or higher is required. #410

Closed
geyungjen opened this issue Mar 23, 2019 · 15 comments

Comments

@geyungjen
Copy link

I have successfully cmake, make, make install leptonica 1.78.

But in tesseract,

run configure

Got error: Leptonica 1.74 or higher is required. Try to install libleptonica-dev package.

Following is the make install leptonica 1.78

[root@localhost build]# make install
[100%] Built target leptonica
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/pkgconfig/lept.pc
-- Installing: /usr/local/cmake/LeptonicaConfig.cmake
-- Installing: /usr/local/cmake/LeptonicaConfig-version.cmake
-- Installing: /usr/local/lib/libleptonica.so.1.78.0
-- Installing: /usr/local/lib/libleptonica.so.5.3.0
-- Installing: /usr/local/lib/libleptonica.so
-- Old export file "/usr/local/cmake/LeptonicaTargets.cmake" will be replaced. Removing files [/usr/local/cmake/LeptonicaTargets-noconfig.cmake].
-- Installing: /usr/local/cmake/LeptonicaTargets.cmake
-- Installing: /usr/local/cmake/LeptonicaTargets-noconfig.cmake
-- Installing: /usr/local/include/leptonica/allheaders.h
-- Installing: /usr/local/include/leptonica/alltypes.h
-- Installing: /usr/local/include/leptonica/array.h
-- Installing: /usr/local/include/leptonica/arrayaccess.h
-- Installing: /usr/local/include/leptonica/bbuffer.h
-- Installing: /usr/local/include/leptonica/bilateral.h
-- Installing: /usr/local/include/leptonica/bmf.h
-- Installing: /usr/local/include/leptonica/bmfdata.h
-- Installing: /usr/local/include/leptonica/bmp.h
-- Installing: /usr/local/include/leptonica/ccbord.h
-- Installing: /usr/local/include/leptonica/dewarp.h
-- Installing: /usr/local/include/leptonica/endianness.h
-- Installing: /usr/local/include/leptonica/environ.h
-- Installing: /usr/local/include/leptonica/gplot.h
-- Installing: /usr/local/include/leptonica/heap.h
-- Installing: /usr/local/include/leptonica/imageio.h
-- Installing: /usr/local/include/leptonica/jbclass.h
-- Installing: /usr/local/include/leptonica/leptwin.h
-- Installing: /usr/local/include/leptonica/list.h
-- Installing: /usr/local/include/leptonica/morph.h
-- Installing: /usr/local/include/leptonica/pix.h
-- Installing: /usr/local/include/leptonica/ptra.h
-- Installing: /usr/local/include/leptonica/queue.h
-- Installing: /usr/local/include/leptonica/rbtree.h
-- Installing: /usr/local/include/leptonica/readbarcode.h
-- Installing: /usr/local/include/leptonica/recog.h
-- Installing: /usr/local/include/leptonica/regutils.h
-- Installing: /usr/local/include/leptonica/stack.h
-- Installing: /usr/local/include/leptonica/stringcode.h
-- Installing: /usr/local/include/leptonica/sudoku.h
-- Installing: /usr/local/include/leptonica/watershed.h
-- Installing: /usr/local/include/leptonica/endianness.h

How to make tesseract configure to recognize newly made install leptonica 1.78? Thanks!

@geyungjen
Copy link
Author

If I run below, I do not get anything returns, no "lept"

[root@localhost build]# ldconfig -p | grep -i lept
[root@localhost build]#

Is "make install" the last step or there is post install needs to run for other to recognize existence of Leptonica 1.78 that I have successfully run on centOS 7 machine?

Appreciate your inputs,

George

@DanBloomberg
Copy link
Owner

Is this expected:

-- Installing: /usr/local/lib/libleptonica.so.1.78.0
-- Installing: /usr/local/lib/libleptonica.so.5.3.0

1.78.0 is the version number, not the so number, which is 5.3.0

@amitdo
Copy link
Contributor

amitdo commented Mar 24, 2019

See #253.

@geyungjen
Copy link
Author

Thanks Dan and Amit so much to take time to reply my query.

I checked config.log in running tesseract/configure and trace configure shell script, and figure out it looks for lept from /usr/bin/pkg-config --CFLAGS lept

[root@localhost ~]# export PKG_CONFIG=/usr/bin/pkg-config
[root@localhost ~]# echo $PKG_CONFIG
/usr/bin/pkg-config
[root@localhost ~]# pkg_cv_LEPTONICA_CFLAGS=$PKG_CONFIG --cflags "lept >= 1.74" 2>/dev/null
[root@localhost ~]# echo $pkg_cv_LEPTONICA_CFLAGS

[root@localhost ~]# $PKG_CONFIG --cflags
Must specify package names on the command line
[root@localhost ~]# $PKG_CONFIG --cflags "lept >= 1.74"
Requested 'lept >= 1.74' but version of leptonica is 1.72
[root@localhost ~]#

The Leptonica I installed from source is 1.78 higher than 1.74,

If I do below

[root@localhost ~]# $PKG_CONFIG --cflags "lept"
-I/usr/include/leptonica

It is not /usr/local/include/leptonica

What is the best approach for

$PKG_CONFIG --cflags "lept"

to output

I/usr/local/include/leptonica

Thanks again,

George

@geyungjen
Copy link
Author

I finally made tesseract/configure to work by:

vi ./usr/lib64/pkgconfig/lept.pc

Change version number to 1.78 as it was made installed from source
Point Includedir to /usr/local/include/leptonica

Link so file

ln -s /usr/local/lib/liblept.so ./usr/lib64/liblept.so

Then check below by running below

/usr/bin/pkg-config --cflags "lept >= 1.74"
-I/usr/local/include/leptonica

Now run
./configure
make
sudo make install

It installed tesseract successfully.

While I have installed tesseract, I feel the approach I did is a hack. There could be more graceful way to do this.

Thanks a lot for your replies, Dan and Amit!

@stweil
Copy link
Collaborator

stweil commented Mar 24, 2019

That is a hack. Here is a more graceful way:

make install should have installed a new lept.pc in /usr/local/lib/pkgconfig. Set the environment variable PKG_CONFIG_PATH to that directory, then your build process should find the new Leptonica with the right compiler and linker settings.

@zdenop
Copy link
Collaborator

zdenop commented Mar 24, 2019

Basic problem is that you are mixing build tools with expectation they provide the same features:
Why you do not use autotools also for building leptonica?
Cmake support at leptonica&tesseract is focus on "non-autotools" environment (Windows and VS). It works on linux too, but than you should use cmake for building tesseract too...

@geyungjen
Copy link
Author

It would be very helpful to add a section in readme, will save lot of people lots of time.

Thanks all for the inputs, I will note them for my next build.

I will close this comment.

@DanBloomberg
Copy link
Owner

@zdenop, @stweil

I think the suggestion to have something in the tesseract and leptonica READMEs that addresses this problem would be useful. If either one of you sends me some text, I'll put it prominently in the leptonica README.

@zdenop
Copy link
Collaborator

zdenop commented Mar 25, 2019

I made reference on tesseract compiling wiki. I hope this will help on tesseract side.

@DanBloomberg
Copy link
Owner

Thanks. That should cover it. I'll reference the tesseract page in the leptonica readme.

@LDWdeve
Copy link

LDWdeve commented Mar 27, 2019

run ./configure CC=gcc-8 CXX=g++-8 CPPFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib

checking for lept >= 1.74... yes
checking for libarchive... no
checking for icu-uc >= 52.1... no
checking for icu-i18n >= 52.1... no
checking for pango >= 1.22.0... no
configure: WARNING: pango 1.22.0 or higher is required, but was not found.
configure: WARNING: Training tools WILL NOT be built.
configure: WARNING: Try to install libpango1.0-dev package.
checking for cairo... no

why?

@amitdo
Copy link
Contributor

amitdo commented Mar 27, 2019

why?

Why do you ask here?

It's not an issue with Leptonica.

Use tesseract-ocr forum for support.

@dbandurin
Copy link

dbandurin commented Nov 13, 2019

I finally made tesseract/configure to work by:

vi ./usr/lib64/pkgconfig/lept.pc

Change version number to 1.78 as it was made installed from source
Point Includedir to /usr/local/include/leptonica

Link so file

ln -s /usr/local/lib/liblept.so ./usr/lib64/liblept.so

Then check below by running below

/usr/bin/pkg-config --cflags "lept >= 1.74"
-I/usr/local/include/leptonica

Now run
./configure
make
sudo make install

It installed tesseract successfully.

While I have installed tesseract, I feel the approach I did is a hack. There could be more graceful way to do this.

Thanks a lot for your replies, Dan and Amit!

I made it working, too!
In addition I had to run
sudo cp /usr/local/lib/pkgconfig/lept.pc /usr/lib64/pkgconfig/

One needs to also make sure that these two variables are defined:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PKG_CONFIG=/usr/bin/pkg-config

Thanks!

@HduSy
Copy link

HduSy commented Jun 13, 2020

I finally made tesseract/configure to work by:

vi ./usr/lib64/pkgconfig/lept.pc

Change version number to 1.78 as it was made installed from source
Point Includedir to /usr/local/include/leptonica

Link so file

ln -s /usr/local/lib/liblept.so ./usr/lib64/liblept.so

Then check below by running below

/usr/bin/pkg-config --cflags "lept >= 1.74"
-I/usr/local/include/leptonica

Now run
./configure
make
sudo make install

It installed tesseract successfully.

While I have installed tesseract, I feel the approach I did is a hack. There could be more graceful way to do this.

Thanks a lot for your replies, Dan and Amit!

Thankyou very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants