Move AVX / SSE messages to function PrintVersionInfo (crash fix)

This information is not needed for normal runs, so it is sufficient
to show it on request (like versions and OpenCL information).

This also fixes a crash caused by undefined order of global constructors:

When the global variable SIMDDetect::detector is initialized before the
global variable debug_file, the first tprintf call in simddetect.cpp
crashes because of a NULL pointer in debug_file. This was only seen when
running with a shared library (libtesseract.so).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2016-12-28 13:34:45 +01:00
parent 38033cebb7
commit 534a237015
2 changed files with 5 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "baseapi.h"
#include "basedir.h"
#include "renderer.h"
#include "simddetect.h"
#include "strngs.h"
#include "tprintf.h"
#include "openclwrapper.h"
@ -90,6 +91,10 @@ void PrintVersionInfo() {
}
}
#endif
if (SIMDDetect::IsAVXAvailable())
printf(" Found AVX\n");
if (SIMDDetect::IsSSEAvailable())
printf(" Found SSE\n");
}
void PrintUsage(const char* program) {

View File

@ -60,7 +60,5 @@ SIMDDetect::SIMDDetect() {
avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
}
# endif
if (avx_available_) tprintf("Found AVX\n");
if (sse_available_) tprintf("Found SSE\n");
#endif // X86_BUILD
}