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
Tesseract 4 crashes on Windows XP 32 bit #810
Comments
I'm afraid that nobody will care about support for a Windows version which was abandoned by MS three years ago. |
Does Tesseract on Windows 7/8 32 bit work well or crash too? |
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? |
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. |
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:
|
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:
Configure call:
Configure output:
|
@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 |
Edit: Do what stweil suggested. |
Thank you very much! It works fine when AVX is disabled. Looks like a good reason to stop using XP completely. |
Great, thank you for testing. Maybe we can add a test for old Windows versions in |
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. |
Nevertheless, I think what we should do is to add an option to disable all the simd compile-time & runtime checking. |
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. |
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. |
I don't think so.
Let us know :) |
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 EDIT: for the records, AVX is also not supported on Vista and 7 RTM |
Do you know what could be causing this behaviour for install on windows 10? Thanks!
|
I think you posted in the wrong thread.. |
But he reached the right person. :-) |
Windows XP is not supported in 4.00. @zdenop, please close this issue. |
Again, this is not about windows XP. |
The title of this issue is:
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. |
The title is a thing, the actual issue is another I don't have any of the "possibly buggable" sw/hw combos, so I'm unfortunately sorry I cannot help further. |
does tesseract4.0 can be install using 32bit win10 ?? |
Yes. |
This comment has been minimized.
This comment has been minimized.
hello,can the tesseract support XP after,in tesseract 4.1 has this problem. |
It is possible to run Tesseract on XP, but you have to disable AVX. |
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 |
There is no need to modify the code. Just add |
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. |
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!!! |
I disable AVX and SSE also wrong,There are other places that may cause this error? |
Please try pull request #2620 which checks whether Windows supports AVX. |
hello,I have try #2620,but still failed. |
Could you please give more details on the failure which you see? |
I can't find other details.But I use tesseract-3.05 in XP is OK.I‘m using tesseract-3.05 now. |
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.
The text was updated successfully, but these errors were encountered: