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

Compile failures on gcc-14 on Ubuntu Noble #1389

Open
williamspatrick opened this issue Aug 1, 2024 · 2 comments
Open

Compile failures on gcc-14 on Ubuntu Noble #1389

williamspatrick opened this issue Aug 1, 2024 · 2 comments

Comments

@williamspatrick
Copy link
Contributor

To recreate this:

docker run --rm -it ubuntu:noble
apt update
apt-get install g++-14 cmake git
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14 \
  --slave /usr/bin/g++ g++ /usr/bin/g++-14 \
  --slave /usr/bin/gcov gcov /usr/bin/gcov-14 \
  --slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-14 \
  --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-14
cd ~
git clone https://github.com/NVIDIA/stdexec && cd stdexec
cmake -S . -B build
cmake --build build -j1

Failure:

root@2660c3013321:~/stdexec# cmake --build build -j1
[  1%] Building CXX object CMakeFiles/system_context.dir/src/system_context/system_context.cpp.o
In file included from /root/stdexec/include/stdexec/__detail/__schedule_from.hpp:27,
                 from /root/stdexec/include/stdexec/__detail/__continue_on.hpp:25,
                 from /root/stdexec/include/stdexec/execution.hpp:26,
                 from /root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:19,
                 from /root/stdexec/include/exec/__detail/__system_context_default_impl_entry.hpp:24,
                 from /root/stdexec/src/system_context/system_context.cpp:18:
/root/stdexec/include/stdexec/__detail/__schedulers.hpp: In instantiation of 'auto stdexec::__sched::schedule_t::operator()(_Scheduler&&) const [with _Scheduler = stdexec::__inln::__scheduler]':
/root/stdexec/include/stdexec/__detail/__schedulers.hpp:66:17:   required by substitution of 'template<class _Scheduler>  requires  scheduler<_Scheduler> using stdexec::schedule_result_t = stdexec::__call_result_t<stdexec::__sched::schedule_t, _Scheduler> [with _Scheduler = stdexec::__inln::__scheduler]'
   66 |       { schedule(static_cast<_Scheduler&&>(__sched)) } -> sender;
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:65:   required from here
   78 |   static_assert(__is_scheduler_affine<schedule_result_t<__inln::__scheduler>>);
      |                                                                 ^~~~~~~~~~~
/root/stdexec/include/stdexec/__detail/__schedulers.hpp:50:23: error: static assertion failed
   50 |         static_assert(sender<tag_invoke_result_t<schedule_t, _Scheduler>>);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/stdexec/include/stdexec/__detail/__schedulers.hpp:50:23: note: constraints not satisfied
In file included from /root/stdexec/include/stdexec/__detail/__senders.hpp:29,
                 from /root/stdexec/include/stdexec/__detail/__as_awaitable.hpp:26,
                 from /root/stdexec/include/stdexec/execution.hpp:21:
/root/stdexec/include/stdexec/__detail/__senders_core.hpp:48:11:   required by the constraints of 'template<class _Sender> concept stdexec::sender'
/root/stdexec/include/stdexec/__detail/__senders_core.hpp:49:5: note: the expression 'enable_sender<typename'decltype_type' not supported by pp_cxx_unqualified_id::__f<_Ty> > [with _Sender = void]' evaluated to 'false'
   49 |     enable_sender<__decay_t<_Sender>>                     //
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/stdexec/include/stdexec/execution.hpp:33:
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:65: error: template constraint failure for 'template<class _Scheduler>  requires  scheduler<_Scheduler> using stdexec::schedule_result_t = stdexec::__call_result_t<stdexec::__sched::schedule_t, _Scheduler>'
   78 |   static_assert(__is_scheduler_affine<schedule_result_t<__inln::__scheduler>>);
      |                                                                 ^~~~~~~~~~~
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:65: note: constraints not satisfied
/root/stdexec/include/stdexec/__detail/__schedulers.hpp: In substitution of 'template<class _Scheduler>  requires  scheduler<_Scheduler> using stdexec::schedule_result_t = stdexec::__call_result_t<stdexec::__sched::schedule_t, _Scheduler> [with _Scheduler = stdexec::__inln::__scheduler]':
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:65:   required from here
/root/stdexec/include/stdexec/__detail/__schedulers.hpp:64:11:   required for the satisfaction of '__has_schedule<_Scheduler>' [with _Scheduler = stdexec::__inln::__scheduler]
/root/stdexec/include/stdexec/__detail/__schedulers.hpp:77:11:   required for the satisfaction of 'scheduler<_Scheduler>' [with _Scheduler = stdexec::__inln::__scheduler]
/root/stdexec/include/stdexec/__detail/__schedulers.hpp:65:5:   in requirements with '_Scheduler&& __sched' [with _Scheduler = stdexec::__inln::__scheduler]
/root/stdexec/include/stdexec/__detail/__schedulers.hpp:66:17: note: 'stdexec::schedule(static_cast<_Scheduler&&>(__sched))' does not satisfy return-type-requirement
   66 |       { schedule(static_cast<_Scheduler&&>(__sched)) } -> sender;
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:17: error: template argument 1 is invalid
   78 |   static_assert(__is_scheduler_affine<schedule_result_t<__inln::__scheduler>>);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/stdexec/include/stdexec/execution.hpp:23:
/root/stdexec/include/stdexec/__detail/__bulk.hpp: In instantiation of 'auto [requires stdexec::__well_formed_sender<<placeholder>, >] stdexec::__bulk::bulk_t::operator()(_Sender&&, _Shape, _Fun) const [with _Sender = exec::_pool_::static_thread_pool_::scheduler::_sender; _Shape = long unsigned int; _Fun = exec::__system_context_default_impl::__system_scheduler_impl::__bulk_functor]':
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:128:75:   required from here
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:17: error:   128 |     using __bulk_schedule_operation_t = __operation<decltype(stdexec::bulk(
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:17: error:       |                                                              ~~~~~~~~~~~~~^
     129 |       stdexec::schedule(std::declval<__pool_scheduler_t>()),
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:17: error:       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~               
     130 |       std::declval<unsigned long>(),
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:17: error:       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                       
     131 |       std::declval<__bulk_functor>()))>;
/root/stdexec/include/stdexec/__detail/__inline_scheduler.hpp:78:17: error:       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                      
/root/stdexec/include/stdexec/__detail/__bulk.hpp:81:31: error: invalid use of void expression
   81 |           __make_sexpr<bulk_t>(
      |           ~~~~~~~~~~~~~~~~~~~~^
   82 |             __data{__shape, static_cast<_Fun&&>(__fun)}, static_cast<_Sender&&>(__sndr)));
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:131:39: error: template argument 1 is invalid
  131 |       std::declval<__bulk_functor>()))>;
      |                                       ^
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp: In constructor 'exec::__system_context_default_impl::__system_scheduler_impl::__system_scheduler_impl(exec::static_thread_pool&)':
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:106:47: error: '__bulk_schedule_operation_t' was not declared in this scope; did you mean '__bulk_schedule_operation_size'?
  106 |       __bulk_schedule_operation_size = sizeof(__bulk_schedule_operation_t),
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               __bulk_schedule_operation_size
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp: In static member function 'static void* exec::__system_context_default_impl::__system_scheduler_impl::__bulk_schedule_impl(__exec_system_scheduler_interface*, void*, uint32_t, __exec_system_context_completion_callback_t, __exec_system_context_bulk_item_callback_t, void*, long unsigned int)':
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:167:19: error: '__bulk_schedule_operation_t' has not been declared
  167 |       auto __os = __bulk_schedule_operation_t::__construct_maybe_alloc(
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp: In static member function 'static void exec::__system_context_default_impl::__system_scheduler_impl::__destruct_bulk_schedule_operation_impl(__exec_system_scheduler_interface*, void*)':
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:176:31: error: '__bulk_schedule_operation_t' does not name a type; did you mean '__schedule_operation_t'?
  176 |       auto __op = static_cast<__bulk_schedule_operation_t*>(__operation);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                               __schedule_operation_t
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:176:58: error: expected '>' before '*' token
  176 |       auto __op = static_cast<__bulk_schedule_operation_t*>(__operation);
      |                                                          ^
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:176:58: error: expected '(' before '*' token
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:176:59: error: expected primary-expression before '>' token
  176 |       auto __op = static_cast<__bulk_schedule_operation_t*>(__operation);
      |                                                           ^
/root/stdexec/include/exec/__detail/__system_context_default_impl.hpp:176:73: error: expected ')' before ';' token
  176 |       auto __op = static_cast<__bulk_schedule_operation_t*>(__operation);
      |                                                                         ^
gmake[2]: *** [CMakeFiles/system_context.dir/build.make:76: CMakeFiles/system_context.dir/src/system_context/system_context.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:967: CMakeFiles/system_context.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
@askraskr
Copy link

I've been having the same issue.
and NOT just with GCC 14. Tried it with GCC 11, 12, and also 13, and still failed
Can anyone help?

@emmett2020
Copy link
Contributor

emmett2020 commented Aug 29, 2024

Hi, I recently tried to solve this problem. This should be caused by a problem with the gcc compiler replacing non-type template arguments with lambda expressions.

When constructing sender expressions, __descriptor_fn_v 's second template argument is a lambda expression. Relevant code.

    template <
      class _Descriptor,
      auto _DescriptorFn =
        [] {
          return _Descriptor();
        }>
    inline constexpr auto __descriptor_fn_v = _DescriptorFn;

Unfortunately, gcc 14.0 has problems replacing template non-type arguments with lambda expressions. Here is the gcc report
You can focus on the first case in this link. When you install gcc using apt on Ubuntu Noble, gcc version 14.0.1 is installed by default. So we didn't construct the sender type correctly. So we can't pass the enable_sender concept assert.

Back to version 13 resolves this issue. Upgrading gcc to version 14.2 might also fix the problem (I didn't verify it, but the repot listing above mentions that gcc version 14.2 fixes the problem). Also, I will try to submit a merge request as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants