如何使用 mingw 在启用 tbb 的情况下安装 opencv [英] How to install opencv with tbb enabled using mingw
问题描述
如何在启用 TBB 的情况下安装 Opencv?
How to install Opencv with TBB enabled?
我尝试了以下方法:
1) 下载了 TBB 包.
1) Downloaded the TBB package.
2) 使用以下命令构建
2) Build using the below command
mingw32-make compiler=gcc arch=ia32 runtime=mingw default
3) 我将环境变量路径设置为d: bbuildwindows_ia32_gcc_mingw_release
3) I set the Environmental variable path as "d: bbuildwindows_ia32_gcc_mingw_release
3) 现在使用 cmake,我启用了WITH_TBB"并编译了 opencv.
3) Now using cmake, I enabled "WITH_TBB" and compiled the opencv.
它抛出以下错误.
[ 22%] Built target pch_Generate_opencv_core
Linking CXX shared library ....inlibopencv_core245.dll
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot fin
d -ltbb
collect2: ld returned 1 exit status
make[2]: *** [bin/libopencv_core245.dll] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
我是不是遗漏了什么...请指教..
Am I missing anything... Please advice..
推荐答案
我遇到了同样的问题,以下解决了 tbb 链接错误:
I had the same problem, the following worked out for removing the tbb linking error:
(假设您已经构建了 tbb,正如您已经在问题中解释的那样)
(Assuming you have already built tbb, as you are already explaining in your question)
从 CMake,配置一次 OpenCV
From CMake, configure one time OpenCV
启用WITH_TBB
,小心不要启用BUILD_TBB
:尽管付出了很多努力,OpenCV的自动下载和构建还是失败了.如果您之前启用了 BUILD_TBB
,我的建议是从头开始,清除 cmake 缓存.
Enable WITH_TBB
, be careful not enabling BUILD_TBB
: the automatic downloading and building of OpenCV failed miserably for me despite many efforts. If you had previously enabled BUILD_TBB
, my suggestion is to restart from the beginnning, clearing cmake cache.
第二次配置 OpenCV
Configure a second time OpenCV
现在应该出现一些变量:TBB_INCLUDE_DIRS
.对我来说,我设置了以下值(分别):
Now some variables should appear: TBB_INCLUDE_DIRS
. For me I set the following values (respectively):
tbb41_20130314oss/include
出现 2 个新变量:TBB_STDDEF_PATH
和 TBB_LIB_DIR
.它们被分配了一些明显合理的值.对我来说,TBB_STDDEF_PATH
是正确的,但 TBB_LIB_DIR
不是!所以我更正为:
2 new variables appears: TBB_STDDEF_PATH
and TBB_LIB_DIR
. They are assigned some apparently reasonable values. For me, TBB_STDDEF_PATH
was correct, but TBB_LIB_DIR
was not! So I corrected it to be:
tbb41_20130314oss/build/windows_ia32_gcc_mingw4.8.1_release
然后我保留了 TBB_STDDEF_PATH
原样:
and I left TBB_STDDEF_PATH
as it was:
tbb41_20130314oss/include/tbb/tbb_stddef.h
配置第三次时间
最后点击Generate,你就可以构建mingw32-make -j7
Finally, click Generate, and you are ready to build mingw32-make -j7
一旦您开始使用 opencv 库,请确保 tbb DLL 在您的路径中
Once you start using the opencv library, make sue the tbb DLLs are in your path
这篇关于如何使用 mingw 在启用 tbb 的情况下安装 opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!