2

背景

  1. 我在 Ubuntu 18.04 上使用 crosstool-ng 为我的 ARMv7 Raspberry Pi 构建了一个工具链。由于GCC 6.3.0 的 GCC 7.1 编译存在问题,我对 ubsan.c 文件进行了一些修改。
  2. 我在 Raspberry Pi 本身上构建了所​​需的库,使用symlink 实用程序将符号链接从绝对更改为相对,压缩 /usr 和 /lib 目录以进行传输,并将它们安装在我的工作 sysroot 目录中。
  3. 该工具链已被证明适用于许多大型项目。

问题

我使用paho.mqtt.cpp库构建了一个简单的应用程序。此应用程序使用库要求的 C++11 标准。该应用程序在我的开发机器上编译和在 Raspberry Pi 上编译时编译和执行。但是,当我使用上述工具链时,我收到与库使用 std::async 相关的错误。

In file included from /home/hicklin/CLionProjects/mqttTest/main.cpp:7:0:
/opt/pi/sysroot/usr/local/include/mqtt/client.h: In member function 'virtual void mqtt::client::connected(const string&)':
/opt/pi/sysroot/usr/local/include/mqtt/client.h:71:76: error: invalid use of incomplete type 'class std::future<void>'
   std::async(std::launch::async, &callback::connected, userCallback_, cause);
                                                                            ^
In file included from /opt/pi/sysroot/usr/local/include/mqtt/client.h:28:0,
                 from /home/hicklin/CLionProjects/mqttTest/main.cpp:7:
/opt/pi/x-tools/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/include/c++/6.3.1/future:115:11: note: declaration of 'class std::future<void>'
     class future;
           ^~~~~~

尝试修复

  1. 我尝试使用 -nostdinc 标志来阻止编译器使用其标准头文件并使用 sysroot 中的头文件。错误仍然存​​在。
  2. 我尝试用future安装在 Pi 中的文件替换错误中提到的文件(它只有很小的区别)。错误仍然存​​在。

我的问题

任何人都可以指出此错误的原因以及可能需要调查的事情吗?我是否应该尝试以不同的方式重建工具链,或者我可能缺少一些标志?

4

0 回答 0