我面临着使用TBB构建OpenCV的难题。带有CMake GUI和MinGW64的threadingbuildingblocks.org的TBB库版本4.0(或4.4):
TBB_ENV_INCLUDE = D:/CodeBlocks/tbb4/include
TBB_ENV_LIB_DEBUG = D:/CodeBlocks/tbb4/lib/intel64/vc10/tbb_debug.lib
TBB_VER_FILE = D:/CodeBlocks/tbb4/include/tbb/tbb_stddef.h
WITH_TBB = ON
BUILD_TBB = OFF
CMake在报告中生成此内容:
Parallel framework: TBB (ver 4.0 interface 6000)
建筑物具有以下特点:
[ 26%] Linking CXX shared library ..\..\bin\libopencv_core400.dll
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$__tcf_1+0x12): undefined reference to `tbb::task_scheduler_init::terminate()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZL17parallel_for_implRKN2cv5RangeERKNS_16ParallelLoopBodyEd.constprop.75+0x1b3): undefined reference to `tbb::task_group_context::init()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZL17parallel_for_implRKN2cv5RangeERKNS_16ParallelLoopBodyEd.constprop.75+0x1ca): undefined reference to `tbb::internal::allocate_root_with_context_proxy::allocate(unsigned long long) const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZL17parallel_for_implRKN2cv5RangeERKNS_16ParallelLoopBodyEd.constprop.75+0x205): undefined reference to `tbb::internal::get_initial_auto_partitioner_divisor()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZL17parallel_for_implRKN2cv5RangeERKNS_16ParallelLoopBodyEd.constprop.75+0x229): undefined reference to `tbb::task_group_context::~task_group_context()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZL17parallel_for_implRKN2cv5RangeERKNS_16ParallelLoopBodyEd.constprop.75+0x2de): undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZL17parallel_for_implRKN2cv5RangeERKNS_16ParallelLoopBodyEd.constprop.75+0x2e9): undefined reference to `tbb::task_group_context::~task_group_context()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN3tbb10interface68internal9start_forINS_13blocked_rangeIiEEN12_GLOBAL__N_113ProxyLoopBodyENS_16auto_partitionerEE7executeEv+0x4e): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long long) const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN3tbb10interface68internal9start_forINS_13blocked_rangeIiEEN12_GLOBAL__N_113ProxyLoopBodyENS_16auto_partitionerEE7executeEv+0x7c): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long long) const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN3tbb10interface68internal9start_forINS_13blocked_rangeIiEEN12_GLOBAL__N_113ProxyLoopBodyENS_16auto_partitionerEE7executeEv+0x219): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long long) const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN3tbb10interface68internal9start_forINS_13blocked_rangeIiEEN12_GLOBAL__N_113ProxyLoopBodyENS_16auto_partitionerEE7executeEv+0x25c): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long long) const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN3tbb10interface68internal9start_forINS_13blocked_rangeIiEEN12_GLOBAL__N_113ProxyLoopBodyENS_16auto_partitionerEE7executeEv+0x30d): undefined reference to `tbb::task_group_context::is_group_execution_cancelled() const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN3tbb10interface68internal9start_forINS_13blocked_rangeIiEEN12_GLOBAL__N_113ProxyLoopBodyENS_16auto_partitionerEE7executeEv+0x5da): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long long) const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN3tbb10interface68internal9start_forINS_13blocked_rangeIiEEN12_GLOBAL__N_113ProxyLoopBodyENS_16auto_partitionerEE7executeEv+0x608): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long long) const'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN2cv13getNumThreadsEv+0x21): undefined reference to `tbb::task_scheduler_init::default_num_threads()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN2cv13setNumThreadsEi+0x23): undefined reference to `tbb::task_scheduler_init::terminate()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$_ZN2cv13setNumThreadsEi+0x35): undefined reference to `tbb::task_scheduler_init::initialize(int)'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$cvSetNumThreads+0x23): undefined reference to `tbb::task_scheduler_init::terminate()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$cvSetNumThreads+0x35): undefined reference to `tbb::task_scheduler_init::initialize(int)'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text$cvGetNumThreads+0x21): undefined reference to `tbb::task_scheduler_init::default_num_threads()'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.text.startup._GLOBAL__sub_I__ZN2cv16ParallelLoopBodyD2Ev+0x3a): undefined reference to `tbb::task_scheduler_init::initialize(int, unsigned long long)'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.rdata$_ZTVN3tbb10interface68internal9flag_taskE[_ZTVN3tbb10interface68internal9flag_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
CMakeFiles\opencv_core.dir/objects.a(parallel.cpp.obj):parallel.cpp:(.rdata$_ZTVN3tbb10interface68internal11signal_taskE[_ZTVN3tbb10interface68internal11signal_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
collect2.exe: error: ld returned 1 exit status
modules\core\CMakeFiles\opencv_core.dir\build.make:1481: recipe for target 'bin/libopencv_core400.dll' failed
mingw32-make[2]: *** [bin/libopencv_core400.dll] Error 1
CMakeFiles\Makefile2:2320: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
mingw32-make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
以相同的方式尝试使用TBB 4.0或4.4并更改ENABLE_PRECOMPILED_HEADERS没什么区别。 接下来要尝试什么?谢谢。