DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.72k stars 384 forks source link

Errors building Leptonica for use with Tesseract #746

Open carlosiosio opened 1 month ago

carlosiosio commented 1 month ago

I am attempting to build Leptonica to work with Tesseract and am getting errors. Windows environment with cmake and MINGW4. I have installed SW and VCPKG. Here are steps taken:

git clone https://github.com/DanBloomberg/leptonica.git git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh # "./bootstrap-vcpkg.bat" for powershellcd vc ./vcpkg integrate install ./vcpkg install leptonica

./vcpkg install giflib:x86-windows-static libjpeg-turbo:x86-windows-static liblzma:x86-windows-static libpng:x86-windows-static tiff:x86-windows-static zlib:x86-windows-static ./vcpkg install giflib:x64-windows-static libjpeg-turbo:x64-windows-static liblzma:x64-windows-static libpng:x64-windows-static tiff:x64-windows-static zlib:x64-windows-static cd ../leptonica mkdir build cd build cmake .. -G "MinGW Makefiles"

I am getting the following error. There are seven total at this stage, but I am only including the first.

$ cmake .. -G "MinGW Makefiles" -- The C compiler identification is GNU 14.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/msys64/ucrt64/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Found SW: C:/SW/sw.exe -- sw: processing dependencies Performing 9 check(s): org.sw.demo.jpeg-9.6.0 (jpeg), config 974348 [139/140] C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp [138/140] C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp [138/140] C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp [138/140] C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp [138/140] C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp [138/140] C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp [138/140] C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp Exception in file D:/dev/cppan2/client2/src/sw/driver/module.cpp:120, function operator (): error in module (C:/Users/carlo/.sw/storage/tmp/cfg/816239/loc.sw.self.e14e94-0.0.36.dll): Exception in file D:/dev/cppan2/client2/src/sw/builder/command.cpp:849, function execute1: When executing: C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp C:/Users/carlo/.sw/storage/pkg/45/9f/6c5f/src/sdir/sw.cpp(2): fatal error C1083: Cannot open include file: 'd:/dev/primitives/src/templates2/include/primitives/templates2/makefile.h': No such file or directory command failed: exit code = 2 Total errors: 1

Note that the file that cannot be opened is pointing at the D: volume, which does not exist.

Not sure if I have missed some steps, or have some other setup issue. I previously tried to follow the instructions on this page: https://github.com/charlesw/tesseract/blob/master/docs/Compling_tesseract_and_leptonica.md

but to no avail. I am hoping someone may either have seen similar issues before, be familiar enough with the environment to help, or better yet, have a secret formula for building Leptonica and Tesseract (ideally as static library if possible)

Charltsing commented 1 month ago

https://github.com/Charltsing/Leptonica-binaries-for-windows

panterlo commented 1 month ago

Hey @carlosiosio - let me help you out since I compiled Leptonica today on my Windows machine.

I just used two two docs and I worked out well:

https://github.com/DanBloomberg/leptonica/wiki https://github.com/tesseract-ocr/tesseract/blob/main/.github/workflows/cmake-win64.yml