简体   繁体   中英

windows mingw32-make "no such file" error when installing opencv

I've been trying to build OpenCV-4.5.1 from source with CMake 3.22.0-rc1. When execute "mingw32-make", this problem below showed up. I guess something went wrong with the CMakeList but I'm not sure. I found that there's no such file named "thread.c.obj", so I tried to compile thread.c with gcc, but some reference errors occured (I'll post screenshots or copy/paste the errors in the comment zone if needed)

this is the description of the error:

D:\Code\opencv\sources\build>mingw32-make
[  0%] Built target opencv_highgui_plugins
[  0%] Building C object 3rdparty/openjpeg/openjp2/CMakeFiles/libopenjp2.dir/thread.c.obj
process_begin: CreateProcess(C:\Users\12271\AppData\Local\Temp\make6172-1.bat, C:\Users\12271\AppData\Local\Temp\make6172-1.bat, ...) failed.
make (e=2): 系统找不到指定的文件。//which means there's no such file
mingw32-make[2]: *** [3rdparty\openjpeg\openjp2\CMakeFiles\libopenjp2.dir\build.make:76: 3rdparty/openjpeg/openjp2/CMakeFiles/libopenjp2.dir/thread.c.obj] Error 2
mingw32-make[1]: *** [CMakeFiles\Makefile2:1650: 3rdparty/openjpeg/openjp2/CMakeFiles/libopenjp2.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2

It's my first time to ask question in this forum, and I'm not familiar with the question format, if there is something inappropriate please tell me. Thanks!

The error you het is from mingw32-make trying to run .bat files, which can't be be run by CreateProcess (which is internally used to execute programs), as it requires something like CMD /C to run.

You could try using CMake flag -GNinja in combination with Ninja as build tool. This is also a lot faster.

Another solution would be to have all the third party prerequisites available when building, so CMake doesn't have to build everything from the 3rdparty folder.

Or you could switch from Command Prompt to MSYS2 shell. As it behaves very much like a Linux/Unix prompt chances are much better libraries will build right away (as this completely avoids calling .bat files).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM