我正在尝试为 Raspberry Pi 交叉编译一个大型项目.我正在使用由 crosstool-ng,gcc 版本 4.7.3 构建的工具链.编译在看到 std::shared_future 时会窒息.我收到此错误:
I'm trying to cross-compile a large project for the Raspberry Pi. I'm using a toolchain built by crosstool-ng, gcc version 4.7.3. The compilation chokes when it sees std::shared_future. I get this error:
test.cpp:5:27: error: aggregate 'std::shared_future<int> xxx' has incomplete type and cannot be defined
这是产生该错误的源文件:
And here's the source file that generates that error:
#include <future>
int main()
{
std::shared_future<int> xxx;
return 0;
}
同样的源文件在 Rapsberry Pi 本身上编译成功.这是交叉工具工具链中的错误吗?有解决方法吗?我怎样才能让它成功编译?
This same source file compiles successfully on the Rapsberry Pi itself. Is this a bug in the crosstool toolchain? Is there a workaround? How can I get this to successfully compile?
我在 @backlash 和 Freenode 上 #gcc 上的人的帮助下解决了这个问题.Crosstool-NG 正在为 armv7
构建工具链,而 Raspberry Pi 的编译器正在为 armv6
编译.将架构级别"(目标选项 > 架构级别)更改为 armv6
允许我编译我原始问题中发布的示例代码.此选项将 --with-arch=armv6
添加到 gcc
的配置标志.希望这对将来有人有所帮助.
I solved this problem with help from @backlash and the people on #gcc on Freenode. Crosstool-NG was building the toolchain for armv7
, while the Raspberry Pi's compiler was compiling for armv6
. Changing the "Architecture level" (Target options > Architecture level) to armv6
allowed me to compile the sample code posted in my original question. This option adds a --with-arch=armv6
to the configure flags for gcc
. Hope this helps someone out in the future.
这篇关于树莓派工具链上的 std::shared_future的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!