opencv - 制作失败 98% Linking CXX shared module ..\..\lib\cv2.pyd
问题描述
我尝试使用 mingw 0.6.2 在代码块(Windows 7)中构建 opencv 3.4.0,但在 98% 时我有五个与 python 相关的错误,我不知道为什么。
这是代码块中的构建日志:
[ 98%] Linking CXX shared module ..\..\lib\cv2.pyd
cd /d C:\OpenCV\pepito\modules\python2 && C:\Users\Rafa\Documents\cmake\cmake-3.10.3-win64-x64\bin\cmake.exe -E cmake_link_script CMakeFiles\opencv_python2.dir\link.txt --verbose=1
C:\Users\Rafa\Documents\cmake\cmake-3.10.3-win64-x64\bin\cmake.exe -E remove -f CMakeFiles\opencv_python2.dir/objects.a
C:\TDM-GCC-64\bin\ar.exe cr CMakeFiles\opencv_python2.dir/objects.a @CMakeFiles\opencv_python2.dir\objects1.rsp
C:\TDM-GCC-64\bin\g++.exe -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -Wno-unused-function -Wno-overloaded-virtual -Wno-undef -Wno-deprecated-declarations -O3 -DNDEBUG -DNDEBUG -shared -o ..\..\lib\cv2.pyd -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles\opencv_python2.dir/objects.a -Wl,--no-whole-archive @CMakeFiles\opencv_python2.dir\linklibs.rsp
CMakeFiles\opencv_python2.dir/objects.a(cv2.cpp.obj):cv2.cpp:(.text$initcv2+0x2bbe): undefined reference to `__imp_Py_InitModule4'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [lib/cv2.pyd] Error 1
mingw32-make.exe[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
modules\python2\CMakeFiles\opencv_python2.dir\build.make:114: recipe for target 'lib/cv2.pyd' failed
mingw32-make.exe[2]: Leaving directory 'C:/OpenCV/pepito'
CMakeFiles\Makefile2:4081: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/OpenCV/pepito'
C:/OpenCV/pepito/Makefile:161: recipe for target 'all' failed
Process terminated with status 2 (0 minute(s), 25 second(s))
5 error(s), 0 warning(s) (0 minute(s), 25 second(s))
并获得 buid 消息:
||=== Build: all in OpenCV (compiler: GNU GCC Compiler) ===|
CMakeFiles\opencv_python2.dir\objects.a(cv2.cpp.obj)cv2.cpp:(.text$initcv2+0x2bbe)||undefined reference to `__imp_Py_InitModule4'|
||error: ld returned 1 exit status|
modules\python2\CMakeFiles\opencv_python2.dir\build.make|114|recipe for target 'lib/cv2.pyd' failed|
CMakeFiles\Makefile2|4081|recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed|
C:\OpenCV\pepito\Makefile|161|recipe for target 'all' failed|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 25 second(s)) ===|
解决这个问题的任何帮助将不胜感激:)
解决方案
如果有人服务,对我来说,解决方案是在 cmake 中禁用 BUILD_opencv_python
推荐阅读
- python - 在浮动列表中查找浮动列表的索引
- caching - CDN 边缘服务器上的缓存未命中
- sql-server - Excel 2016:右键单击->在表中刷新实际上不会刷新来自 SQL 数据库的数据
- javascript - D3.js:创建一个饼图,其中每个切片具有不同的径向渐变半径
- layout - 如何水平居中作为 SwiftUI 中视图组一部分的视图
- sql - 从字符串中删除最后两个空格
- javascript - 使用 javascript 自动全屏(点击 FS 按钮)
- typescript - Webpack 弄乱字符顺序导致意外令牌错误
- regex - 在文本文件中组合与正则表达式匹配的某些行
- javascript - NativeScript Vue ListView onTap 不发送带有事件的项目