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

CppRestSDK build broken by boost.asio #1302

Open
NAThompson opened this issue Jan 2, 2020 · 1 comment
Open

CppRestSDK build broken by boost.asio #1302

NAThompson opened this issue Jan 2, 2020 · 1 comment

Comments

@NAThompson
Copy link

NAThompson commented Jan 2, 2020

Building off commit 96e7d20 of cpprestsdk and boost.asio commit 95f7e93, CppRestSDK does not compile, due to the following error

                 from /cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:14:
/boost/boost/asio/impl/executor.hpp: In instantiation of ‘boost::asio::execution_context& boost::asio::executor::impl< <template-parameter-1-1>, <template-parameter-1-2> >::context() [with Executor = std::reference_wrapper<boost::asio::io_context>; Allocator = std::allocator<void>]’:
/learn_cpprestsdk/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:844:1:   required from here
/boost/boost/asio/impl/executor.hpp:179:22: error: ‘class std::reference_wrapper<boost::asio::io_context>’ has no member named ‘context’
     return executor_.context();
            ~~~~~~~~~~^~~~~~~
/boost/boost/asio/impl/executor.hpp: In instantiation of ‘void boost::asio::executor::impl< <template-parameter-1-1>, <template-parameter-1-2> >::on_work_started() [with Executor = std::reference_wrapper<boost::asio::io_context>; Allocator = std::allocator<void>]’:
/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:844:1:   required from here
/boost/boost/asio/impl/executor.hpp:169:15: error: ‘class std::reference_wrapper<boost::asio::io_context>’ has no member named ‘on_work_started’
     executor_.on_work_started();
     ~~~~~~~~~~^~~~~~~~~~~~~~~

git bisect reveals that the commit in boost.asio which breaks this library is:

 git bisect good
59066d80b26e1d5b83b60d127ee17948d9ae9702 is the first bad commit
commit 59066d80b26e1d5b83b60d127ee17948d9ae9702
Author: Christopher Kohlhoff <[email protected]>
Date:   Sun Feb 17 19:29:45 2019 -1000

    Add custom I/O executor support to I/O objects.
    
    All I/O objects now have an additional Executor template parameter. This
    template parameter defaults to the asio::executor type (the polymorphic
    executor wrapper) but can be used to specify a user-defined executor
    type.
    
    I/O objects' constructors and functions that previously took an
    asio::io_context& now accept either an Executor or a reference to a
    concrete ExecutionContext (such as asio::io_context or
    asio::thread_pool).
    
    One potential point of breakage in existing user code is when reusing an
    I/O object's io_context for constructing another I/O object, as in:
    
        asio::steady_timer my_timer(my_socket.get_executor().context());
    
    To fix this, either construct the second I/O object using the first I/O
    object's executor:
    
        asio::steady_timer my_timer(my_socket.get_executor());
    
    or otherwise explicitly pass the io_context:
    
        asio::steady_timer my_timer(my_io_context);

Forgive me for not knowing if this should be submitted against boost.asio or this repo.

Ubuntu 16.04,

 g++ --version
g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
@garethsb
Copy link
Contributor

garethsb commented Jan 5, 2020

Root cause is the API change in Boost.Asio, which affects websocketpp (and a gazillion other people). There has been a patch for websocketpp for six months (zaphoyd/websocketpp#814) but although it's been merged to 'develop' branch it hasn't made it into 'master' or a release unfortunately.

garethsb referenced this issue Feb 27, 2020
* websocketpp appears a lost cause, disable websockets for Android

Also fixes #1333 as a drive-by :)
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

2 participants