Thank you for the quick response. The patch solves the problem. ср, 9 дек. 2020 г. в 18:01, Jonathan Wakely <jwak...@redhat.com>:
> On 09/12/20 12:49 +0000, Jonathan Wakely wrote: > >On 09/12/20 13:32 +0100, Vladimir V wrote: > >>Hello. > >> > >>While testing with the current upstream I encountered a compilation > issue. > >>Although I build with "--disable-threads" flag the following error > occurs: > >> > >>../../../../../libstdc++-v3/src/c++11/thread.cc:39:4: error: #error "No > >>sleep function known for this target" > >> > >>Previously the check was inside the #ifdef _GLIBCXX_HAS_GTHREADS that > >>prevented the error from happening (in my case with gcc v10.1), > >>So I would like to ask if the thread.cc should be involved in the build > if > >>the threads support is configured to be disabled? > > > >Yes, the file is always built, but which definitions it contains > >depends on what is configured for the target. > > > >The std::this_thread::sleep_for and std::this_thread::sleep_until > >functions don't actually depend on threads at all. They just sleep. > > > >But that still requires target support, just different support from > >threads. > > > >>And if it should, then can the condition be reworked to cover the > described > >>case? > > > >Yes, I'll do that. Thanks for bringing it to my attention. > > > >I assume we can't use avr-libc's delay functions, because they depend > >on the CPU clock frequency, which isn't known when we compile > >libstdc++. So I'll just suppress the declarations of those functions > >and remove the #error. > > The attached patch adds a new _GLIBCXX_NO_SLEEP configure macro which > should get defined for your hosted AVR build. That should mean that > std::this_thread::sleep_for is not defined, and src/c++11/thread.cc > will no longer insist on some way to sleep being supported. > > I've only tested this on powerpc64le-linux, so please let me know if > it works for you. > > Pushed to master. > > >