Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

c++ - Compilation errors when building Boost Beast example websocket_server_sync

I am trying to build Boost with websocket-server-sync example from Boost Beast examples. Firstly I would like to say that I'm building on Windows 10 with MSVS 2017 Professional Version 15.3.5 with SDK version 10.0.14393.0. The steps which I took to build the Boost were following:

First I started of course bootstrap.cmd and then I run the .2 variant=release variant=debug link=static threading=multi address-model=64 for building static Boost libraries. Running these two steps was success.

The next step was to setup Visual Studio solution for running the Boost Beast examples. To be able to do this I needed to invoke cmake bulding system. So I created build folder in libseast and ran the command cmake -G "Visual Studio 15 2017 Win64" .. which created the needed solution for Visual Studio. The cmake process was succesfull. Here the log:

-- Selecting Windows SDK version 10.0.14393.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.11.25508.2
-- The CXX compiler identification is MSVC 19.11.25508.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/winapp/MSVS2017PRO/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/winapp/MSVS2017PRO/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: optimized;C:/drive_d/programming/projects/cpp/3rdparty/external/lib/libcrypto.lib;debug;C:/drive_d/programming/projects/cpp/3rdparty/external/lib/libcryptod.lib (found version "1.1.0i")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/drive_d/programming/projects/cpp/3rdparty/boost_1_75_0/libs/beast/build

I started the solution in my Visual Studio and tried to build the project "websocket-server-sync" (Configuration: Debug | Platform: x64) and got the following errors:

...
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/buffer_traits.hpp(123): error C2668: 'boost::asio::buffer_sequence_begin': ambiguous call to overloaded function
...
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/impl/buffers_cat.hpp(127): error C3546: '...': there are no parameter packs available to expand
...

The whole Visual Studio build output is below. From the log it can be seen that the errors happen in lib-beast and websocket-server-sync projects (websocket-server-sync is depending on lib-beast and lib-asio projects which are included in the solution):

1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Checking Build System
2>------ Rebuild All started: Project: lib-asio, Configuration: Debug x64 ------
2>Building Custom Rule C:/drive_d/programming/projects/cpp/3rdparty/boost_1_75_0/libs/beast/CMakeLists.txt
2>lib_asio.cpp
2>lib-asio.vcxproj -> C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0libseastuildDebuglib-asio.lib
3>------ Rebuild All started: Project: lib-beast, Configuration: Debug x64 ------
3>Building Custom Rule C:/drive_d/programming/projects/cpp/3rdparty/boost_1_75_0/libs/beast/CMakeLists.txt
3>lib_beast.cpp
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/buffer_traits.hpp(123): error C2668: 'boost::asio::buffer_sequence_begin': ambiguous call to overloaded function
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/buffer.hpp(399): note: could be 'const boost::asio::const_buffer *boost::asio::buffer_sequence_begin<add_rvalue_reference<_Ty>::type>(const ConstBuffer &,enable_if<std::is_convertible<const add_rvalue_reference<_Ty>::type*,const boost::asio::const_buffer*>::value,void>::type *) noexcept'
3>        with
3>        [
3>            _Ty=const unknown-type &,
3>            ConstBuffer=add_rvalue_reference<const unknown-type&>::type
3>        ]
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/buffer.hpp(389): note: or       'const boost::asio::mutable_buffer *boost::asio::buffer_sequence_begin<add_rvalue_reference<_Ty>::type>(const MutableBuffer &,enable_if<std::is_convertible<const add_rvalue_reference<_Ty>::type*,const boost::asio::mutable_buffer*>::value,void>::type *) noexcept'
3>        with
3>        [
3>            _Ty=const unknown-type &,
3>            MutableBuffer=add_rvalue_reference<const unknown-type&>::type
3>        ]
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/buffer_traits.hpp(123): note: while trying to match the argument list '(add_rvalue_reference<_Ty>::type)'
3>        with
3>        [
3>            _Ty=const unknown-type &
3>        ]
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/impl/buffers_cat.hpp(127): note: see reference to alias template instantiation 'buffers_iterator_type<unknown-type>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/http/chunk_encode.hpp(251): note: see reference to class template instantiation 'boost::beast::buffers_cat_view<boost::beast::http::detail::chunk_size,boost::asio::const_buffer,boost::beast::http::chunk_crlf>::const_iterator' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/relationship.hpp(474): note: see reference to class template instantiation 'boost::asio::execution::detail::relationship_t<0>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/outstanding_work.hpp(475): note: see reference to class template instantiation 'boost::asio::execution::detail::outstanding_work_t<0>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/occupancy.hpp(123): note: see reference to class template instantiation 'boost::asio::execution::detail::occupancy_t<0>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/mapping.hpp(604): note: see reference to class template instantiation 'boost::asio::execution::detail::mapping_t<0>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/context.hpp(130): note: see reference to class template instantiation 'boost::asio::execution::detail::context_t<0>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/bulk_guarantee.hpp(687): note: see reference to class template instantiation 'boost::asio::execution::detail::bulk_guarantee_t<0>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/blocking_adaptation.hpp(663): note: see reference to class template instantiation 'boost::asio::execution::detail::blocking_adaptation_t<0>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/blocking.hpp(836): note: see reference to class template instantiation 'boost::asio::execution::detail::blocking_t<0>' being compiled
3>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/impl/buffers_cat.hpp(127): error C3546: '...': there are no parameter packs available to expand
3>Done building project "lib-beast.vcxproj" -- FAILED.
4>------ Rebuild All started: Project: websocket-server-sync, Configuration: Debug x64 ------
4>Building Custom Rule C:/drive_d/programming/projects/cpp/3rdparty/boost_1_75_0/libs/beast/example/websocket/server/sync/CMakeLists.txt
4>websocket_server_sync.cpp
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/buffer_traits.hpp(123): error C2668: 'boost::asio::buffer_sequence_begin': ambiguous call to overloaded function
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/buffer.hpp(399): note: could be 'const boost::asio::const_buffer *boost::asio::buffer_sequence_begin<add_rvalue_reference<_Ty>::type>(const ConstBuffer &,enable_if<std::is_convertible<const add_rvalue_reference<_Ty>::type*,const boost::asio::const_buffer*>::value,void>::type *) noexcept'
4>        with
4>        [
4>            _Ty=const unknown-type &,
4>            ConstBuffer=add_rvalue_reference<const unknown-type&>::type
4>        ]
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/buffer.hpp(389): note: or       'const boost::asio::mutable_buffer *boost::asio::buffer_sequence_begin<add_rvalue_reference<_Ty>::type>(const MutableBuffer &,enable_if<std::is_convertible<const add_rvalue_reference<_Ty>::type*,const boost::asio::mutable_buffer*>::value,void>::type *) noexcept'
4>        with
4>        [
4>            _Ty=const unknown-type &,
4>            MutableBuffer=add_rvalue_reference<const unknown-type&>::type
4>        ]
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/buffer_traits.hpp(123): note: while trying to match the argument list '(add_rvalue_reference<_Ty>::type)'
4>        with
4>        [
4>            _Ty=const unknown-type &
4>        ]
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/core/impl/buffers_cat.hpp(127): note: see reference to alias template instantiation 'buffers_iterator_type<unknown-type>' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/beast/http/chunk_encode.hpp(251): note: see reference to class template instantiation 'boost::beast::buffers_cat_view<boost::beast::http::detail::chunk_size,boost::asio::const_buffer,boost::beast::http::chunk_crlf>::const_iterator' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/relationship.hpp(474): note: see reference to class template instantiation 'boost::asio::execution::detail::relationship_t<0>' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/outstanding_work.hpp(475): note: see reference to class template instantiation 'boost::asio::execution::detail::outstanding_work_t<0>' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/occupancy.hpp(123): note: see reference to class template instantiation 'boost::asio::execution::detail::occupancy_t<0>' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/mapping.hpp(604): note: see reference to class template instantiation 'boost::asio::execution::detail::mapping_t<0>' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/context.hpp(130): note: see reference to class template instantiation 'boost::asio::execution::detail::context_t<0>' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/bulk_guarantee.hpp(687): note: see reference to class template instantiation 'boost::asio::execution::detail::bulk_guarantee_t<0>' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/blocking_adaptation.hpp(663): note: see reference to class template instantiation 'boost::asio::execution::detail::blocking_adaptation_t<0>' being compiled
4>C:drive_dprogrammingprojectscpp3rdpartyoost_1_75_0oost/asio/execution/blocking.hpp(836): note: see reference to class template instantiation 'boost::asio::execution::detail::blocking_t<0>' be

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I have also post this question on Github page of the Boost Beast project and I got an answer from one of the maintainers that it is hard to compile the Boost Beast example projects because of bugs in the older versions of MSVS 2017 itself (see link to the answer of my question). The conclusion was that it is better to go with MSVS 2019 which is more reliable and compile it over there.

I have also tried it to compile it with MSVS 2019 and it works.

In case you can not change MSVS version then you should contact maintainers to help you with the problem. For me the information that my version of MSVS 2017 (not the latest MSVS 2017 version) has problems compiling Beast was good enough.

Update:

Regarding usage of MSVS 2017 for building of Boost Beast is that with the latest version of MSVS 2017 it should work (link here).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...