Open kinju opened 9 years ago
I tried with Boost 1.55, it compiles, but not with Boost 1.58
Did you find a solution to compile pion with boost 1.59 at the end? (in VS2013/2015)
@HouseHo Not sure that it requires any solution. I've just successfully built master branch with Boost 1.62 on Windows 10/Visual Studio 2015 64 bit/CMake 3.8.0-rc4 What exactly the issue you've observed?
@snikulov Privet, I was compiling in the following environment
Both tcp_server.cpp and http_server.cpp give C2664. For instance server::handle_connection() has a call to boost::bind() where a parameter has casting problem.
void server::handle_connection(tcp::connection_ptr& tcp_conn)
{
request_reader_ptr my_reader_ptr;
my_reader_ptr = request_reader::create(tcp_conn, boost::bind(&server::handle_request,
this, _1, _2, _3));
my_reader_ptr->set_max_content_length(m_max_content_length);
my_reader_ptr->receive();
}
This gives
Severity Code Description Project File Line Error C2664 'void boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>::operator ()(T *,A1,A2,A3) const': cannot convert argument 2 from 'const pion::http::request_ptr' to 'boost::shared_ptr<pion::http::request> &' pion C:\app\boost-1.59.0\boost\bind\bind.hpp 459
Other related code of interested.
//request_reader.hpp
static inline boost::shared_ptr<request_reader>
create(tcp::connection_ptr& tcp_conn, finished_handler_t handler){...}
//http_server.cpp
void server::handle_request(http::request_ptr& http_request_ptr,
tcp::connection_ptr& tcp_conn, const boost::system::error_code& ec){...}
//boost/bind/bind.hpp
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
}
@HouseHo Have you used CMake?
No, I didn't use cmake... I'm in the process to migrate a legacy solution from VS2008 to VS2015, where pion is added as a project inside the VS build.
Is cmake the only way to go?
Thanks for the quick response :D
Try build it using CMake
git clone https://github.com/splunk/pion.git cd pion/build cmake .. -G"Visual Studio 14 Win64" -DBOOST_ROOT= < path to boost root > cmake --build . --config Release
Tried first on my old version of pion 5.0.6, I reached the same problem.
C:\_path\boost-1.59.0\boost/bind/bind.hpp(315): error C2664: 'void boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::c onnection_ptr &>::operator ()(T *,A1) const': cannot convert argument 2 from 'const boost::shared_ptr<T>' to 'boost::sh ared_ptr<T> &' [E:\Users\myName\_del_pion-5.0.6\build\src\pion.vcxproj]
Then trying with the head git checkout, but there seems to be a problem with cmake 3.8.0-rc4. A mention of cmake_policy new vs old.
CMake Warning (dev) at cmake/PionUtils.cmake:42 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like "MSVC" will no longer be dereferenced when the policy
is set to NEW. Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
CMakeLists.txt:30 (pion_update_compilation_opts)
This warning is for project developers. Use -Wno-dev to suppress it.
Clarification:
cmake .. -G"Visual Studio 14 2015" -DBOOST_ROOT=C:/_path/boost-1.59.0/stage/lib/win32 -DOPENSSL_ROOT_DIR=E:/_path/OpenSSL-1.0.2d -DZLIB_INCLUDE_DIR=E:/_path/zlib-1.2.11/include -DZLIB_LIBRARY=E:/_path/zlib-1.2.11/lib/win32/ZlibStatRelease/zlibstat.lib -DZLIB_ROOT=E:/_path/zlib-1.2.11 -DLOG4CPLUS_ROOT=E:/_path/log4cplus
cmake --build . --config Release
@HouseHo Could you please try master branch? I suspect this issue was fixed here https://github.com/splunk/pion/commit/6425c644949790abf44f67ac78852e22a61ede2d
Update: The main branch works with VS2015/boost 1.59. And I see the solution to the C2664 for my old version of pion, basically a dozen of method and functions need to have their parameters declared as const as in the head branch.
Thanks for the support.
I tried to compile with VS 2013 and I get these errors :
1>------ Build started: Project: pion, Configuration: Debug_DLL_full Win32 ------ 1> 1 fichier(s) copié(s). 1> tcp_server.cpp 1>C:\boost\include\boost-1_58\boost/bind/bind.hpp(313): error C2664: 'void boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>::operator ()(T ,A1) const' : cannot convert argument 2 from 'const boost::shared_ptr' to 'boost::shared_ptr '
1> with
1> [
1> T=pion::tcp::server
1> , A1=pion::tcp::connection_ptr &
1> ]
1> and
1> [
1> T=pion::tcp::connection
1> ]
1> and
1> [
1> T=pion::tcp::connection
1> ]
1> Conversion loses qualifiers
1> C:\boost\include\boost-1_58\boost/bind/bind.hpp(905) : see reference to function template instantiation 'void boost::_bi::list2boost::_bi::value<T,boost::arg<1>>::operator ()<F,boost::_bi::list1<const boost::shared_ptr &>>(boost::_bi::type,F &,A &,int)' being compiled
1> with
1> [
1> T=pion::tcp::server
1> , F=boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>
1> , A=boost::_bi::list1<const boost::shared_ptr &>
1> ]
1> C:\boost\include\boost-1_58\boost/bind/bind.hpp(905) : see reference to function template instantiation 'void boost::_bi::list2boost::_bi::value<T,boost::arg<1>>::operator ()<F,boost::_bi::list1<const boost::shared_ptr &>>(boost::_bi::type,F &,A &,int)' being compiled
1> with
1> [
1> T=pion::tcp::server
1> , F=boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>
1> , A=boost::_bi::list1<const boost::shared_ptr &>
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(159) : see reference to function template instantiation 'void boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2boost::_bi::value<T,boost::arg<1>>>::operator ()boost::shared_ptr(A1 &&)' being compiled
1> with
1> [
1> T=pion::tcp::server
1> , A1=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(159) : see reference to function template instantiation 'void boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2boost::_bi::value<T,boost::arg<1>>>::operator ()boost::shared_ptr(A1 &&)' being compiled
1> with
1> [
1> T=pion::tcp::server
1> , A1=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(153) : while compiling class template member function 'void boost::detail::function::void_function_obj_invoker1<FunctionObj,R,T0>::invoke(boost::detail::function::function_buffer &,T0)'
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server >,boost::arg<1>>>
1> , R=void
1> , T0=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(940) : see reference to function template instantiation 'void boost::detail::function::void_function_obj_invoker1<FunctionObj,R,T0>::invoke(boost::detail::function::function_buffer &,T0)' being compiled
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server >,boost::arg<1>>>
1> , R=void
1> , T0=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(940) : see reference to class template instantiation 'boost::detail::function::void_function_obj_invoker1<FunctionObj,R,T0>' being compiled
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server >,boost::arg<1>>>
1> , R=void
1> , T0=boost::shared_ptrpion::tcp::connection
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(728) : see reference to function template instantiation 'void boost::function1<void,boost::shared_ptr>::assign_to(Functor)' being compiled
1> with
1> [
1> T=pion::tcp::connection
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server >,boost::arg<1>>>
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(728) : see reference to function template instantiation 'void boost::function1<void,boost::shared_ptr>::assign_to(Functor)' being compiled
1> with
1> [
1> T=pion::tcp::connection
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server >,boost::arg<1>>>
1> ]
1> tcp_server.cpp(183) : see reference to function template instantiation 'boost::function1<void,boost::shared_ptr>::function1<boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2boost::_bi::value<pion::tcp::server,boost::arg<1>>>>(Functor,int)' being compiled
1> with
1> [
1> T=pion::tcp::connection
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server >,boost::arg<1>>>
1> ]
1> tcp_server.cpp(183) : see reference to function template instantiation 'boost::function1<void,boost::shared_ptr>::function1<boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2boost::_bi::value<pion::tcp::server,boost::arg<1>>>>(Functor,int)' being compiled
1> with
1> [
1> T=pion::tcp::connection
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf1<void,pion::tcp::server,pion::tcp::connection_ptr &>,boost::_bi::list2<boost::_bi::value<pion::tcp::server >,boost::arg<1>>>
1> ]
1> http_server.cpp
1>C:\boost\include\boost-1_58\boost/bind/bind.hpp(457): error C2664: 'void boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>::operator ()(T ,A1,A2,A3) const' : cannot convert argument 2 from 'const pion::http::request_ptr' to 'boost::shared_ptrpion::http::request '
1> with
1> [
1> T=pion::http::server
1> , A1=pion::http::request_ptr &
1> , A2=pion::tcp::connection_ptr &
1> , A3=const boost::system::error_code &
1> ]
1> Conversion loses qualifiers
1> C:\boost\include\boost-1_58\boost/bind/bind.hpp(934) : see reference to function template instantiation 'void boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>::operator ()<F,boost::_bi::list3<const boost::shared_ptr &,const boost::shared_ptrpion::tcp::connection &,const boost::system::error_code &>>(boost::_bi::type,F &,A &,int)' being compiled
1> with
1> [
1> T=pion::http::server
1> , F=boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>
1> , A=boost::_bi::list3<const boost::shared_ptr &,const boost::shared_ptrpion::tcp::connection &,const boost::system::error_code &>
1> ]
1> C:\boost\include\boost-1_58\boost/bind/bind.hpp(934) : see reference to function template instantiation 'void boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>::operator ()<F,boost::_bi::list3<const boost::shared_ptr &,const boost::shared_ptrpion::tcp::connection &,const boost::system::error_code &>>(boost::_bi::type,F &,A &,int)' being compiled
1> with
1> [
1> T=pion::http::server
1> , F=boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>
1> , A=boost::_bi::list3<const boost::shared_ptr &,const boost::shared_ptrpion::tcp::connection &,const boost::system::error_code &>
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(159) : see reference to function template instantiation 'void boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>>::operator ()boost::shared_ptr<pion::http::request,boost::shared_ptrpion::tcp::connection,const boost::system::error_code&>(A1 &&,A2 &&,A3)' being compiled
1> with
1> [
1> T=pion::http::server
1> , A1=pion::http::request_ptr
1> , A2=boost::shared_ptrpion::tcp::connection
1> , A3=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(159) : see reference to function template instantiation 'void boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>>::operator ()boost::shared_ptr<pion::http::request,boost::shared_ptrpion::tcp::connection,const boost::system::error_code&>(A1 &&,A2 &&,A3)' being compiled
1> with
1> [
1> T=pion::http::server
1> , A1=pion::http::request_ptr
1> , A2=boost::shared_ptrpion::tcp::connection
1> , A3=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(153) : while compiling class template member function 'void boost::detail::function::void_function_obj_invoker3<FunctionObj,R,T0,T1,T2>::invoke(boost::detail::function::function_buffer &,T0,T1,T2)'
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server >,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> , R=void
1> , T0=pion::http::request_ptr
1> , T1=pion::tcp::connection_ptr
1> , T2=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(940) : see reference to function template instantiation 'void boost::detail::function::void_function_obj_invoker3<FunctionObj,R,T0,T1,T2>::invoke(boost::detail::function::function_buffer &,T0,T1,T2)' being compiled
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server >,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> , R=void
1> , T0=pion::http::request_ptr
1> , T1=pion::tcp::connection_ptr
1> , T2=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(940) : see reference to class template instantiation 'boost::detail::function::void_function_obj_invoker3<FunctionObj,R,T0,T1,T2>' being compiled
1> with
1> [
1> FunctionObj=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server >,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> , R=void
1> , T0=pion::http::request_ptr
1> , T1=pion::tcp::connection_ptr
1> , T2=const boost::system::error_code &
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(728) : see reference to function template instantiation 'void boost::function3<void,pion::http::request_ptr,pion::tcp::connection_ptr,const boost::system::error_code &>::assign_to(Functor)' being compiled
1> with
1> [
1> Functor=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server >,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> ]
1> C:\boost\include\boost-1_58\boost/function/function_template.hpp(728) : see reference to function template instantiation 'void boost::function3<void,pion::http::request_ptr,pion::tcp::connection_ptr,const boost::system::error_code &>::assign_to(Functor)' being compiled
1> with
1> [
1> Functor=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server >,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> ]
1> http_server.cpp(33) : see reference to function template instantiation 'boost::function3<void,pion::http::request_ptr,pion::tcp::connection_ptr,const boost::system::error_code &>::function3<boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>>>(Functor,int)' being compiled
1> with
1> [
1> T=pion::http::server
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server >,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> ]
1> http_server.cpp(33) : see reference to function template instantiation 'boost::function3<void,pion::http::request_ptr,pion::tcp::connection_ptr,const boost::system::error_code &>::function3<boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4boost::_bi::value<T,boost::arg<1>,boost::arg<2>,boost::arg<3>>>>(Functor,int)' being compiled
1> with
1> [
1> T=pion::http::server
1> , Functor=boost::_bi::bind_t<void,boost::_mfi::mf3<void,pion::http::server,pion::http::request_ptr &,pion::tcp::connection_ptr &,const boost::system::error_code &>,boost::_bi::list4<boost::_bi::value<pion::http::server >,boost::arg<1>,boost::arg<2>,boost::arg<3>>>
1> ]
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========