Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: 'experimental/coroutine' file not found, on macOS using Clang latest #5030

Open
selimsandal opened this issue Mar 31, 2024 · 2 comments
Labels
area: portability Issue involves operating system/compiler portability status: ready Issue is ready for someone to fix; then goes to 'status: assigned'

Comments

@selimsandal
Copy link

Using LLVM latest from Homebrew or Apple clang version 15.0.0 (clang-1500.3.9.4). I get these errors when I try to create a sim binary.

In file included from Vriscv_decoder__pch.h:23:
In file included from ./Vriscv_decoder__Syms.h:17:
In file included from ./Vriscv_decoder___024root.h:9:
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:39:11: fatal error: 'experimental/coroutine' file not found
# include <experimental/coroutine>
          ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from Vriscv_decoder__pch.h:23:
In file included from ./Vriscv_decoder__Syms.h:17:
In file included from ./Vriscv_decoder___024root.h:9:
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:39:11: fatal error: 'experimental/coroutine' file not found
# include <experimental/coroutine>
          ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.cpp:23:
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:39:11: fatal error: 'experimental/coroutine' file not found
# include <experimental/coroutine>
          ^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
1 error generated.
1 error generated.

I tried changing experimental/coroutine to coroutine. I got these errors.
In file included from ./Vriscv_decoder___024root.h:9:
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:41:23: error: expected namespace name
      using namespace experimental;  // Bring std::experimental into the std namespace
                      ^
In file included from Vriscv_decoder__pch.h:23:
In file included from ./Vriscv_decoder__Syms.h:17:
In file included from ./Vriscv_decoder___024root.h:9:
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:41:23: error: expected namespace name
      using namespace experimental;  // Bring std::experimental into the std namespace
                      ^
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.cpp:23:
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:41:23: error: expected namespace name
      using namespace experimental;  // Bring std::experimental into the std namespace
                      ^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:100:10: error: no template named 'coroutine_handle' in namespace 'std'
    std::coroutine_handle<> m_coro;  // The wrapped coroutine handle
    ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:100:10: error: no template named 'coroutine_handle' in namespace 'std'
    std::coroutine_handle<> m_coro;  // The wrapped coroutine handle
    ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:100:10: error: no template named 'coroutine_handle' in namespace 'std'
    std::coroutine_handle<> m_coro;  // The wrapped coroutine handle
    ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:114:28: error: no template named 'coroutine_handle' in namespace 'std'
    VlCoroutineHandle(std::coroutine_handle<> coro, VlProcessRef process, VlFileLineDebug fileline)
                      ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:114:28: error: no template named 'coroutine_handle' in namespace 'std'
    VlCoroutineHandle(std::coroutine_handle<> coro, VlProcessRef process, VlFileLineDebug fileline)
                      ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:114:28: error: no template named 'coroutine_handle' in namespace 'std'
    VlCoroutineHandle(std::coroutine_handle<> coro, VlProcessRef process, VlFileLineDebug fileline)
                      ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:201:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:201:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:201:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:269:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:269:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:269:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:317:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:317:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:317:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:367:29: error: no template named 'coroutine_handle' in namespace 'std'
    void await_suspend(std::coroutine_handle<> coro) const { coro.destroy(); }
                       ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:367:29: error: no template named 'coroutine_handle' in namespace 'std'
    void await_suspend(std::coroutine_handle<> coro) const { coro.destroy(); }
                       ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:367:29: error: no template named 'coroutine_handle' in namespace 'std'
    void await_suspend(std::coroutine_handle<> coro) const { coro.destroy(); }
                       ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:402:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:402:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:402:37: error: no template named 'coroutine_handle' in namespace 'std'
            void await_suspend(std::coroutine_handle<> coro) {
                               ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:419:14: error: no template named 'coroutine_handle' in namespace 'std'
        std::coroutine_handle<> m_continuation;  // Coroutine to resume after this one finishes
        ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:419:14: error: no template named 'coroutine_handle' in namespace 'std'
        std::coroutine_handle<> m_continuation;  // Coroutine to resume after this one finishes
        ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:419:14: error: no template named 'coroutine_handle' in namespace 'std'
        std::coroutine_handle<> m_continuation;  // Coroutine to resume after this one finishes
        ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:427:14: error: no type named 'suspend_never' in namespace 'std'
:        std::suspend_never initial_suspend() const { return {}; }
427:14: error:         ~~~~~^
no type named 'suspend_never' in namespace 'std'
        std::suspend_never initial_suspend() const { return {}; }
        ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:427:14: error: no type named 'suspend_never' in namespace 'std'
        std::suspend_never initial_suspend() const { return {}; }
        ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:431:14: error: no type named 'suspend_never' in namespace 'std'
        std::suspend_never final_suspend() noexcept;
        ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:431:14: error: no type named 'suspend_never' in namespace 'std'
        std::suspend_never final_suspend() noexcept;
        ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:431:14: error: no type named 'suspend_never' in namespace 'std'
        std::suspend_never final_suspend() noexcept;
        ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:466:29: error: no template named 'coroutine_handle' in namespace 'std'
    void await_suspend(std::coroutine_handle<> coro) { m_promisep->m_continuation = coro; }
                       ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:466:29: error: no template named 'coroutine_handle' in namespace 'std'
    void await_suspend(std::coroutine_handle<> coro) { m_promisep->m_continuation = coro; }
                       ~~~~~^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:466:29: error: no template named 'coroutine_handle' in namespace 'std'
    void await_suspend(std::coroutine_handle<> coro) { m_promisep->m_continuation = coro; }
                       ~~~~~^
12 errors generated.
12 errors generated.
make: *** [Vriscv_decoder__pch.h.fast.gch] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Vriscv_decoder__pch.h.slow.gch] Error 1
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.cpp:230:6: error: no type named 'suspend_never' in namespace 'std'
std::suspend_never VlCoroutine::VlPromise::final_suspend() noexcept {
~~~~~^
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.cpp:23:
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:28:
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated.h:58:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:594:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2195:41: error: static_cast from 'pointer' (aka 'std::__tree_node<std::__value_type<unsigned long long, VlCoroutineHandle>, void *> *') to '__node_base_pointer' (aka 'std::__tree_node_base<void *> *'), which are not related by inheritance, is not allowed
    __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:2122:24: note: in instantiation of function template specialization 'std::__tree<std::__value_type<unsigned long long, VlCoroutineHandle>, std::__map_value_compare<unsigned long long, std::__value_type<unsigned long long, VlCoroutineHandle>, std::less<unsigned long long>>, std::allocator<std::__value_type<unsigned long long, VlCoroutineHandle>>>::__emplace_multi<unsigned long long &, VlCoroutineHandle>' requested here
        return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);
                       ^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:203:27: note: in instantiation of function template specialization 'std::multimap<unsigned long long, VlCoroutineHandle>::emplace<unsigned long long &, VlCoroutineHandle>' requested here
                    queue.emplace(delay, VlCoroutineHandle{coro, process, fileline});
                          ^
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.cpp:23:
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:28:
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated.h:58:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:594:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:892:62: error: cannot initialize a member subobject of type '__iter_pointer' (aka 'std::__tree_end_node<std::__tree_node_base<void *> *> *') with an lvalue of type '__node_pointer' (aka 'std::__tree_node<std::__value_type<unsigned long long, VlCoroutineHandle>, void *> *')
    explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
                                                             ^      ~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2196:12: note: in instantiation of member function 'std::__tree_iterator<std::__value_type<unsigned long long, VlCoroutineHandle>, std::__tree_node<std::__value_type<unsigned long long, VlCoroutineHandle>, void *> *, long>::__tree_iterator' requested here
    return iterator(static_cast<__node_pointer>(__h.release()));
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:2122:24: note: in instantiation of function template specialization 'std::__tree<std::__value_type<unsigned long long, VlCoroutineHandle>, std::__map_value_compare<unsigned long long, std::__value_type<unsigned long long, VlCoroutineHandle>, std::less<unsigned long long>>, std::allocator<std::__value_type<unsigned long long, VlCoroutineHandle>>>::__emplace_multi<unsigned long long &, VlCoroutineHandle>' requested here
        return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);
                       ^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:203:27: note: in instantiation of function template specialization 'std::multimap<unsigned long long, VlCoroutineHandle>::emplace<unsigned long long &, VlCoroutineHandle>' requested here
                    queue.emplace(delay, VlCoroutineHandle{coro, process, fileline});
                          ^
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.cpp:23:
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:28:
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated.h:58:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:594:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2258:24: error: comparison of distinct pointer types ('__iter_pointer' (aka 'std::__tree_end_node<std::__tree_node_base<void *> *> *') and '__node_pointer' (aka 'std::__tree_node<std::__value_type<unsigned long long, VlCoroutineHandle>, void *> *'))
    if (__begin_node() == __ptr)
        ~~~~~~~~~~~~~~ ^  ~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2430:20: note: in instantiation of member function 'std::__tree<std::__value_type<unsigned long long, VlCoroutineHandle>, std::__map_value_compare<unsigned long long, std::__value_type<unsigned long long, VlCoroutineHandle>, std::less<unsigned long long>>, std::allocator<std::__value_type<unsigned long long, VlCoroutineHandle>>>::__remove_node_pointer' requested here
    iterator __r = __remove_node_pointer(__np);
                   ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:2187:56: note: in instantiation of member function 'std::__tree<std::__value_type<unsigned long long, VlCoroutineHandle>, std::__map_value_compare<unsigned long long, std::__value_type<unsigned long long, VlCoroutineHandle>, std::less<unsigned long long>>, std::allocator<std::__value_type<unsigned long long, VlCoroutineHandle>>>::erase' requested here
    iterator erase(iterator __p)       {return __tree_.erase(__p.__i_);}
                                                       ^
/opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.cpp:64:17: note: in instantiation of member function 'std::multimap<unsigned long long, VlCoroutineHandle>::erase' requested here
        m_queue.erase(m_queue.begin());
                ^
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.cpp:23:
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated_timing.h:28:
In file included from /opt/homebrew/Cellar/verilator/5.022/share/verilator/include/verilated.h:58:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:594:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2262:26: error: static_cast from '__node_pointer' (aka 'std::__tree_node<std::__value_type<unsigned long long, VlCoroutineHandle>, void *> *') to '__node_base_pointer' (aka 'std::__tree_node_base<void *> *'), which are not related by inheritance, is not allowed
                         static_cast<__node_base_pointer>(__ptr));
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 errors generated.

Can you attach an example that shows the issue? Any 2 modules, one instantiating other.

What 'verilator' command line do we use to run your example?
verilator --binary -j 0 -Wno-lint --trace '__RTL/riscv_decoder.sv' '__RTL/_TB/riscv_decoder_tb.sv'

What 'verilator --version' are you using? Did you try it with the git master version?
Verilator 5.022 2024-02-24 rev UNKNOWN.REV (Homebrew latest), I tried with the master version using (--HEAD)

What OS and distribution are you using?
macOS Sonoma 14.4.1 (23E224)

May we assist you in trying to fix this in Verilator yourself?
Yes

@selimsandal selimsandal added the new New issue not seen by maintainers label Mar 31, 2024
@wsnyder wsnyder added area: portability Issue involves operating system/compiler portability status: ready Issue is ready for someone to fix; then goes to 'status: assigned' and removed new New issue not seen by maintainers labels Mar 31, 2024
@wsnyder
Copy link
Member

wsnyder commented Mar 31, 2024

Check the compiler flags are correct, then probably the #ifdefs in verilated_timing.h need to be updated for (yet another) change in what clang requires. Please send a pull once it's figured out - we'll need to support old versions so add another ifdef on the clang version.

@selimsandal
Copy link
Author

Opened PR for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: portability Issue involves operating system/compiler portability status: ready Issue is ready for someone to fix; then goes to 'status: assigned'
Projects
None yet
Development

No branches or pull requests

2 participants