Ask Your Question

Revision history [back]

Build Opencv 3.2 fails on Windows 8.1 with VS2013

Building Opencv-3.2.0 failed on my Windows 8.1 VM, using cmake 3.5.2 and visual studio 2013:

First, Visual Studio fails without showing any helpful message, but after digging I found out cmake/cl2cpp.cmake crashes every time. I fixed it by changing this line:

string(REGEX REPLACE "/\\*([^*]/|\\*[^/]|[^*/])*\\*/" ""   lines "${lines}") # multiline comments

to:

string(REGEX REPLACE "/\\*[^\n]*\n" ""   lines "${lines}") # multiline comments
string(REGEX REPLACE "[^\n]+\\*/\n" ""   lines "${lines}") # multiline comments

But ok, that could be a CMake bug. After that, I'm getting the following errors:

7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(554): error C2065: 'SYSTEM_INFO' : undeclared identifier 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(554): error C2146: syntax error : missing ';' before identifier 'sysinfo' 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(554): error C2065: 'sysinfo' : undeclared identifier 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(558): error C2065: 'sysinfo' : undeclared identifier 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(558): error C3861: 'GetSystemInfo': identifier not found 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(561): error C2065: 'sysinfo' : undeclared identifier 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(561): error C2228: left of '.dwNumberOfProcessors' must have class/struct/union 7> type is 'unknown-type'

The code it is referring to in parallel.cpp:

#if defined WIN32 || defined _WIN32
    SYSTEM_INFO sysinfo;

And at the top of that file,

#if defined WIN32 || defined WINCE
    #include <windows.h>

This error is fixed by checking for _WIN32 as well:

#if defined WIN32 || defined _WIN32 || defined WINCE
    #include <windows.h>

I finally got the whole build to succeed after adding || defined _WIN32 to a bunch of cpp files.

My question basically is: am I doing something wrong or is this a bug that should be reported?

Build Opencv 3.2 fails on Windows 8.1 with VS2013

Building Opencv-3.2.0 failed on my Windows 8.1 VM, using cmake 3.5.2 and visual studio 2013:

First, Visual Studio fails without showing any helpful message, but after digging I found out cmake/cl2cpp.cmake crashes every time. I fixed it by changing this line:

string(REGEX REPLACE "/\\*([^*]/|\\*[^/]|[^*/])*\\*/" ""   lines "${lines}") # multiline comments

to:

string(REGEX REPLACE "/\\*[^\n]*\n" ""   lines "${lines}") # multiline comments
string(REGEX REPLACE "[^\n]+\\*/\n" ""   lines "${lines}") # multiline comments

But ok, that could be a CMake bug. After that, I'm getting the following errors:

7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(554): error C2065: 'SYSTEM_INFO' : undeclared identifier 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(554): error C2146: syntax error : missing ';' before identifier 'sysinfo' 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(554): error C2065: 'sysinfo' : undeclared identifier 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(558): error C2065: 'sysinfo' : undeclared identifier 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(558): error C3861: 'GetSystemInfo': identifier not found 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(561): error C2065: 'sysinfo' : undeclared identifier 7>E:\src\Components\opencv\src\opencv\modules\core\src\parallel.cpp(561): error C2228: left of '.dwNumberOfProcessors' must have class/struct/union 7> type is 'unknown-type'

The code it is referring to in parallel.cpp:

#if defined WIN32 || defined _WIN32
    SYSTEM_INFO sysinfo;

And at the top of that file,

#if defined WIN32 || defined WINCE
    #include <windows.h>

This error is fixed by checking for _WIN32 as well:

#if defined WIN32 || defined _WIN32 || defined WINCE
    #include <windows.h>

I finally got the whole build to succeed after adding || defined _WIN32 to a bunch of cpp files.

My question basically is: am I doing something wrong or is this a bug that should be reported?

EDIT: My build command is:

'cmake.exe', '-G', 'Visual Studio 12 Win64',
'-DBUILD_WITH_STATIC_CRT=OFF',
'-DBUILD_SHARED_LIBS=ON',
'-DCMAKE_CXX_FLAGS=/MP',
'-DCMAKE_C_FLAGS=/MP'
'-DWITH_1394=OFF',
'-DWITH_FFMPEG=OFF',
'-DWITH_EIGEN=ON',
'-DWITH_OPENCL=ON',
'-DWITH_CUDA=ON',
'-DWITH_IPP=ON',
'-DWITH_TBB=ON',
'-DWITH_TIFF=ON',
'-DWITH_OPENCL=ON',
'-DBUILD_TBB=OFF',
'-DBUILD_opencv_apps=OFF',
'-DBUILD_DOCS=OFF',
'-DBUILD_PERF_TESTS=OFF',
'-DBUILD_TESTS=OFF',
'-DBUILD_ZLIB=OFF',
'-DENABLE_SSE41=ON',
'-DENABLE_AVX2=OFF',
'-DTBB_INCLUDE_DIR=.../include',
'-DCUDA_TOOLKIT_ROOT_DIR=...',
'-DINSTALL_CREATE_DISTRIB=OFF',
'-DBUILD_opencv_world=OFF'