How do I build OpenCV with TBB on Raspberry Pi?

与世无争的帅哥 提交于 2019-12-10 16:00:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!