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

Examples fail to build with Boost 1.74 #78

Closed
sdebionne opened this issue Aug 26, 2020 · 5 comments · Fixed by #79
Closed

Examples fail to build with Boost 1.74 #78

sdebionne opened this issue Aug 26, 2020 · 5 comments · Fixed by #79

Comments

@sdebionne
Copy link
Contributor

It looks like v1.2.0 is not compatible with ASIO that comes with Boost 1.74, or is there any flags that should be set when configuring ?

In file included from /home/debionne/dev/boost/boost_1_74_0/boost/asio/executor.hpp:342,
                 from /home/debionne/dev/boost/boost_1_74_0/boost/asio.hpp:86,
                 from /home/debionne/dev/cli/include/cli/detail/newboostasio.h:33,
                 from /home/debionne/dev/cli/include/cli/detail/boostasio.h:43,
                 from /home/debionne/dev/cli/include/cli/cliasyncsession.h:34,
                 from /home/debionne/dev/cli/examples/asyncsession.cpp:30:
/home/debionne/dev/boost/boost_1_74_0/boost/asio/impl/executor.hpp: In instantiation of ‘void boost::asio::executor::impl<...> >’ has no member named ‘on_work_started’
     executor_.on_work_started();
     ~~~~~~~~~~^~~~~~~~~~~~~~~
@daniele77
Copy link
Owner

You're right, @sdebionne . This is actually a bug: the library does not compile with the new version of boost (1.74).

@sdebionne
Copy link
Contributor Author

OK I'll look into it.

@sdebionne
Copy link
Contributor Author

From the release notes:

The any_io_executor type alias has been introduced as the new default runtime-polymorphic executor for all I/O objects. This type alias points to the execution::any_executor<> template with a set of supportable properties specified for use with I/O. This change may break existing code that directly uses the old polymorphic wrapper, executor. If required for backward compatibility, BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT can be defined, which changes the any_io_executor type alias to instead point to the executor polymorphic wrapper.

@inetknght
Copy link

I encountered this same compiler error message in an unrelated separate project. This issue showed up in search results while trying to find a solution so it's possible others will find their way here too.

I wrote something on StackOverflow detailing what I came up with. From what I can tell, errors related to boost_1_74_0/boost/asio/impl/executor.hpp: In instantiation of ‘void boost::asio::executor::impl<...> >’ has no member named ‘on_work_started’ are because of Asio's migration to for the Proposed Standard Executors which was committed to Boost 1.74.0 which cause breaking changes to things using the old executor. One (temporary?) solution is what you've already done.

The project I modified was very small and simply changing all instances of executor to any_io_executor did the trick without necessitating the BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT flag.

Consider this demonstration of your error in a small contrived example and this fix.

@daniele77
Copy link
Owner

Thank you very much, @inetknght ! Your comment helped me to remove the temporary solution (i.e., define the symbol BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) and use any_io_executor instead.
I created the issue #89 (remove the symbol BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) and just fix it in commit 29fef14.

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

Successfully merging a pull request may close this issue.

3 participants