Reputation: 546
I trying to compile x64 version of thrift in Visual Studio 2012.
I successfully compiled it's dependency, libevent (cmake with VS 11 Win64 code generator).
As for boost I used precompiled binary boost_1_55_0-msvc-11.0-64.exe (version 1.55.0_build2, Visual C++ 2012 x64 compiler).
Then I changed C++ folder in project settings:
Include folders:
Libraries folders:
Then after I start compilation project libthrift (inside lib\cpp\ subfolder) I got following output:
1>------ Build started: Project: libthrift, Configuration: Debug x64 ------
1> WinFcntl.cpp
1> TWinsockSingleton.cpp
1> SocketPair.cpp
1> GetTimeOfDay.cpp
1> TTransportUtils.cpp
1> TTransportException.cpp
1> TSocket.cpp
1> TSimpleFileTransport.cpp
1> TServerSocket.cpp
1> TPipeServer.cpp
1> TPipe.cpp
1> THttpTransport.cpp
1> THttpServer.cpp
1>src\thrift\transport\THttpServer.cpp(95): warning C4267: 'argument' : conversion from 'size_t' to 'uint32_t', possible loss of data
1> THttpClient.cpp
1> TFileTransport.cpp
1> TFDTransport.cpp
1> TBufferTransports.cpp
1> Thrift.cpp
1> TApplicationException.cpp
1> TThreadPoolServer.cpp
1> Generating Code...
1> Compiling...
1> TSimpleServer.cpp
1> TJSONProtocol.cpp
1> TDenseProtocol.cpp
1> TDebugProtocol.cpp
1> TBase64Utils.cpp
1> PeekProcessor.cpp
1>c:\local\boost_1_55_0\boost/smart_ptr/shared_ptr.hpp(653): error C2668: '_wassert' : ambiguous call to overloaded function
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\assert.h(28): could be 'void _wassert(const wchar_t *,const wchar_t *,unsigned int)'
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\assert.h(28): or 'void apache::thrift::protocol::_wassert(const wchar_t *,const wchar_t *,unsigned int)'
1> while trying to match the argument list '(const wchar_t [8], const wchar_t [53], int)'
1> c:\local\boost_1_55_0\boost/smart_ptr/shared_ptr.hpp(652) : while compiling class template member function 'apache::thrift::transport::TTransport *boost::shared_ptr<T>::operator ->(void) const'
1> with
1> [
1> T=apache::thrift::transport::TTransport
1> ]
1> D:\Downloads\chrome\!source\thrift-0.9.1\lib\cpp\src\thrift/transport/TBufferTransports.h(231) : see reference to function template instantiation 'apache::thrift::transport::TTransport *boost::shared_ptr<T>::operator ->(void) const' being compiled
1> with
1> [
1> T=apache::thrift::transport::TTransport
1> ]
1> D:\Downloads\chrome\!source\thrift-0.9.1\lib\cpp\src\thrift/transport/TTransport.h(262) : see reference to class template instantiation 'boost::shared_ptr<T>' being compiled
1> with
1> [
1> T=apache::thrift::transport::TTransport
1> ]
1> Util.cpp
1> TimerManager.cpp
1> ThreadManager.cpp
1> BoostThreadFactory.cpp
1>src\thrift\concurrency\BoostThreadFactory.cpp(101): error C2664: 'std::thread::id::id(const std::thread &)' : cannot convert parameter 1 from 'boost::thread::id' to 'const std::thread &'
1> Reason: cannot convert from 'boost::thread::id' to 'const std::thread'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>src\thrift\concurrency\BoostThreadFactory.cpp(165): error C2664: 'std::thread::id::id(const std::thread &)' : cannot convert parameter 1 from 'boost::thread::id' to 'const std::thread &'
1> Reason: cannot convert from 'boost::thread::id' to 'const std::thread'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1> BoostMutex.cpp
1> BoostMonitor.cpp
1> TAsyncChannel.cpp
1> Generating Code...
First error says that while processing PeekProcessor.cpp there two ambiguous calls of _wassert function. _wassert contructed from BOOST_ASSERT macro inside boost' shared_ptr arrow operator. Second signature "void apache::thrift::protocol::_wassert(const wchar_t *,const wchar_t *,unsigned int)" looks like shared_ptr.h was included inside apache::thrift::protocol but I could not find where.
Can someone suggest how to correct this error?
Can someone tell what is two last errors and how to correct them?
Upvotes: 1
Views: 2991
Reputation: 2834
In Thrift 0.10.0, the code has been updated and don't see this error anymore. The build on Windows is also better managed with CMake, though the VS project files still exist.
See Apache Thrift on Windows for build steps.
Upvotes: 0
Reputation: 46
TProtocol.h
namespace apache { namespace thrift { namespace protocol {
using apache::thrift::transport::TTransport;
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifndef __THRIFT_BYTE_ORDER
# if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
# define __THRIFT_BYTE_ORDER BYTE_ORDER
# define __THRIFT_LITTLE_ENDIAN LITTLE_ENDIAN
# define __THRIFT_BIG_ENDIAN BIG_ENDIAN
# else
# include <boost/config.hpp>
# include <boost/detail/endian.hpp>
# define __THRIFT_BYTE_ORDER BOOST_BYTE_ORDER
# ifdef BOOST_LITTLE_ENDIAN
# define __THRIFT_LITTLE_ENDIAN __THRIFT_BYTE_ORDER
# define __THRIFT_BIG_ENDIAN 0
# else
# define __THRIFT_LITTLE_ENDIAN 0
# define __THRIFT_BIG_ENDIAN __THRIFT_BYTE_ORDER
# endif
# endif
#endif
to:
# include <boost/config.hpp>
# include <boost/detail/endian.hpp>
namespace apache { namespace thrift { namespace protocol {
using apache::thrift::transport::TTransport;
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifndef __THRIFT_BYTE_ORDER
# if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
# define __THRIFT_BYTE_ORDER BYTE_ORDER
# define __THRIFT_LITTLE_ENDIAN LITTLE_ENDIAN
# define __THRIFT_BIG_ENDIAN BIG_ENDIAN
# else
# define __THRIFT_BYTE_ORDER BOOST_BYTE_ORDER
# ifdef BOOST_LITTLE_ENDIAN
# define __THRIFT_LITTLE_ENDIAN __THRIFT_BYTE_ORDER
# define __THRIFT_BIG_ENDIAN 0
# else
# define __THRIFT_LITTLE_ENDIAN 0
# define __THRIFT_BIG_ENDIAN __THRIFT_BYTE_ORDER
# endif
# endif
#endif
Upvotes: 0