Ask Your Question

aag's profile - activity

2016-01-21 16:28:03 -0600 answered a question Failure to build Python bindings under mingw32

While cmd.exe may work, the need to use Windows scripting may prove a dealbreaker for some, from both portability and sanity perspective.

Luckily, there's an alternative solution I've found: 1) Do not use cmake on mingw/msys. Instead, rely on cmake version installed on Windows host. 2) Use -G "MSYS Makefiles" when invoking cmake

In this configuration things seem to work much better.

2016-01-21 06:00:01 -0600 commented question Windows/mingw installation problem

Looks like the latter can be controlled with PYTHON2_PACKAGES_PATH (still doesn't explain the difference in defaults between the two OSs, though). Still looking at the first one.

2016-01-20 22:53:33 -0600 received badge  Editor (source)
2016-01-20 22:47:24 -0600 asked a question Windows/mingw installation problem

It seems that on Windows (mingw), instead of being installed into $(CMAKE_INSTALL_PREFIX)/lib libraries end up in machine+architecture dependent folder, e.g. if CMAKE_INSTALL_PREFIX is "C:/prj/INSTALL", I see:

-- Installing: C:/prj/INSTALL/i386-w64-mingw32/x86/mingw/lib/libopencv_core310.dll.a
-- Installing: C:/prj/INSTALL/i386-w64-mingw32/x86/mingw/bin/libopencv_core310.dll

Additionally, Python2 module instead of being created in $(CMAKE_INSTALL_PREFIX)/lib/Python2.7/site-packages like happens on, say, OSX, ends up being installed into Python's installation folder:

-- Installing: C:/Python27/Lib/site-packages/cv2.pyd

Is there a way to make both behaviors consistently respecting CMAKE_INSTALL_PREFIX across multiple OSs?

2016-01-19 11:02:19 -0600 commented question Failure to build Python bindings under mingw32

So, if not msys, what would be your shell of choice on Windows, then?

2016-01-19 10:54:13 -0600 commented question Failure to build Python bindings under mingw32

Yes, msys shell is being used. That (or cygwin) is the common way of using mingw on Windows, isn't it?

The problem wouldn't have occurred, if the list of files was passed inline (msys/mingw converts the paths), rather than via file. Or if relative paths were used. Can either of these options be entertained?

2016-01-19 10:27:39 -0600 asked a question Failure to build Python bindings under mingw32

OpenCV 3.0 fails to build with the following error:

   [100%] Generating pyopencv_generated_include.h, pyopencv_generated_funcs.h, pyopencv_generated_types.h, pyopencv_generated_type_reg.h, pyopencv_generated_ns_reg.h
    cd /c/prj/videoLib/.build/MINGW32_NT-10.0-WOW/i386/opencv/modules/python2 && /c/Python27/python.exe /c/prj/videoLib/.build/MINGW32_NT-10.0-WOW/i386/opencv/modules/python/python2/..//src2/gen2.py /c/prj/videoLib/.build/MINGW32_NT-10.0-WOW/i386/opencv/modules/python2 /c/prj/videoLib/.build/MINGW32_NT-10.0-WOW/i386/opencv/modules/python2/headers.txt
    Traceback (most recent call last):
      File "C:/prj/videoLib/.build/MINGW32_NT-10.0-WOW/i386/opencv/modules/python/python2/..//src2/gen2.py", line 940, in <module>
        generator.gen(srcfiles, dstdir)
      File "C:/prj/videoLib/.build/MINGW32_NT-10.0-WOW/i386/opencv/modules/python/python2/..//src2/gen2.py", line 865, in gen
        decls = self.parser.parse(hdr)
      File "C:\prj\videoLib\.build\MINGW32_NT-10.0-WOW\i386\opencv\modules\python\src2\hdr_parser.py", line 746, in parse
        f = io.open(hname, 'rt', encoding='utf-8')
    IOError: [Errno 2] No such file or directory: '/c/prj/videoLib/.build/MINGW32_NT-10.0-WOW/i386/opencv/modules/core/include/opencv2/core.hpp'
    modules/python2/CMakeFiles/opencv_python2.dir/build.make:146: recipe for target 'modules/python2/pyopencv_generated_include.h' failed

The file in question (core.hpp) is present in the location being looked at, but I'd guess the problem is that the paths are provided to Python in mingw, rather than standard Windows form.

Is there a way to build OpenCV under mingw? Seems to work just fine, as long as Python bindings aren't required -- but when those are needed things go downhill fast.

The final config status reported by cmake looks like this

-- General configuration for OpenCV 3.0.0 =====================================
--   Version control:               3.0.0-dirty
--
--   Platform:
--     Host:                        MINGW32_NT-10.0-WOW 2.4.0(0.292/5/3) unknown
--     CMake:                       3.2.3
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make.exe
--     Configuration:               Release
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /mingw32/bin/c++.exe  (ver 5.2.0)
--     C++ flags (Release):         -m32    -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -m32    -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /mingw32/bin/gcc.exe
--     C flags (Release):           -m32    -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -fvisibility=hidden -O2 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -m32    -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      -static-libgcc ...
(more)