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

Error building cpprestsdk on windows #138

Closed
jwpwh opened this issue Apr 23, 2020 · 2 comments
Closed

Error building cpprestsdk on windows #138

jwpwh opened this issue Apr 23, 2020 · 2 comments

Comments

@jwpwh
Copy link
Contributor

jwpwh commented Apr 23, 2020

I am trying to update to the latest packages and getting a build error in cpprestsdk.

  • Cmake: 3.15
  • VS 2019: 16.4.2
  • Boost: 1_72
  • OpenSSL: 1.1.1g - installed Win64OpenSSL-1_1_1g.exe
  • cpprestsdk: 2.10.15

Cmake command:

cmake .. ^
  -G "Visual Studio 16 2019" -A x64^
  -DCMAKE_INSTALL_PREFIX=%NMOS_LIBS% ^
  -DCPPREST_PPLX_IMPL:STRING="winpplx" ^
  -DCPPREST_EXCLUDE_COMPRESSION=1 ^
  -DCMAKE_CONFIGURATION_TYPES:STRING="Debug;Release" ^
  -DCPPREST_HTTP_LISTENER_IMPL:STRING="asio" ^
  -DCPPREST_HTTP_CLIENT_IMPL:STRING="asio" ^
  -DBoost_USE_STATIC_LIBS:BOOL="1" ^
  -DBOOST_INCLUDEDIR:PATH="%BOOST_INC%" ^
  -DBOOST_LIBRARYDIR:PATH="%BOOST_LIB%" ^
  -DOPENSSL_ROOT_DIR:PATH="%OPENSSL_INSTALL%" ^
  -DWERROR=0 ^
  -DBUILD_SAMPLES:BOOL="0" ^
  -DBUILD_TESTS:BOOL="0"

Running VS 2019 (in admin mode) and building cpprest. Gets the following error messages when compiling ws_client_wspp.cpp

1>ws_client_wspp.cpp
1>E:\projects\wheat_eth_blade4_prototype_nmos\sw\3rdparty\install-nmos\win64\include\boost-1_72\boost/asio/impl/executor.hpp(218,1): error C2678: binary '==': no operator found which takes a left-hand operand of type 'const Executor' (or there is no acceptable conversion)
1>        with
1>        [
1>            Executor=std::reference_wrapper<boost::asio::io_service>
1>        ]
1>E:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\thread(205,24): message : could be 'bool std::operator ==(std::thread::id,std::thread::id) noexcept' [found using argument-dependent lookup]
1>E:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\random(2031,24): message : or       'bool std::operator ==(const std::bernoulli_distribution &,const std::bernoulli_distribution &)' [found using argument-dependent lookup]
1>E:\projects\wheat_eth_blade4_prototype_nmos\sw\3rdparty\install-nmos\win64\include\boost-1_72\boost/asio/impl/executor.hpp(218,1): message : while trying to match the argument list '(const Executor, const Executor)'
1>        with
1>        [
1>            Executor=std::reference_wrapper<boost::asio::io_service>
1>        ]
1>E:\projects\wheat_eth_blade4_prototype_nmos\sw\3rdparty\install-nmos\win64\include\boost-1_72\boost/asio/impl/executor.hpp(213): message : while compiling class template member function 'bool boost::asio::executor::impl<Executor,std::allocator<void>>::equals(const boost::asio::executor::impl_base *) noexcept const'
1>        with
1>        [
1>            Executor=std::reference_wrapper<boost::asio::io_service>
1>        ]
1>E:\projects\wheat_eth_blade4_prototype_nmos\sw\3rdparty\install-nmos\win64\include\boost-1_72\boost/asio/impl/executor.hpp(333): message : see reference to class template instantiation 'boost::asio::executor::impl<Executor,std::allocator<void>>' being compiled
1>        with
1>        [
1>            Executor=std::reference_wrapper<boost::asio::io_service>
1>        ]
1>E:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\xmemory(202): message : see reference to function template instantiation 'boost::asio::executor::executor<_Ty>(Executor)' being compiled
1>        with
1>        [
1>            _Ty=std::reference_wrapper<boost::asio::io_service>,
1>            Executor=std::reference_wrapper<boost::asio::io_service>
1>        ]
1>E:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\memory(1490): message : see reference to function template instantiation 'void std::_Construct_in_place<_Ty,std::reference_wrapper<boost::asio::io_service>>(_Ty &,std::reference_wrapper<boost::asio::io_service> &&) noexcept(false)' being compiled
1>        with
1>        [
1>            _Ty=boost::asio::ip::tcp::socket
1>        ]
1>E:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\memory(1590): message : see reference to function template instantiation 'std::_Ref_count_obj2<_Ty>::_Ref_count_obj2<std::reference_wrapper<boost::asio::io_service>>(std::reference_wrapper<boost::asio::io_service> &&)' being compiled
1>        with
1>        [
1>            _Ty=boost::asio::ip::tcp::socket
1>        ]
1>E:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\memory(1591): message : see reference to function template instantiation 'std::_Ref_count_obj2<_Ty>::_Ref_count_obj2<std::reference_wrapper<boost::asio::io_service>>(std::reference_wrapper<boost::asio::io_service> &&)' being compiled
1>        with
1>        [
1>            _Ty=boost::asio::ip::tcp::socket
1>        ]
1>E:\projects\wheat_eth_blade4_prototype_nmos\sw\3rdparty\cpprestsdk\cpprestsdk-2.10.15\cpprestsdk\Release\libs\websocketpp\websocketpp/transport/asio/security/none.hpp(172): message : see reference to function template instantiation 'std::shared_ptr<websocketpp::transport::asio::basic_socket::connection::socket_type> std::make_shared<boost::asio::ip::tcp::socket,std::reference_wrapper<boost::asio::io_service>>(std::reference_wrapper<boost::asio::io_service> &&)' being compiled
1>E:\projects\wheat_eth_blade4_prototype_nmos\sw\3rdparty\install-nmos\win64\include\boost-1_72\boost/asio/use_future.hpp(139): message : see reference to class template instantiation 'boost::asio::use_future_t<std::allocator<void>>::std_allocator_void' being compiled
1>E:\projects\wheat_eth_blade4_prototype_nmos\sw\3rdparty\install-nmos\win64\include\boost-1_72\boost/asio/use_future.hpp(147): message : see reference to class template instantiation 'boost::asio::use_future_t<std::allocator<void>>' being compiled
1>Done building project "cpprest.vcxproj" -- FAILED.

I have tried this without the asio settings also and the same (or least very similar) error is received.

Any suggestions?

Thanks.

@garethsb
Copy link
Contributor

WebSocket++ 0.8.1 isn't compatible with Boost 1.70+. See #102 for further explanation.

Good news is that the patch has been known for a long time but has been finally merged to master and released as WebSocket++ 0.8.2. Now waiting for cpprestsdk to bump its git submodule commit (there's a PR for that too).

Update the submodule or install WebSocket++ 0.8.2 manually, and all is good.

@jwpwh
Copy link
Contributor Author

jwpwh commented Apr 24, 2020

Thanks. You are the best!

These are the git commands I used in order to get the patch which compiles without errors with Bosst 1.72.

git clone --recurse-submodules --branch v2.10.15 https://github.com/Microsoft/cpprestsdk
git submodule update --init --recursive --remote

Does the dependency information mention that this extra step is needed? It mentions 1.72 but I did not see a mention of the possible negative effects.

Thanks again for the quick response.

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

No branches or pull requests

2 participants