简体   繁体   English

在Raspberry Pi 2上使用TBB编译OpenCV

[英]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: 我已经尝试使用TBB在Raspberry Pi 2上构建OpenCV,我已经在Pi上从源代码安装了TBB,我已经指定了TBB库到cmake配置的路径,但是我收到了错误:

/home/mihai/tbb43_20150316oss/include/tbb/machine/gcc_armv7.h:31:2: error: #error compilation requires an ARMv7-a architecture. /home/mihai/tbb43_20150316oss/include/tbb/machine/gcc_armv7.h:31:2:错误:#error编译需要ARMv7-a架构。

I think the error is because in the OpenCV makefile i have to include the flag for ARMv7 我认为错误是因为在OpenCV makefile中我必须包含ARMv7的标志

-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0 -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? 问题是我不知道在哪里包含它。有没有人有这个问题,abd想分​​享一个解决方案?

I have resolved it :D .For those having this problem follow these steps: 我已经解决了它:D。对于有此问题的人,请按照以下步骤操作:

1.Go to file gcc_armv7.h line 31 and comment lines 1.转到文件gcc_armv7.h第31行和注释行

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 2.在同一个文件gcc_armv7.h中,转到第56行并替换为

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 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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