executors icon indicating copy to clipboard operation
executors copied to clipboard

Compile error OSX 10.13.5. consider adding cmake support?

Open zkSNARK opened this issue 6 years ago • 2 comments

Making all in channel g++ -DPACKAGE_NAME="executors" -DPACKAGE_TARNAME="executors" -DPACKAGE_VERSION="0.1.0" -DPACKAGE_STRING="executors\ 0.1.0" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="executors" -DVERSION="0.1.0" -I. -std=c++1y -Wno-unused-local-typedefs -DEXECUTORS_NO_BOOST=1 -I./../../../include -g -O2 -MT ping.o -MD -MP -MF .deps/ping.Tpo -c -o ping.o ping.cpp In file included from ping.cpp:1: In file included from ./../../../include/experimental/channel:17: In file included from ./../../../include/experimental/executor:498: In file included from ./../../../include/experimental/bits/system_executor.h:21: In file included from ./../../../include/experimental/bits/scheduler.h:26: ./../../../include/experimental/bits/small_block_recycler.h:127:77: error: initializer for thread-local variable must be a constant expression __thread __small_block_recycler<_Purpose> __small_block_recycler<_Purpose>::_S_instance; ^~~~~~~~~~~ ./../../../include/experimental/bits/small_block_recycler.h:101:12: note: in instantiation of static data member 'std::experimental::concurrency_v1::__small_block_recycler::_S_instance' requested here return _S_instance; ^ ./../../../include/experimental/bits/small_block_recycler.h:169:63: note: in instantiation of member function 'std::experimental::concurrency_v1::__small_block_recycler::_Instance' requested here return static_cast<_T*>(__small_block_recycler<_Purpose>::_Instance()._Allocate(__n * sizeof(_T))); ^ ./../../../include/experimental/bits/small_block_recycler.h:259:33: note: in instantiation of member function 'std::experimental::concurrency_v1::__small_block_allocator<std::experimental::concurrency_v1::__scheduler_op<std::experimental::concurrency_v1::__function_ptr, std::experimental::concurrency_v1::__small_block_allocator<void, void> >, void>::allocate' requested here _T* __raw_p = __rebound_alloc.allocate(1); ^ ./../../../include/experimental/bits/scheduler.h:364:13: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::_Allocate_small_block<std::experimental::concurrency_v1::__scheduler_op<std::experimental::concurrency_v1::__function_ptr, std::experimental::concurrency_v1::__small_block_allocator<void, void> >, std::experimental::concurrency_v1::__small_block_allocator<void, void>, std::experimental::concurrency_v1::__function_ptr, const std::experimental::concurrency_v1::__small_block_allocator<void, void> &>' requested here auto __op(_Allocate_small_block<__scheduler_op<_Func, _A>>(__a, forward<_F>(__f), __a)); ^ ./../../../include/experimental/bits/system_executor.h:74:18: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::__scheduler::_Post<std::experimental::concurrency_v1::__function_ptr, std::experimental::concurrency_v1::__small_block_allocator<void, void> >' requested here _M_scheduler._Post(forward<_F>(__f), __a); ^ ./../../../include/experimental/bits/system_executor.h:115:39: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::__system_executor_impl::_Post<std::experimental::concurrency_v1::__function_ptr, std::experimental::concurrency_v1::__small_block_allocator<void, void> >' requested here __system_executor_impl::_Instance()._Post(forward<_Func>(__f), __a); ^ ./../../../include/experimental/bits/executor.h:245:17: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::system_executor::post<std::experimental::concurrency_v1::__function_ptr, std::experimental::concurrency_v1::__small_block_allocator<void, void> >' requested here _M_executor.post(std::move(__f), __small_block_allocator()); ^ ./../../../include/experimental/bits/small_block_recycler.h:127:77: note: use 'thread_local' to allow this __thread __small_block_recycler<_Purpose> __small_block_recycler<_Purpose>::_S_instance; ^ ./../../../include/experimental/bits/small_block_recycler.h:127:77: error: initializer for thread-local variable must be a constant expression __thread __small_block_recycler<_Purpose> __small_block_recycler<_Purpose>::_S_instance; ^~~~~~~~~~~ ./../../../include/experimental/bits/small_block_recycler.h:101:12: note: in instantiation of static data member 'std::experimental::concurrency_v1::__small_block_recyclerstd::experimental::concurrency_v1::__strand_impl::_S_instance' requested here return _S_instance; ^ ./../../../include/experimental/bits/small_block_recycler.h:169:63: note: in instantiation of member function 'std::experimental::concurrency_v1::__small_block_recyclerstd::experimental::concurrency_v1::__strand_impl::_Instance' requested here return static_cast<_T*>(__small_block_recycler<_Purpose>::_Instance()._Allocate(__n * sizeof(_T))); ^ ./../../../include/experimental/bits/small_block_recycler.h:259:33: note: in instantiation of member function 'std::experimental::concurrency_v1::__small_block_allocator<std::experimental::concurrency_v1::__scheduler_op<std::experimental::concurrency_v1::__strand_invokerstd::experimental::concurrency_v1::system_executor, std::experimental::concurrency_v1::__small_block_allocator<void, std::experimental::concurrency_v1::__strand_impl> >, std::experimental::concurrency_v1::__strand_impl>::allocate' requested here _T* __raw_p = __rebound_alloc.allocate(1); ^ ./../../../include/experimental/bits/scheduler.h:400:13: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::_Allocate_small_block<std::experimental::concurrency_v1::__scheduler_op<std::experimental::concurrency_v1::__strand_invokerstd::experimental::concurrency_v1::system_executor, std::experimental::concurrency_v1::__small_block_allocator<void, std::experimental::concurrency_v1::__strand_impl> >, std::experimental::concurrency_v1::__small_block_allocator<void, std::experimental::concurrency_v1::__strand_impl>, std::experimental::concurrency_v1::__strand_invokerstd::experimental::concurrency_v1::system_executor, const std::experimental::concurrency_v1::__small_block_allocator<void, std::experimental::concurrency_v1::__strand_impl> &>' requested here auto __op(_Allocate_small_block<__scheduler_op<_Func, _A>>(__a, forward<_F>(__f), __a)); ^ ./../../../include/experimental/bits/system_executor.h:79:18: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::__scheduler::_Defer<std::experimental::concurrency_v1::__strand_invokerstd::experimental::concurrency_v1::system_executor, std::experimental::concurrency_v1::__small_block_allocator<void, std::experimental::concurrency_v1::__strand_impl> >' requested here _M_scheduler._Defer(forward<_F>(__f), __a); ^ ./../../../include/experimental/bits/system_executor.h:121:39: note: (skipping 11 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all) __system_executor_impl::_Instance()._Defer(forward<_Func>(__f), __a); ^ ./../../../include/experimental/bits/executor_wrapper.h:53:5: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::executor_wrapper<std::experimental::concurrency_v1::__yield_context_launcher<std::experimental::concurrency_v1::executor, (lambda at ping.cpp:40:20), std::experimental::concurrency_v1::__yield_null_continuation>, std::experimental::concurrency_v1::strandstd::experimental::concurrency_v1::system_executor >::executor_wrapper<std::experimental::concurrency_v1::strandstd::experimental::concurrency_v1::system_executor &, (lambda at ping.cpp:40:20)>' requested here : executor_wrapper(forward<_E>(__e), forward<_U>(__u), uses_executor<_T, _Executor>()) ^ ./../../../include/experimental/bits/executor_wrapper.h:33:5: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::executor_wrapper<std::experimental::concurrency_v1::__yield_context_launcher<std::experimental::concurrency_v1::executor, (lambda at ping.cpp:40:20), std::experimental::concurrency_v1::__yield_null_continuation>, std::experimental::concurrency_v1::strandstd::experimental::concurrency_v1::system_executor >::executor_wrapper<std::experimental::concurrency_v1::strandstd::experimental::concurrency_v1::system_executor &, (lambda at ping.cpp:40:20)>' requested here : executor_wrapper(0, __w._M_executor, std::move(__w._M_wrapped)) ^ ./../../../include/experimental/bits/invoker.h:127:7: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::executor_wrapper<std::experimental::concurrency_v1::__yield_context_launcher<std::experimental::concurrency_v1::executor, (lambda at ping.cpp:40:20), std::experimental::concurrency_v1::__yield_null_continuation>, std::experimental::concurrency_v1::strandstd::experimental::concurrency_v1::system_executor >::executor_wrapper<(lambda at ping.cpp:40:20), std::experimental::concurrency_v1::strandstd::experimental::concurrency_v1::system_executor >' requested here : _M_handler(static_cast<_CompletionToken&&>(__token)) ^ ./../../../include/experimental/bits/dispatch.h:30:12: note: in instantiation of member function 'std::experimental::concurrency_v1::__passive_invoker<void (), std::experimental::concurrency_v1::executor_wrapper<(lambda at ping.cpp:40:20), std::experimental::concurrency_v1::strandstd::experimental::concurrency_v1::system_executor > >::__passive_invoker' requested here _Invoker __head(__tokens...); ^ ping.cpp:40:3: note: in instantiation of function template specialization 'std::experimental::concurrency_v1::dispatch<std::experimental::concurrency_v1::executor_wrapper<(lambda at ping.cpp:40:20), std::experimental::concurrency_v1::strandstd::experimental::concurrency_v1::system_executor > >' requested here dispatch(wrap(s, [c](yield_context yield){ pinger(c, yield); })); ^ ./../../../include/experimental/bits/small_block_recycler.h:127:77: note: use 'thread_local' to allow this __thread __small_block_recycler<_Purpose> __small_block_recycler<_Purpose>::_S_instance; ^ 2 errors generated. make[3]: *** [ping.o] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all-recursive] Error 1

zkSNARK avatar Jun 13 '18 03:06 zkSNARK

Same error for me. It's a bit of a pity to be able to work with your proposal if it doesn't even compile on clang7. I can strongly recommend you to use Travis to get some coverage on at least GCC8 on Linux, and clang7 on Linux and OSX so you can say that you support at least posix platforms (windows is a whole other deal of course).

Fohlen avatar Mar 05 '19 20:03 Fohlen

Had the same problem, resolved it with this change. No idea if any other problems will come later.

diff --git a/include/experimental/bits/small_block_recycler.h b/include/experimental/bits/small_block_recycler.h
index 1d48d96..051f314 100644
--- a/include/experimental/bits/small_block_recycler.h
+++ b/include/experimental/bits/small_block_recycler.h
@@ -27,7 +27,7 @@ public:
   __small_block_recycler(const __small_block_recycler&) = delete;
   __small_block_recycler& operator=(const __small_block_recycler&) = delete;
 
-  __small_block_recycler() : _M_memory(nullptr), _M_next_memory(nullptr)
+  constexpr __small_block_recycler() : _M_memory(nullptr), _M_next_memory(nullptr)
   {
   }

Oleksiy-Yakovenko avatar Jan 16 '23 14:01 Oleksiy-Yakovenko