Oneapi 致命错误:比较:系统重启后没有那个文件或目录

问题描述

我有一个项目为我的研究工作了一年多,Oneapi 已经集成超过 6 个月,一切正常。昨天我更新了一些测试代码,并运行了测试,没有任何异常。今天我重新启动了我的机器(Ubuntu 20.04.2 LTS,64 位)进行更新,现在当我尝试编译项目时,它给出了:

In file included from /opt/intel/oneapi/tbb/2021.2.0/env/../include/oneapi/tbb/enumerable_thread_specific.h:26,from /opt/intel/oneapi/tbb/2021.2.0/env/../include/oneapi/tbb/combinable.h:22,from /opt/intel/oneapi/tbb/2021.2.0/env/../include/oneapi/tbb.h:35,from ...file name omitted for privacy...
/opt/intel/oneapi/tbb/2021.2.0/env/../include/oneapi/tbb/concurrent_vector.h:33:10: Fatal error: compare: No such file or directory
   33 | #include <compare>
      |          ^~~~~~~~~
compilation terminated.

这仅在系统重启后发生(可能破坏了一些链接?)并且只发生在需要 concurrent_vector.h 的文件

理想情况下,我更喜欢不需要重新安装 oneapi 的修复程序,apt-get update 后跟 apt-get upgrade 没有修复它,也没有再次重新启动系统。

解决方法

刚遇到同样的事情。如果您使用 if( !inCommon.includes(item._id)){...} 进行编译,则看起来好像 TBB 会自动包含 <compare>

https://github.com/oneapi-src/oneTBB/blob/9e15720bc7744f85dff611d34d65e9099e077da4/include/oneapi/tbb/detail/_config.h#L253

-std=c++20

仅限 GCC added the compare header in libstdc++-10

对我来说,这看起来像是 TBB 中的一个错误。我打开了一个问题 here

作为修补程序,我能够将我的项目降级到 C++17。如果这不是一个选项,您可以考虑复制 #define __TBB_CPP20_COMPARISONS_PRESENT __TBB_CPP20_PRESENT ,在您的副本中定义 detail/_config.h 并在包含任何 TBB 标头之前包含它。包含守卫应确保您的版本取代损坏的 TBB 版本。