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

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!

16 Answers

✔️Accepted Answer

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.

Other Answers:

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!

Related Issues:

28
leptonica leptonica 1.78 make install successfully, but tesseract/configure: error: Leptonica 1.74 or higher is required.
That is a hack Here is a more graceful way: make install should have installed a new lept.pc in /usr...