Closed parulsingh23 closed 3 years ago
There is missing command before running cmake
:
mkdir build.msvs && cd build.msvs
@sirfz : can you manually fix docs with this patch? https://github.com/zdenop/tesserocr/commit/981b240124189ad1439e04d76f03b13a8a8d6e9d.diff
I am not able to make clean PR :-( at the moment.
@zdenop thanks for the catch! I'm down to the final terminal command for tesseract installation
"C:\Program Files\CMake\bin\cmake.exe" --build . --config Release --target install
And I get the following error in many different places:
C:\Project\tesseract-4.1.1\src\textord\bbgrid.h(30,10): fatal error C1083: Cannot open include file: 'allheaders.h': No such file or directory (compiling source file C:\Project\tesseract-4.1.1\src\textord\topitch.cpp) [C:\Project\tesseract-4.1.1\build.msvs\libtesseract.vcxproj]
Where such 'allheaders.h' file is this reffering too? I know that I have "C:\Project\leptonica\src\allheaders.h"
, so do I simply copy this folder somewhere?
allheaders.h
is provided by leptonica. Did you build it and installed it?
I wonder how did you configure tessereact, because it is checking for the correct leptonica location (and "C:\Project\leptonica\src\allheaders.h"
is the wrong location.)
Follow documentation closely.
You said "C:\Project\leptonica\src\allheaders.h"
is the wrong location, so I tried to see if reinstalling leptonica in another directory on my laptop (I tried both ways listed-- the curl & git clone) changed this.
However, both installation & builds of leptonica resulted in only a single allheaders.h file, which was in that same path of leptonica's src folder. I am very confused of what to do next, as my understanding is that installing leptonica isn't giving me a different directory for the allheaders.h file. I also believe that installing/building leptonica is indepedent of the other processes (except for the intial commands where we set INSTALL_DIR
). So going back to the absolute start: setting the 2 environment variables (INSTALL_DIR
and PATH
), installing zlib, installing libpng, and then doing leptonica shouldn't fix the location of the allheaders.h file, right?
Reviewing over the command line outputs, I did notice a warning on missing PkgConfig for this command:
C:\Project\tesseract-4.1.1\build.msvs>"C:\Program Files\CMake\bin\cmake.exe" .. -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DCMAKE_BUILD_TYPE=Release -DBUILD_PROG=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON
The output:
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
Configuring tesseract version 4.1.1...
CMake Warning at cmake/OptimizeForArchitecture.cmake:171 (message):
Your CPU (family 6, model 140) is not known. Auto-detection of
optimization flags failed and will use the 65nm Core 2 CPU settings.
Call Stack (most recent call first):
CMakeLists.txt:130 (AutodetectHostArchitecture)
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE
-- General configuration for Tesseract 4.1.1
-- --------------------------------------------------------
-- Build type: Release
-- Compiler: MSVC
-- Used standard: C++17
-- CXX compiler options: /DWIN32 /D_WINDOWS /W3 /GR /EHsc /utf-8 /MP /MD /O2 /Ob2 /DNDEBUG
-- Linker options: /machine:x64
-- Install directory: C:/win64
-- Architecture flags:
-- Vector unit list: sse2;sse3;ssse3
-- AVX_OPT: OFF
-- AVX2_OPT: OFF
-- FMA_OPT: OFF
-- SSE41_OPT: OFF
-- MARCH_NATIVE_OPT: OFF
-- simd_flags: -DSSE2 -DSSE3 -DSSSE3
-- --------------------------------------------------------
-- Build with cppan [CPPAN_BUILD]: OFF
-- Build with sw [SW_BUILD]: OFF
-- Build with openmp support [OPENMP_BUILD]: OFF
-- Disable disable graphics (ScrollView) [GRAPHICS_DISABLED]: OFF
-- Disable the legacy OCR engine [DISABLED_LEGACY_ENGINE]: OFF
-- Build training tools [BUILD_TRAINING_TOOLS]: OFF
-- Build tests [BUILD_TESTS]: OFF
-- --------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Project/tesseract-4.1.1/build.msvs
Since this didn't stop the build, I proceeded to the next command of "C:\Program Files\CMake\bin\cmake.exe" --build . --config Release --target install
, which results in the error of not being able to access Leptonica's allheaders.h
file).
I thought to then get the PkgConfig, however, it seems very hard to get for Windows 10 (for example: https://stackoverflow.com/questions/1710922/how-to-install-pkg-config-in-windows).
I'm wondering whether this is even the right path ( is getting PkgConfig gonna solve the allheader.h
file being unable to be accessed)?
I've been trying to resolve the issue, but I still have not been able to complete the tesserocr dependency installation.
I understand @zdenop said my Leptonica library hasn't actually installed. Going back to Leptonica's installation instructions, I followed them exactly, and while it didn't throw any error message, it gives a warning on missing PkgConfig.
Now, I'm not sure whether this PkgConfig is the reason tesserocr's provided installation instructions for Leptonica aren't working for sure; I simply have no other output of concern when I run the Leptonica installation commands. But either way, I have been unsuccessfuly in trying to resolve this PkgConfig issue directly (as the post before this shows).
I then tried installing Leptonica another way. I installed vcpkg (in "C:\src"
) and got the Leptonica package (in "C:\src\vcpkg\packages\leptonica_x64-windows"
).
But now I don't know how to integrate vcpkg's Leptonica into the tesseract installation/build into my "C:\win64"
& "C:\Project\tesseract"
.
I tried both methods of using the vcpkg in vcpkg's documentation:
-DCMAKE_TOOLCHAIN_FILE=C:\src\vcpkg\scripts\buildsystems\vcpkg.cmake
to this tesseract build call "C:\Program Files\CMake\bin\cmake.exe" .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DBUILD_TRAINING_TOOLS=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON -DOPENMP_BUILD=OFF -DLeptonica_DIR=%INSTALL_DIR%\lib\cmake
, but that didn't work either.So sorry for the incredibly long posts, I am just so unsure on what steps I need to be taking and whether I am even going in the right direction.
c:\win64\bin
I just make a quick test. Here are my commands and the most important part of logs:
cd c:\src
c:\src>git clone --depth 1 https://github.com/DanBloomberg/leptonica.git
Cloning into 'leptonica'...
remote: Enumerating objects: 960, done.
remote: Counting objects: 100% (960/960), done.
remote: Compressing objects: 100% (929/929), done.
remote: Total 960 (delta 190), reused 370 (delta 29), pack-reused 0
Receiving objects: 100% (960/960), 12.72 MiB | 2.68 MiB/s, done.
Resolving deltas: 100% (190/190), done.
c:\src>cd leptonica
c:\src\leptonica>mkdir build.msvs && cd build.msvs
c:\src\leptonica\build.msvs>cmake .. -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DCMAKE_BUILD_TYPE=Release -DBUILD_PROG=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON
-- Building for: Visual Studio 16 2019
...
-- Build files have been written to: C:/src/leptonica/build.msvs
c:\src\leptonica\build.msvs>cmake.exe --build . --config Release --target install
...
Creating library C:/src/leptonica/build.msvs/src/Release/leptonica-1.82.0.lib and object C:/src/leptonica/build.ms
vs/src/Release/leptonica-1.82.0.exp
leptonica.vcxproj -> C:\src\leptonica\build.msvs\bin\Release\leptonica-1.82.0.dll
Building Custom Rule C:/src/leptonica/CMakeLists.txt
-- Install configuration: "Release"
-- Installing: C:/win64/lib/pkgconfig/lept.pc
-- Installing: C:/win64/lib/cmake/leptonica/LeptonicaConfig.cmake
-- Installing: C:/win64/lib/cmake/leptonica/LeptonicaConfig-version.cmake
-- Installing: C:/win64/lib/leptonica-1.82.0.lib
-- Installing: C:/win64/bin/leptonica-1.82.0.dll
-- Installing: C:/win64/lib/cmake/leptonica/LeptonicaTargets.cmake
-- Installing: C:/win64/lib/cmake/leptonica/LeptonicaTargets-release.cmake
-- Installing: C:/win64/include/leptonica/allheaders.h
-- Installing: C:/win64/include/leptonica/alltypes.h
-- Installing: C:/win64/include/leptonica/array.h
-- Installing: C:/win64/include/leptonica/arrayaccess.h
-- Installing: C:/win64/include/leptonica/bbuffer.h
-- Installing: C:/win64/include/leptonica/bilateral.h
-- Installing: C:/win64/include/leptonica/bmf.h
-- Installing: C:/win64/include/leptonica/bmfdata.h
-- Installing: C:/win64/include/leptonica/bmp.h
-- Installing: C:/win64/include/leptonica/ccbord.h
-- Installing: C:/win64/include/leptonica/colorfill.h
-- Installing: C:/win64/include/leptonica/dewarp.h
-- Installing: C:/win64/include/leptonica/environ.h
-- Installing: C:/win64/include/leptonica/gplot.h
-- Installing: C:/win64/include/leptonica/hashmap.h
-- Installing: C:/win64/include/leptonica/heap.h
-- Installing: C:/win64/include/leptonica/imageio.h
-- Installing: C:/win64/include/leptonica/jbclass.h
-- Installing: C:/win64/include/leptonica/leptwin.h
-- Installing: C:/win64/include/leptonica/list.h
-- Installing: C:/win64/include/leptonica/morph.h
-- Installing: C:/win64/include/leptonica/pix.h
-- Installing: C:/win64/include/leptonica/ptra.h
-- Installing: C:/win64/include/leptonica/queue.h
-- Installing: C:/win64/include/leptonica/rbtree.h
-- Installing: C:/win64/include/leptonica/readbarcode.h
-- Installing: C:/win64/include/leptonica/recog.h
-- Installing: C:/win64/include/leptonica/regutils.h
-- Installing: C:/win64/include/leptonica/stack.h
-- Installing: C:/win64/include/leptonica/stringcode.h
-- Installing: C:/win64/include/leptonica/sudoku.h
-- Installing: C:/win64/include/leptonica/watershed.h
-- Installing: C:/win64/include/leptonica/endianness.h
...
cd ..\..
c:\src>git clone -b 4.1.1 --depth 1 https://github.com/tesseract-ocr/tesseract.git
Cloning into 'tesseract'...
remote: Enumerating objects: 778, done.
remote: Counting objects: 100% (778/778), done.
remote: Compressing objects: 100% (745/745), done.
remote: Total 778 (delta 75), reused 100 (delta 7), pack-reused 0
Receiving objects: 100% (778/778), 2.30 MiB | 2.36 MiB/s, done.
Resolving deltas: 100% (75/75), done.
Note: switching to '75103040c94ffd7fe5e4e3dfce0a7e67a8420849'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
c:\src>cd tesseract
c:\src\tesseract>mkdir build.msvs && cd build.msvs
c:\src\tesseract\build.msvs>cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DBUILD_TRAINING_TOOLS=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON -DOPENMP_BUILD=OFF
I skipped removed pkg-config to emulate your environment. Also, I skipped specifying -DLeptonica_DIR=%INSTALL_DIR%\lib\cmake
as installation should be fixed. Otherwise, you need to adjust Leptonica_DIR to your installation (e.g.
C:\win64\lib\cmake\leptonicaor
-DLeptonica_DIR=%INSTALL_DIR%\lib\cmake\leptonica`)
-- Building for: Visual Studio 16 2019
-- The C compiler identification is MSVC 19.29.30038.1
...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
...
-- Build files have been written to: C:/src/tesseract/build.msvs
c:\src\tesseract\build.msvs>cmake --build . --config Release --target install
...
tesseract.vcxproj -> C:\src\tesseract\build.msvs\bin\Release\tesseract.exe
Building Custom Rule C:/src/tesseract/CMakeLists.txt
-- Install configuration: "Release"
-- Installing: C:/win64/lib/pkgconfig/tesseract.pc
-- Installing: C:/win64/bin/tesseract.exe
-- Installing: C:/win64/lib/tesseract41.lib
-- Installing: C:/win64/bin/tesseract41.dll
-- Installing: C:/win64/cmake/TesseractTargets.cmake
-- Installing: C:/win64/cmake/TesseractTargets-release.cmake
-- Installing: C:/win64/cmake/TesseractConfig.cmake
-- Installing: C:/win64/cmake/TesseractConfig-version.cmake
-- Installing: C:/win64/include/tesseract/apitypes.h
-- Installing: C:/win64/include/tesseract/baseapi.h
-- Installing: C:/win64/include/tesseract/capi.h
-- Installing: C:/win64/include/tesseract/renderer.h
-- Installing: C:/win64/include/tesseract/tess_version.h
-- Installing: C:/win64/include/tesseract/thresholder.h
-- Installing: C:/win64/include/tesseract/ltrresultiterator.h
-- Installing: C:/win64/include/tesseract/pageiterator.h
-- Installing: C:/win64/include/tesseract/resultiterator.h
-- Installing: C:/win64/include/tesseract/osdetect.h
-- Installing: C:/win64/include/tesseract/publictypes.h
-- Installing: C:/win64/include/tesseract/genericvector.h
-- Installing: C:/win64/include/tesseract/helpers.h
-- Installing: C:/win64/include/tesseract/ocrclass.h
-- Installing: C:/win64/include/tesseract/platform.h
-- Installing: C:/win64/include/tesseract/serialis.h
-- Installing: C:/win64/include/tesseract/strngs.h
-- Installing: C:/win64/include/tesseract/tesscallback.h
-- Installing: C:/win64/include/tesseract/unichar.h
=> no problem.
IMO this should be closed after this change https://github.com/sirfz/tesserocr/commit/04c36d88f97333e05828bbc429d60165ab085b13...
I get the following error when I carried out tesseract build and installation
This is especially weird as I had no such error with CMake for leptonica, zlib, nor libpng.
In an attempt to solve this, I simply copied the
C:\Project\tesseract\CMakeLists.txt
file and added it to theProject
parent directory too (so it is also present atC:\Project\CMakeLists.txt
).However, then I get the following error:
I don't understand why there is an entire list of errors, and inside the
CMakeOutput.log
I have:I suppose the error has to do with just the ABI compiler(s) (so
C:\Project\tesseract\CMakeFiles\3.21.1\CMakeDetermineCompilerABI_CXX.bin
orC:\Project\tesseract\CMakeFiles\3.21.1\CMakeDetermineCompilerABI_C.bin
), however, I have no idea why or how to go about fixing it. Any suggestions would be greatly appreciated, thanks!