Compiling TBB, EmguCV, OpenCV for Raspberry Pi 3

Aug 16, 2016

I previously documented how to build TBB for Raspberry Pi 2. This entry shows how to do it for the Raspberry Pi 3 which is an ARMv8 Cortex-A53 processor and needed some extra steps to get working.

1) Compile TBB

Compile TBB source following these instructions from Stack Exchange

2) Fix TBB source files

These steps weren’t necessary to get TBB compiled but were necessary to get EmguCV/OpenCV going. Credit to Mihai Ilie.

1.Go to file gcc_armv7.h line 31 and comment lines

30 #if !(__ARM_ARCH_7A__)
31 #error compilation requires an ARMv7-a architecture.   
32 #endif

2.Next in the same file gcc_armv7.h go to line 56 and replace it with

56 #define __TBB_full_memory_fence() 0xffff0fa0  // __asm__ __volatile__("dmb ish": : :"memo    ry")

3) Compile EmguCV / OpenCV

Firstly make sure you have sourced the tbb vars (source ./

Instead of executing the cmake bash script as per the emgu wiki, do this from the emgucv repo root.


The differences in the above command from the emgucv bash script are these switches


Of course the dir paths will change depending on the downloaded version of TBB.

4) Test

Execute ~/emgucv/bin/mono Example.FaceDetection.mono.exe