问题
I am trying to build OpenCV with TBB to enable multi-threading.
Note: I am able to build OpenCV-2.4.10 without TBB from source and then use the OpenCV Python bindings.
When I try a fresh install and building OpenCV with TBB installed the WITH_TBB=ON
flag I am then unable to import cv2
- I take this to mean something has gone wrong in the build process.
Here's how I'm trying to do it:
# Download, unpack and build TBB:
wget -O ~/tbb43_20150316oss_src.tgz --no-check-certificate https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb43_20150316oss_src.tgz
tar -xvzf tbb43_20150316oss_src.tgz
cd tbb43_20150316oss
make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"
# Build OpenCV:
cmake -D WITH_TBB=ON -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON \
-D BUILD_EXAMPLES=ON ..
make -j4
回答1:
Just for others looking for solution for the same problem, I got success just asking for the cmake utility for build TBB for me:
cmake -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_TBB=ON (more options) ..
After that, cmake downloaded TBB and I got something like:
Parallel framework: TBB (ver 4.4 interface 9003)
in my cmake output. I'm running a Raspbian Jessie environment with Pixel. Hope this helps.
来源:https://stackoverflow.com/questions/29556973/how-do-i-build-opencv-with-tbb-on-raspberry-pi