tesseract-ocr / tesseract

Tesseract Open Source OCR Engine (main repository)
https://tesseract-ocr.github.io/
Apache License 2.0
61.79k stars 9.46k forks source link

Tesseract 4 crashes on Windows XP 32 bit #810

Closed ghost closed 6 years ago

ghost commented 7 years ago

Hello!

Latest Tesseract version built from GIT with mingw-w64-i686 toolchain (gcc/g++ 6.2.0) crashes when run on Windows XP 32 bit (confirmed both for SP2 and SP3 OS versions). It crashes after several seconds of image processing and shows standard Windows dialog with this error text: "Exception unknow software exception (0xc000001d) in application at address 0x655b25f0".

On Windows 7 and 8 (x64) same images are recognized fine without any issues.

stweil commented 7 years ago

I'm afraid that nobody will care about support for a Windows version which was abandoned by MS three years ago.

amitdo commented 7 years ago

Does Tesseract on Windows 7/8 32 bit work well or crash too?

Shreeshrii commented 7 years ago

Tesseract version built from GIT with mingw-w64-i686 toolchain (gcc/g++ 6.2.0)

Does it have to be built with special flags for win32?

stweil commented 7 years ago

There is currently not enough information for this issue report: As far as I know, 0xc000001d means illegal instruction. So the program is running machine code which is not defined for that machine. This could be caused by a program bug, or code and hardware simply don't fit.

What about running Tesseract under control of a debugger like gdb for Windows? Then the debugger would show the illegal instruction.

stweil commented 7 years ago

Does it have to be built with special flags for win32?

No, no special flags are needed for win32. My 32 and 64 bit builds for Windows only differ in the prefix for build tools and installation:

./configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32 && make
./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32 && make
ghost commented 7 years ago

Thank you all for respose! I'm well aware of the fact that XP is quite outdated OS, but some people still prefere to use it despite troubles with outdated drivers etc. If it would take too much effort to fix it then it probably doesn't worth it. But if there is a chance of fixing it without going too deep in debug process then it would be great.

Now in order of questions:

1) It works just fine on Windows 7 32 bit, no crashes at all. On the very same PC it crashes constanly under XP 32 bit.

2) 1st crash machine: Intel Core i3-2120 3.30GHz. 2nd crash machine: Intel Core i5 3570 3.4 GHz (OS run under VirtualBox Version 5.1.18 r 114002(Qt5.6.2)).

3) tesseract -v:

tesseract 4.00.00alpha leptonica-1.74.1 libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.1) : libpng 1.6.26 : libtiff 4.0.6 : zlib 1.2.8 : libwebp 0.6.0

Found AVX Found SSE

4) Build is done under Windows 8 64 bit using latest MSYS2 (https://sourceforge.net/projects/msys2/) distributive, updated with "pacman -Syuu" to get latest leptonica version.

Configure call:

sh configure MAKE=mingw32-make --prefix=C:/atlas-sdk/msys32/mingw32 --disable-graphics --enable-static=no --enable-debug

Configure output:

configure: loading site script C:/atlas-sdk/msys32/mingw32/etc/config.site checking for g++... g++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether mingw32-make sets $(MAKE)... yes checking for style of include used by mingw32-make... GNU checking whether mingw32-make supports nested variables... yes checking dependency style of g++... gcc3 checking whether to enable maintainer-specific portions of Makefiles... no checking build system type... i686-w64-mingw32 checking host system type... i686-w64-mingw32 checking whether C++ compiler accepts -mavx... yes checking whether C++ compiler accepts -msse4.1... yes checking --enable-graphics argument... no checking --enable-embedded argument... no checking for g++ option to support OpenMP... -fopenmp checking --enable-opencl argument... no checking how to run the C++ preprocessor... g++ -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking CL/cl.h usability... no checking CL/cl.h presence... no checking for CL/cl.h... no checking OpenCL/cl.h usability... no checking OpenCL/cl.h presence... no checking for OpenCL/cl.h... no checking tiffio.h usability... yes checking tiffio.h presence... yes checking for tiffio.h... yes checking for clGetPlatformIDs in -lOpenCL... no checking --enable-visibility argument... no checking --enable-multiple-libraries argument... no checking whether to use tessdata-prefix... yes checking whether to enable debugging... yes checking how to print strings... printf checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking for a sed that does not truncate output... /usr/bin/sed checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... C:/atlas-sdk/msys32/mingw32/i686-w64-mingw32/bin/ld.exe checking if the linker (C:/atlas-sdk/msys32/mingw32/i686-w64-mingw32/bin/ld.exe) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /mingw32/i686-w64-mingw32/bin/nm -B checking the name lister (/mingw32/i686-w64-mingw32/bin/nm -B) interface... BSD nm checking whether ln -s works... no, using cp -pR checking the maximum length of command line arguments... 8192 checking how to convert i686-w64-mingw32 file names to i686-w64-mingw32 format... func_convert_file_msys_to_w32 checking how to convert i686-w64-mingw32 file names to toolchain format... func_convert_file_msys_to_w32 checking for C:/atlas-sdk/msys32/mingw32/i686-w64-mingw32/bin/ld.exe option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL checking for dlltool... dlltool checking how to associate runtime and link libraries... func_cygming_dll_for_implib checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /mingw32/i686-w64-mingw32/bin/nm -B output from gcc object... ok checking for sysroot... no checking for a working dd... /usr/bin/dd checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 checking for mt... no checking if : is a manifest tool... no checking for dlfcn.h... no checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (C:/atlas-sdk/msys32/mingw32/i686-w64-mingw32/bin/ld.exe) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... Win32 ld.exe checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... C:/atlas-sdk/msys32/mingw32/i686-w64-mingw32/bin/ld.exe checking if the linker (C:/atlas-sdk/msys32/mingw32/i686-w64-mingw32/bin/ld.exe) is GNU ld... yes checking whether the g++ linker (C:/atlas-sdk/msys32/mingw32/i686-w64-mingw32/bin/ld.exe) supports shared libraries... yes checking for g++ option to produce PIC... -DDLL_EXPORT -DPIC checking if g++ PIC flag -DDLL_EXPORT -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (C:/atlas-sdk/msys32/mingw32/i686-w64-mingw32/bin/ld.exe) supports shared libraries... yes checking dynamic linker characteristics... Win32 ld.exe checking how to hardcode library paths into programs... immediate checking whether byte ordering is bigendian... no checking if compiling with clang... no checking whether compiler supports C++11... yes checking for snprintf... yes checking for library containing sem_init... none required checking for ANSI C header files... (cached) yes checking whether time.h and sys/time.h may both be included... yes checking for sys/wait.h that is POSIX.1 compatible... no checking sys/ipc.h usability... no checking sys/ipc.h presence... no checking for sys/ipc.h... no checking sys/shm.h usability... no checking sys/shm.h presence... no checking for sys/shm.h... no checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking for stdbool.h that conforms to C99... no checking for _Bool... no checking whether #! works in shell scripts... yes checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking for getline... no checking for wchar_t... yes checking for long long int... yes checking for off_t... yes checking for mbstate_t... yes checking for pkg-config... /mingw32/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for lept >= 1.74... yes checking for icu-uc... yes checking for icu-i18n... yes checking for pango... yes checking for cairo... yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating tesseract.pc config.status: creating api/Makefile config.status: creating arch/Makefile config.status: creating ccmain/Makefile config.status: creating opencl/Makefile config.status: creating ccstruct/Makefile config.status: creating ccutil/Makefile config.status: creating classify/Makefile config.status: creating cutil/Makefile config.status: creating dict/Makefile config.status: creating lstm/Makefile config.status: creating textord/Makefile config.status: creating viewer/Makefile config.status: creating wordrec/Makefile config.status: creating tessdata/Makefile config.status: creating tessdata/configs/Makefile config.status: creating tessdata/tessconfigs/Makefile config.status: creating testing/Makefile config.status: creating java/Makefile config.status: creating java/com/Makefile config.status: creating java/com/google/Makefile config.status: creating java/com/google/scrollview/Makefile config.status: creating java/com/google/scrollview/events/Makefile config.status: creating java/com/google/scrollview/ui/Makefile config.status: creating doc/Makefile config.status: creating training/Makefile config.status: creating config_auto.h config.status: executing depfiles commands config.status: executing libtool commands

Configuration is done. You can now build and install tesseract by running:

$ make $ sudo make install

Training tools can be build and installed (after building of tesseract) with:

$ make training $ sudo make training-install

5) Running with gdb:

gdb --args ./tesseract image14281.jpg image14281 -l rus GNU gdb (GDB) 7.12.1 Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-w64-mingw32". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Traceback (most recent call last): File "", line 3, in ImportError: No module named libstdcxx.v6.printers c:\atlas-sdk\msys32\mingw32\bin../etc/gdbinit:5: Error in sourced command file:

Error while executing Python code. Reading symbols from ./tesseract...done. (gdb) run Starting program: C:\atlas-sdk\msys32\mingw32\bin\tesseract.exe image14281.jpg i mage14281 -l rus [New Thread 316.0x79c] Tesseract Open Source OCR Engine v4.00.00alpha with Leptonica Detected 24 diacritics [New Thread 316.0x3e4] [New Thread 316.0x2e8] [New Thread 316.0x69c]

Thread 2 received signal SIGILL, Illegal instruction. [Switching to Thread 316.0x3e4] tesseract::DotProductAVX (u=0xcc0010, v=0x469f5f8, n=25) at dotproductavx.cpp:70 70 dotproductavx.cpp: No such file or directory. (gdb) continue Continuing.

Thread 2 received signal SIGILL, Illegal instruction. tesseract::DotProductAVX (u=0xcc0010, v=0x469f5f8, n=25) at dotproductavx.cpp:70 70 in dotproductavx.cpp (gdb) continue Continuing. [Thread 316.0x3e4 exited with code 3221225501] [Thread 316.0x2e8 exited with code 3221225501] [Inferior 1 (process 316) exited with code 030000000035] (gdb) continue The program is not being run. (gdb)

stweil commented 7 years ago

@paukonen, you are using a relatively new computer (with AVX and SSE support) on an old operating system (Windows XP). A quick search gives lots of hints that AVX does not work with XP. Tesseract will detect AVX support of the CPU and use it, because it does not test whether you are using an old operating system. So I expect that is the reason of the crash which you observe.

You can test that hypothesis by building a new Tesseract with AVX disabled: simply remove all lines which set avx_available_ in file arch/simddetect.cpp. The resulting Tesseract should work on any Windows version. If is does not, disable SSE support as well.

amitdo commented 7 years ago

You can simply remove all lines which set avxavailable in file arch/simddetect.cpp. or remoce/comment this code in configure.ac

or remove/comment this code in configure.ac:

AX_CHECK_COMPILE_FLAG([-mavx], [avx=true], [avx=false])
if $avx; then
    AM_CONDITIONAL([AVX_OPT], true)
fi

Edit: Do what stweil suggested.

ghost commented 7 years ago

Thank you very much!

It works fine when AVX is disabled. Looks like a good reason to stop using XP completely.

stweil commented 7 years ago

Great, thank you for testing. Maybe we can add a test for old Windows versions in arch/simddetect.cpp to handle this automatically.

amitdo commented 7 years ago

I don't think we should add any code to support OSes that are >10 years old and even not supported by their vendors anymore.

amitdo commented 7 years ago

Nevertheless, I think what we should do is to add an option to disable all the simd compile-time & runtime checking.

ghost commented 7 years ago

In any case, I applied attached patch to my working copy.

tesseract-20170412-disable-avx-for-win-xp.txt

It automatically disables AVX for XP and older OSes. Maybe it would come in handy to someone.

nguyenq commented 7 years ago

It seems the current 4.00alpha version would also crash in Windows 10 running on an old i7 CPU, which probably does not have AVX or SSE support. The patch may fix that. I may try it out when I get a chance.

amitdo commented 7 years ago

It seems the current 4.00alpha version would crash in Windows 10 running on an old i7 CPU also.

I don't think so.

I may try it out when I get a chance.

Let us know :)

mirh commented 7 years ago

Great, thank you for testing. Maybe we can add a test for old Windows versions in arch/simddetect.cpp to handle this automatically.

This is also going to come handy for whenever tesseract will make use of AVX-512 (which brings in another new architectural state), which is only going to be supported on W10 (not sure if already, or in a future version - in the latter case that would be another point for this check)

EDIT: for the records, AVX is also not supported on Vista and 7 RTM EDIT2: some possible code snippets EDIT3: also

Shreeshrii commented 7 years ago

@stweil

Please see https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/tesseract-ocr/P-4AqnnGpgc/fMbEr1o9BAAJ

Do you know what could be causing this behaviour for install on windows 10? Thanks!

Thank you for the reply. I went to https://github.com/UB-Mannheim/tesseract/wiki, download tesseract-ocr-setup.exe file but when i click on it, it send me to the get apps from the store app. I don't know why it did not install and why it sent me to app store for since I already got the tesseract-ocr-setup.exe. Regards, Tom

mirh commented 7 years ago

I think you posted in the wrong thread..

stweil commented 7 years ago

But he reached the right person. :-)

amitdo commented 6 years ago

Windows XP is not supported in 4.00.

@zdenop, please close this issue.

mirh commented 6 years ago

Again, this is not about windows XP. This is about tesseract only checking extensions at hardware level.

amitdo commented 6 years ago

Again, this is not about windows XP.

The title of this issue is:

Tesseract 4 crashes on Windows XP 32 bit

for the records, AVX is also not supported on Vista and 7 RTM

https://support.microsoft.com/en-us/help/22882/windows-vista-end-of-support

If you know that there is an issue in Tesseract + SIMD with Windows 8.1/10 or other OSes that are still supported by their vendors, open a new issue.

mirh commented 6 years ago

The title is a thing, the actual issue is another And EOL or not, not-checking also OS for what it will let you use seems wrong. (in fact, again, this will certainly make for problems with AVX-512 cpus)

I don't have any of the "possibly buggable" sw/hw combos, so I'm unfortunately sorry I cannot help further.

AbdelsalamHaa commented 6 years ago

does tesseract4.0 can be install using 32bit win10 ??

stweil commented 6 years ago

Yes.

AbdelsalamHaa commented 6 years ago

@stweil thanks a lot for replying . i have another issue i hope u can help me with. ,I have built tesseract4.0 using vs 2017 with leptonica 1.75.3 . it workred very well . i want to include tesseract4.0 into other project but that project has a lot of library which was built in vs 2013 . Im trying to use vs 2013 to build tesseract 4.0 to match with my project . unfortunately i couldn't due to exist of constexper(not supported in vs 2013) in publictry.h file in tesseract 4.0 . so im asking is there any way to build tesseract 4.0 using vs 2013. there's might be some other reasons but so far this is the most clear error to me

zxcv8553172 commented 5 years ago

hello,can the tesseract support XP after,in tesseract 4.1 has this problem.

stweil commented 5 years ago

It is possible to run Tesseract on XP, but you have to disable AVX.

zxcv8553172 commented 5 years ago

I have tried to modify it, but this is a failed attempt. Can you help me change it? Here is my modification.

///////////////////////////////////////////////////////////////////////
// File:        simddetect.cpp
// Description: Architecture detector.
// Author:      Stefan Weil (based on code from Ray Smith)
//
// (C) Copyright 2014, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////

#include            // for std::inner_product
#include "simddetect.h"
#include "dotproduct.h"
#include "dotproductavx.h"
#include "dotproductsse.h"
#include "intsimdmatrix.h"   // for IntSimdMatrix
#include "params.h"   // for STRING_VAR
#include "tprintf.h"  // for tprintf
#include "windows.h"

#if defined(AVX) || defined(AVX2) || defined(SSE4_1)
# define HAS_CPUID
#endif

#if defined(HAS_CPUID)
#if defined(__GNUC__)
# include 
#elif defined(_WIN32)
# include 
#endif
#endif

namespace tesseract {

// Computes and returns the dot product of the two n-vectors u and v.
// Note: because the order of addition is different among the different dot
// product functions, the results can (and do) vary slightly (although they
// agree to within about 4e-15). This produces different results when running
// training, despite all random inputs being precisely equal.
// To get consistent results, use just one of these dot product functions.
// On a test multi-layer network, serial is 57% slower than SSE, and AVX
// is about 8% faster than SSE. This suggests that the time is memory
// bandwidth constrained and could benefit from holding the reused vector
// in AVX registers.
DotProductFunction DotProduct;

static STRING_VAR(dotproduct, "auto",
                  "Function used for calculation of dot product");

SIMDDetect SIMDDetect::detector;

// If true, then AVX has been detected.
bool SIMDDetect::avx_available_;
bool SIMDDetect::avx2_available_;
bool SIMDDetect::avx512F_available_;
bool SIMDDetect::avx512BW_available_;
// If true, then SSe4.1 has been detected.
bool SIMDDetect::sse_available_;

// Computes and returns the dot product of the two n-vectors u and v.
static double DotProductGeneric(const double* u, const double* v, int n) {
  double total = 0.0;
  for (int k = 0; k < n; ++k) total += u[k] * v[k];
  return total;
}

// Compute dot product using std::inner_product.
static double DotProductStdInnerProduct(const double* u, const double* v, int n) {
  return std::inner_product(u, u + n, v, 0.0);
}

static void SetDotProduct(DotProductFunction f, const IntSimdMatrix* m = nullptr) {
    OSVERSIONINFO osvi;
    ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    GetVersionEx(&osvi);
    if (osvi.dwMajorVersion > 5) {
        DotProduct = f;
        IntSimdMatrix::intSimdMatrix = m;
    }
}

// Constructor.
// Tests the architecture in a system-dependent way to detect AVX, SSE and
// any other available SIMD equipment.
// __GNUC__ is also defined by compilers that include GNU extensions such as
// clang.
SIMDDetect::SIMDDetect() {
  // The fallback is a generic dot product calculation.

#if defined(HAS_CPUID)
#if defined(__GNUC__)
  unsigned int eax, ebx, ecx, edx;
  if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) != 0) {
    // Note that these tests all use hex because the older compilers don't have
    // the newer flags.
#if defined(SSE4_1)
    sse_available_ = (ecx & 0x00080000) != 0;
#endif
#if defined(_WIN32)
    OSVERSIONINFO osvi;
    ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    GetVersionEx(&osvi);
    if (osvi.dwMajorVersion > 5)
        SetDotProduct(DotProductGeneric);
        avx_available_ = (ecx & 0x10000000) != 0;
    else
        avx_available_ = false;  
#else
    SetDotProduct(DotProductGeneric);
    avx_available_ = (ecx & 0x10000000) != 0;
    if (avx_available_) {
      // There is supposed to be a __get_cpuid_count function, but this is all
      // there is in my cpuid.h. It is a macro for an asm statement and cannot
      // be used inside an if.
      __cpuid_count(7, 0, eax, ebx, ecx, edx);
      avx2_available_ = (ebx & 0x00000020) != 0;
      avx512F_available_ = (ebx & 0x00010000) != 0;
      avx512BW_available_ = (ebx & 0x40000000) != 0;
    }
#endif
  }
#  elif defined(_WIN32)
  int cpuInfo[4];
  int max_function_id;
  __cpuid(cpuInfo, 0);
  max_function_id = cpuInfo[0];
  if (max_function_id >= 1) {
    __cpuid(cpuInfo, 1);
#if defined(SSE4_1)
    sse_available_ = (cpuInfo[2] & 0x00080000) != 0;
#endif
#if defined(AVX)
    //avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
    OSVERSIONINFO osvi;
    ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    GetVersionEx(&osvi);
    if (osvi.dwMajorVersion > 5)
        avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
    else
        avx_available_ = false;
#endif
#if defined(AVX2)
    if (max_function_id >= 7) {
      __cpuid(cpuInfo, 7);
      avx2_available_ = (cpuInfo[1] & 0x00000020) != 0;
      avx512F_available_ = (cpuInfo[1] & 0x00010000) != 0;
      avx512BW_available_ = (cpuInfo[1] & 0x40000000) != 0;
    }
#endif
  }
#else
#error "I don't know how to test for SIMD with this compiler"
#endif
#endif

  // Select code for calculation of dot product based on autodetection.
  if (false) {
    // This is a dummy to support conditional compilation.
#if defined(AVX2)
  } else if (avx2_available_) {
    // AVX2 detected.
    SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixAVX2);
#endif
#if defined(AVX)
  } else if (avx_available_) {
    // AVX detected.
    SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixSSE);
#endif
#if defined(SSE4_1)
  } else if (sse_available_) {
    // SSE detected.
    SetDotProduct(DotProductSSE, &IntSimdMatrix::intSimdMatrixSSE);
#endif
  }
}

void SIMDDetect::Update() {
  // Select code for calculation of dot product based on the
  // value of the config variable if that value is not empty.
  const char* dotproduct_method = "generic";
  if (!strcmp(dotproduct.string(), "auto")) {
    // Automatic detection. Nothing to be done.
  } else if (!strcmp(dotproduct.string(), "generic")) {
    // Generic code selected by config variable.
    SetDotProduct(DotProductGeneric);
    dotproduct_method = "generic";
  } else if (!strcmp(dotproduct.string(), "native")) {
    // Native optimized code selected by config variable.
    SetDotProduct(DotProductNative);
    dotproduct_method = "native";
#if defined(AVX2)
  } else if (!strcmp(dotproduct.string(), "avx2")) {
    // AVX2 selected by config variable.
    SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixAVX2);
    dotproduct_method = "avx2";
#endif
#if defined(AVX)
  } else if (!strcmp(dotproduct.string(), "avx")) {
    // AVX selected by config variable.
    SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixSSE);
    dotproduct_method = "avx";
#endif
#if defined(SSE4_1)
  } else if (!strcmp(dotproduct.string(), "sse")) {
    // SSE selected by config variable.
    SetDotProduct(DotProductSSE, &IntSimdMatrix::intSimdMatrixSSE);
    dotproduct_method = "sse";
#endif
  } else if (!strcmp(dotproduct.string(), "std::inner_product")) {
    // std::inner_product selected by config variable.
    SetDotProduct(DotProductStdInnerProduct);
    dotproduct_method = "std::inner_product";
  } else {
    // Unsupported value of config variable.
    tprintf("Warning, ignoring unsupported config variable value: dotproduct=%s\n",
            dotproduct.string());
    tprintf("Support values for dotproduct: auto generic native"
#if defined(AVX)
            " avx"
#endif
#if defined(SSE4_1)
            " sse"
#endif
            " std::inner_product.\n");
  }

  dotproduct.set_value(dotproduct_method);
}

}  // namespace tesseract
stweil commented 5 years ago

There is no need to modify the code. Just add -c dotproduct=native to the command line. You can also try -c dotproduct=sse, maybe it works, too.

zxcv8553172 commented 5 years ago

Do as this?ConsoleApplication1 is my exe which called tesseract dll, I do it on cmd.exe that: ConsoleApplication1 -c dotproduct=native ,but it wrong also.

zxcv8553172 commented 5 years ago

Still setting the command line in vs,my vs is vs2015.Still Where is it written?Can be detailed?My code level is relatively low.Thank you!!!

zxcv8553172 commented 5 years ago

I disable AVX and SSE also wrong,There are other places that may cause this error?

stweil commented 5 years ago

Please try pull request #2620 which checks whether Windows supports AVX.

zxcv8553172 commented 5 years ago

hello,I have try #2620,but still failed. I compared the code to debug in WIN10.In src\ccutil\params.cpp -- tesseract::ParamsVectors *GlobalParams() end to the next step src\classify\intproto.cpp -- static double_VAR(classify_cp_angle_pad_loose, 45.0, "Class Pruner Angle Pad Loose"); This error occurred in XP but it is normal in WIN10 .Do you know why?

stweil commented 5 years ago

Could you please give more details on the failure which you see?

zxcv8553172 commented 5 years ago

I can't find other details.But I use tesseract-3.05 in XP is OK.I‘m using tesseract-3.05 now.