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

Unable to get Tesseract Build for Windows #268

Closed
parulsingh23 opened this issue Aug 25, 2021 · 9 comments
Closed

Unable to get Tesseract Build for Windows #268

parulsingh23 opened this issue Aug 25, 2021 · 9 comments

Comments

@parulsingh23
Copy link

parulsingh23 commented Aug 25, 2021

I get the following error when I carried out tesseract build and installation

C:\Project\tesseract>"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

CMake Error: The source directory "C:/Project" does not appear to contain CMakeLists.txt.

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 the Project parent directory too (so it is also present at C:\Project\CMakeLists.txt).

However, then I get the following error:

C:\Project\tesseract>"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
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.29.30133.0
-- The CXX compiler identification is MSVC 19.29.30133.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:44 (file):
  file STRINGS file "C:/Project/VERSION" cannot be read.


CMake Error at CMakeLists.txt:45 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.


CMake Error at CMakeLists.txt:46 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.


CMake Error at CMakeLists.txt:47 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.


Configuring tesseract version ...
CMake Error at CMakeLists.txt:128 (include):
  include could not find requested file:

    OptimizeForArchitecture


CMake Error at CMakeLists.txt:129 (AutodetectHostArchitecture):
  Unknown CMake command "AutodetectHostArchitecture".


-- Configuring incomplete, errors occurred!
See also "C:/Project/tesseract/CMakeFiles/CMakeOutput.log".

I don't understand why there is an entire list of errors, and inside the CMakeOutput.log I have:

The system is: Windows - 10.0.19042 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler:  
Build flags: 
Id flags:  

The output was:
0
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 8/25/2021 3:16:19 PM.
Project "C:\Project\tesseract\CMakeFiles\3.21.1\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
  Creating directory "Debug\CompilerIdC.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdC.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc142.pdb" /external:W0 /Gd /TC /FC /errorReport:queue CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X64 Debug\CMakeCCompilerId.obj
  CompilerIdC.vcxproj -> C:\Project\tesseract\CMakeFiles\3.21.1\CompilerIdC\CompilerIdC.exe
PostBuildEvent:
  for %%i in (cl.exe) do @echo CMAKE_C_COMPILER=%%~$PATH:i
  :VCEnd
  CMAKE_C_COMPILER=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
FinalizeBuildStatus:
  Deleting file "Debug\CompilerIdC.tlog\unsuccessfulbuild".
  Touching "Debug\CompilerIdC.tlog\CompilerIdC.lastbuildstate".
Done Building Project "C:\Project\tesseract\CMakeFiles\3.21.1\CompilerIdC\CompilerIdC.vcxproj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.57


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.exe"

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.vcxproj"

The C compiler identification is MSVC, found in "C:/Project/tesseract/CMakeFiles/3.21.1/CompilerIdC/CompilerIdC.exe"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler:  
Build flags: 
Id flags:  

The output was:
0
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 8/25/2021 3:16:20 PM.
Project "C:\Project\tesseract\CMakeFiles\3.21.1\CompilerIdCXX\CompilerIdCXX.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
  Creating directory "Debug\CompilerIdCXX.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdCXX.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc142.pdb" /external:W0 /Gd /TP /FC /errorReport:queue CMakeCXXCompilerId.cpp
  CMakeCXXCompilerId.cpp
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdCXX.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdCXX.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdCXX.lib" /MACHINE:X64 Debug\CMakeCXXCompilerId.obj
  CompilerIdCXX.vcxproj -> C:\Project\tesseract\CMakeFiles\3.21.1\CompilerIdCXX\CompilerIdCXX.exe
PostBuildEvent:
  for %%i in (cl.exe) do @echo CMAKE_CXX_COMPILER=%%~$PATH:i
  :VCEnd
  CMAKE_CXX_COMPILER=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
FinalizeBuildStatus:
  Deleting file "Debug\CompilerIdCXX.tlog\unsuccessfulbuild".
  Touching "Debug\CompilerIdCXX.tlog\CompilerIdCXX.lastbuildstate".
Done Building Project "C:\Project\tesseract\CMakeFiles\3.21.1\CompilerIdCXX\CompilerIdCXX.vcxproj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.46


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CompilerIdCXX.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CompilerIdCXX.vcxproj"

The CXX compiler identification is MSVC, found in "C:/Project/tesseract/CMakeFiles/3.21.1/CompilerIdCXX/CompilerIdCXX.exe"

Detecting C compiler ABI info compiled with the following output:
Change Dir: C:/Project/tesseract/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/MSBuild/Current/Bin/MSBuild.exe cmTC_d3962.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.



  Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x64

  Copyright (C) Microsoft Corporation.  All rights reserved.

  CMakeCCompilerABI.c

  cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_d3962.dir\Debug\\" /Fd"cmTC_d3962.dir\Debug\vc142.pdb" /external:W3 /Gd /TC /errorReport:queue "C:\Program Files\CMake\share\cmake-3.21\Modules\CMakeCCompilerABI.c"

  cmTC_d3962.vcxproj -> C:\Project\tesseract\CMakeFiles\CMakeTmp\Debug\cmTC_d3962.exe




Detecting CXX compiler ABI info compiled with the following output:
Change Dir: C:/Project/tesseract/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/MSBuild/Current/Bin/MSBuild.exe cmTC_1b324.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.



  Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x64

  Copyright (C) Microsoft Corporation.  All rights reserved.

  CMakeCXXCompilerABI.cpp

  cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_1b324.dir\Debug\\" /Fd"cmTC_1b324.dir\Debug\vc142.pdb" /external:W3 /Gd /TP /errorReport:queue "C:\Program Files\CMake\share\cmake-3.21\Modules\CMakeCXXCompilerABI.cpp"

  cmTC_1b324.vcxproj -> C:\Project\tesseract\CMakeFiles\CMakeTmp\Debug\cmTC_1b324.exe

I suppose the error has to do with just the ABI compiler(s) (so C:\Project\tesseract\CMakeFiles\3.21.1\CMakeDetermineCompilerABI_CXX.bin or C:\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!

@zdenop
Copy link
Contributor

zdenop commented Aug 26, 2021

There is missing command before running cmake:
mkdir build.msvs && cd build.msvs

@zdenop zdenop mentioned this issue Aug 26, 2021
@zdenop
Copy link
Contributor

zdenop commented Aug 26, 2021

@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.

@parulsingh23
Copy link
Author

parulsingh23 commented Aug 26, 2021

@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?

@zdenop
Copy link
Contributor

zdenop commented Aug 26, 2021

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.

@parulsingh23
Copy link
Author

parulsingh23 commented Aug 26, 2021

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?

@parulsingh23
Copy link
Author

parulsingh23 commented Aug 27, 2021

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)?

@parulsingh23
Copy link
Author

parulsingh23 commented Aug 27, 2021

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:

  • VSBuild Project: I'm not sure what to do after "Applied user-wide integration for this vcpkg root". I thought this meant that the Leptonica library would be accessible for any programs running on a VS environment, and nothing would need to be changed. I started from scratch in installation and this didn't work, so I must not be aware of some changes to files/root paths/environment variables that I have to do.
  • CMake: I thought I would simply add -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.

@zdenop
Copy link
Contributor

zdenop commented Aug 27, 2021

  1. Do not mix different build systems unless you understand what you are doing (e.g. you are able to fix all problems by yourself.
  2. IMO pkg-config should not be need with the leptonica from git. It can be download from https://download.gnome.org/binaries/win32/dependencies (you will also need gettext-runtime_0.18.1.1-2_win32.zip and glib_2.28.8-1_win32.zip - just pust content for bin directory somewhere to your path e.g. c:\win64\bin
  3. leptonica is installed as part of the successful build process.

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.

sirfz added a commit that referenced this issue Sep 14, 2021
@zdenop
Copy link
Contributor

zdenop commented Sep 15, 2021

IMO this should be closed after this change 04c36d8...

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

Successfully merging a pull request may close this issue.

3 participants