简体   繁体   中英

Compile OpenCV with TBB on Raspberry Pi 2

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

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

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

-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0

The problem is that I don't know where to include it.Has anyone had this problem abd want to share a solution?

I have resolved it :D .For those having this problem follow these steps:

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")

For those who want an explanation 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 have 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

or you can run

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

instead of just running

sudo make 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM