Search code examples
tbbintel-oneapi

Oneapi fatal error: compare: No such file or directory after system restart


I have a project been working on for my research for over a year, Oneapi have been integrated for way longer than 6months, everything working and all. Yesterday I updated some test code, and ran the tests, nothing out of normal. Today I restarted my machine (Ubuntu 20.04.2 LTS, 64bits) for updates, and now when I try to compile the project it gives:

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.

This only happened after system restart (possibly broke some links?) and only happens in files that require concurrent_vector.h

Ideally I'd prefer a fix that won't require reinstall of oneapi, apt-get update followed by apt-get upgrade didn't fix it, neither did restarting the system again.


Solution

  • Just ran into the same thing. It looks as if TBB automatically includes <compare> if you are compiling with -std=c++20:

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

    #define __TBB_CPP20_COMPARISONS_PRESENT                 __TBB_CPP20_PRESENT
    

    GCC only added the compare header in libstdc++-10.

    To me, this looks like a bug in TBB. I opened an issue here.

    As a hotfix, I was able to downgrade my project to C++17. If that is not an option, you could consider copying detail/_config.h, defining __TBB_CPP20_COMPARISONS_PRESENT 0 in your copy and including it before you include any TBB header. The include guards should make sure that your version supersedes the broken TBB version.