opencv fails compile on: system.cpp:832:13 - close(fd) not declared in this scope

asked 2018-03-13 12:50:07 -0600

Hristo gravatar image

System is: windows 10, cygwin

[ 33%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/opencl_kernels_core.cpp.o
[ 33%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/convert.sse4_1.cpp.o
/c/_commonShare/opencv-3.4.1/modules/core/src/system.cpp: In function ‘cv::String cv::tempfile(const char*)’:
/c/_commonShare/opencv-3.4.1/modules/core/src/system.cpp:832:13: error: ‘close’ was not declared in this scope
     close(fd);
             ^
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:1770: modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:1457: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [Makefile:161: all] Error 2

Anyone faced such a problem before?

edit retag flag offensive close merge delete

Comments

" cygwin" -- eww, no real support for that from opencv

g++ --version ?

berak gravatar imageberak ( 2018-03-13 12:56:06 -0600 )edit

@berak g++ (GCC) 6.4.0

So i'm obligate to use MS's proprietary compiler? What is supported well for windows builds using gcc? mingw?

Hristo gravatar imageHristo ( 2018-03-13 13:24:47 -0600 )edit

no, (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 7.2.0) works fine, for me (with a few manual quirks, like adding #define STRSAFE_NO_DEPRECATEhere)

but if you want my 2 ct on it: use mingw, but avoid anything else from cygwin, like their shell.

berak gravatar imageberak ( 2018-03-13 13:31:04 -0600 )edit

6.4.0 might not be a bad version, but again cygwin and mingw-64 seem to have fallen apart some time ago, and my advice would be: use the latter, and ditch the former.

berak gravatar imageberak ( 2018-03-13 13:50:18 -0600 )edit

@berak , got mingw via the cygwin installer, then configured the via cmake-gui. From 36% it went all the way to 90-something%. The error is Error: invalid register for .seh_savexmm, at which point i deem it too-much-voodoo for me. Thanks for the tips, i will keep the mingw - cygwin thing in mind from now on.

Hristo gravatar imageHristo ( 2018-03-13 15:34:07 -0600 )edit

again, if you want my 2ct: ditch cygwin, entirely. (and your mingw is not my mingw)

berak gravatar imageberak ( 2018-03-13 15:38:31 -0600 )edit