Compile OpenCV with TBB on a Raspberry Pi 2

I tried to build OpenCV on Raspberry Pi 2 with TBB, I installed TBB from source on the Pi, I specified the path to TBB libs for cmake config, but I get the error:

/home/mihai/tbb43_20150316oss/include/tbb/machine/gcc_armv7.h:31:2: error: #error compilation requires ARMv7-a architecture.

I think the error is because in the OpenCV makefile I have to enable the flag for ARMv7

-DTBB_USE_GCC_BUILTINS = 1 -D__TBB_64BIT_ATOMICS = 0

The problem is, I don't know where to turn it on. Has anyone had this problem and would like to share a solution?

+3


source to share


2 answers


I solved it: D. For those who have this problem, follow these steps:

1.Go for 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 gcc_armv7.h file, go to line 56 and replace it with

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

      



For those who want to explain how I did it, after the first step I get the following errors:

/tmp/ccnkbkfd.s:313: Error: selected processor does not support ARM mode `dmb ish'
/tmp/ccnkbkfd.s:386: Error: selected processor does not support ARM mode `dmb ish'
/tmp/ccnkbkfd.s:533: Error: selected processor does not support ARM mode `dmb ish'
/tmp/ccnkbkfd.s:562: Error: selected processor does not support ARM mode `dmb ish'

      

After I searched on google and found this:

The alternative for using dmb is to call the Linux kernel __kuser_memory_barrier

the __kuser_memory_barrier helper operation is found in all ARM kernels 2.6.15 and later
and provide a way to issue a memory barrier that will work across all ARM arch.__kuser_memory_barrier 
helper function found at address 0xffff0fa0

      

+2


source


or you can run

sudo make CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"

      



instead of running

sudo make 

      

+1


source







All Articles