Error while compiling OpenCV Pre-Release 4.0.0 with CMAKE

asked 2018-09-06 09:08:51 -0600

 [ 86%] Built target opencv_calib3d_pch_dephelp
[ 86%] Built target pch_Generate_opencv_calib3d                                                                         [ 88%] Built target opencv_calib3d
[ 88%] Built target opencv_perf_calib3d_pch_dephelp                                                                     [ 88%] Built target pch_Generate_opencv_perf_calib3d
[ 89%] Built target opencv_perf_calib3d
[ 90%] Built target pch_Generate_opencv_test_calib3d                                                                    [ 92%] Built target opencv_test_calib3d
[ 92%] Built target opencv_stitching_pch_dephelp
[ 92%] Built target pch_Generate_opencv_stitching
[ 93%] Built target opencv_stitching
[ 93%] Built target opencv_test_stitching_pch_dephelp
[ 93%] Built target pch_Generate_opencv_test_stitching                                                                  [ 93%] Built target opencv_test_stitching
[ 93%] Built target opencv_perf_stitching_pch_dephelp                                                                   [ 94%] Built target pch_Generate_opencv_perf_stitching
[ 95%] Built target opencv_perf_stitching
[ 95%] Built target opencv_videostab_pch_dephelp                                                                        [ 95%] Built target pch_Generate_opencv_videostab
[ 96%] Built target opencv_videostab                                                                                    [ 96%] Built target opencv_test_videostab_pch_dephelp
[ 96%] Built target pch_Generate_opencv_test_videostab                                                                  [ 97%] Built target opencv_test_videostab
[ 97%] Built target gen_opencv_python_source                                                                            [ 97%] Linking CXX shared module ..\..\lib\python3\cv2.cp35-win32.pyd
collect2.exe: error: ld returned 5 exit status
mingw32-make[2]: *** [modules\python3\CMakeFiles\opencv_python3.dir\build.make:104: lib/python3/cv2.cp35-win32.pyd] Error 1                                                                                                                     mingw32-make[2]: *** Deleting file 'lib/python3/cv2.cp35-win32.pyd'
mingw32-make[1]: *** [CMakeFiles\Makefile2:7584: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2
  (py3cv4) D:\Python-Virtual\OpenCV-4\opencv\opencv\build>

This is the error occuring. I'm stuck at 97% and trying to build the python module but it doesn't say anything either about what seems to be failing.

edit retag flag offensive close merge delete

Comments

cv2.cp35-win32 -- you would have to build 32bit opencv libs, to link to a 32 bit python install.

berak gravatar imageberak ( 2018-09-07 02:32:00 -0600 )edit

Oh man just realised. I have a 64 bit python install though, how do I ensure the cmake command builds it with 64 bit instread of 32 bit?

prattch gravatar imageprattch ( 2018-09-07 04:32:20 -0600 )edit

use mingw64.

(and i'm curious, if you can get this to fly. it compiled all fine here, but would crash python, when trying to import it, python3.5, mingw64 7.2, opencv3.4.3)

berak gravatar imageberak ( 2018-09-07 04:45:59 -0600 )edit

hey, I just did! It's the same error except the version of the cv2 file is now cv2.cp35-win_amd64.pyd.

And it actually is OpenCV 4.0.0 pre haha, and mingw64 is 8.1

prattch gravatar imageprattch ( 2018-09-07 10:29:02 -0600 )edit

maybe you could add the python relevant cmake flags to your question ?

berak gravatar imageberak ( 2018-09-07 10:31:56 -0600 )edit

I have all the python related flags properly put In the CMAKE GUI.

https://imgur.com/a/pLF1RMK This is my CMAKE GUI Screenshot. Please let me know if I might be missing something. Thanks a lot!

prattch gravatar imageprattch ( 2018-09-07 10:40:20 -0600 )edit

please, no screenshots(can't be quoted/indexed). and no external bins(will be gone, tomorrow). please.

berak gravatar imageberak ( 2018-09-07 10:46:05 -0600 )edit

Oh okay! Will keep that in mind, I will erase the link as soon as I can. Thought screenshot would be a better idea to show all the flags since there are so many.

prattch gravatar imageprattch ( 2018-09-07 10:51:36 -0600 )edit

Cool thing, so what's the solution? All the CMAKE flags are there, now what should I do?

prattch gravatar imageprattch ( 2018-09-07 10:59:37 -0600 )edit

well oh: python3 library -- this probably expects an .a not the .dll

berak gravatar imageberak ( 2018-09-07 11:14:15 -0600 )edit