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

Fix for #8105 (compiling with mingw32) #8123

Merged
merged 1 commit into from
Feb 6, 2017

Conversation

msk-repo01
Copy link
Contributor

This pull request fixes #8105

It fixes error for compiling with mingw32
In google/googletest#721 similar issue was fixed for MinGW

fix for opencv#8105, compilation issue with mingw32 (in
google/googletest#721 a similar issue was solved and the reason was
described as MinGW defines _CRITICAL_SECTION and _RTL_CRITICAL_SECTION
as two separate (equivalent) structs, instead of using typedef)
@alalek
Copy link
Member

alalek commented Feb 4, 2017

👍

@opencv-pushbot opencv-pushbot merged commit 9a1835c into opencv:master Feb 6, 2017
opencv-pushbot pushed a commit that referenced this pull request Feb 6, 2017
@AdeelH
Copy link
Contributor

AdeelH commented Feb 9, 2017

It seems like the issue has not been entirely fixed. I'm getting the following error when compiling on Windows 10. Any ideas?

[ 45%] Building CXX object modules/ts/CMakeFiles/opencv_ts.dir/src/ts_gtest.cpp.obj
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp: In constructor 'testing::internal::Mutex::Mutex()':
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8829:45: error: cannot convert 'CRITICAL_SECTION* {aka _RTL_CRITICAL_SECTION*}' to 'GTEST_CRITICAL_SECTION* {aka CRITICAL_SECTION*}' in initialization
critical_section
(new CRITICAL_SECTION) {
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8830:48: error: cannot convert 'GTEST_CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to 'LPCRITICAL_SECTION {aka RTL_CRITICAL_SECTION*}' for argument '1' to 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
::InitializeCriticalSection(critical_section
);
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp: In destructor 'testing::internal::Mutex::~Mutex()':
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8840:46: error: cannot convert 'GTEST_CRITICAL_SECTION* {aka CRITICAL_SECTION*}' to 'LPCRITICAL_SECTION {aka RTL_CRITICAL_SECTION*}' for argument '1' to 'void DeleteCriticalSection(LPCRITICAL_SECTION)'
::DeleteCriticalSection(critical_section
);
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8841:12: warning: possible problem detected in invocation of delete operator: [enabled by default]
delete critical_section
;
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8841:12: warning: invalid use of incomplete type 'struct _CRITICAL_SECTION' [enabled by default]
In file included from D:/opencv/source/opencv/modules/ts/include/opencv2/ts.hpp:28:0,
from D:\opencv\source\opencv\modules\ts\src\precomp.hpp:3,
from D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:39:
D:/opencv/source/opencv/modules/ts/include/opencv2/ts/ts_gtest.h:726:19: warning: forward declaration of 'struct _CRITICAL_SECTION' [enabled by default]
typedef struct CRITICAL_SECTION GTEST_CRITICAL_SECTION;
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8841:12: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
delete critical_section
;
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::Lock()':
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8848:43: error: cannot convert 'GTEST_CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to 'LPCRITICAL_SECTION {aka RTL_CRITICAL_SECTION*}' for argument '1' to 'void EnterCriticalSection(LPCRITICAL_SECTION)'
::EnterCriticalSection(critical_section
);
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::Unlock()':
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8858:43: error: cannot convert 'GTEST_CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to 'LPCRITICAL_SECTION {aka RTL_CRITICAL_SECTION*}' for argument '1' to 'void LeaveCriticalSection(LPCRITICAL_SECTION)'
::LeaveCriticalSection(critical_section
);
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::ThreadSafeLazyInit()':
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8879:27: error: cannot convert 'CRITICAL_SECTION* {aka _RTL_CRITICAL_SECTION*}' to 'GTEST_CRITICAL_SECTION* {aka CRITICAL_SECTION*}' in assignment
critical_section
= new CRITICAL_SECTION;
^
D:\opencv\source\opencv\modules\ts\src\ts_gtest.cpp:8880:54: error: cannot convert 'GTEST_CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to 'LPCRITICAL_SECTION {aka RTL_CRITICAL_SECTION*}' for argument '1' to 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
::InitializeCriticalSection(critical_section
);
^
modules\ts\CMakeFiles\opencv_ts.dir\build.make:237: recipe for target 'modules/ts/CMakeFiles/opencv_ts.dir/src/ts_gtest.cpp.obj' failed
mingw32-make[2]: *** [modules/ts/CMakeFiles/opencv_ts.dir/src/ts_gtest.cpp.obj] Error 1
CMakeFiles\Makefile2:9401: recipe for target 'modules/ts/CMakeFiles/opencv_ts.dir/all' failed
mingw32-make[1]: *** [modules/ts/CMakeFiles/opencv_ts.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

@alalek
Copy link
Member

alalek commented Feb 9, 2017

@AdeelH Could you check this patch from Google tests upstream and create PR into OpenCV?

Copy link

@Linukl Linukl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KC

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 this pull request may close these issues.

Opencv 3.2 Windows compile error
5 participants