On 01/-10/-28163 08:59 PM, Gautam Thaker wrote:
On 7/2/2011 4:56 AM, Roger Meier wrote:
Hi Gautam

I cannot reproduce that isse on my Debian Squeeze using  g++ 4.4.5.
What happens when you add a -Wall compile flag to the Makefile ?


I have confirmed that gcc-4.6.0 and the latest gcc-4.6.1 have this
problem. Also, I built gcc-4.5.3, it DOES NOT have any problems.

As for using the "-Wall" flag, i have copied the output below  - it
shows some warning but nothing related to UNDEFs for VERSION_1 and
VERSION_MASK.

I suspect some new C++ standard rule must be in gcc-4.6.x series and
this may lead to name space issues. But I don't know the thrift stuff
well enough to quite figure this out in limited time I have spent on it.

Gautam

Hi Gautam and all,

I have the same issue: when compiling a thrift client with g++ 4.6.1 (debian testing) and the latest thrift from the subversion, i get messages about undefined references to VERSION_1 and VERSION_MASK

For example:

/usr/local/include/thrift/protocol/TBinaryProtocol.tcc:35: undefined reference to `apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'

I know this particular client was compiling correctly 1 year ago (with a different gcc and thrift version).

But isn't it normal that the linker complains? since VERSION_1 and VERSION_MASK are *declared* in TBinaryProtocol.h, but never *defined*. I'm far from being a c++ expert, but i think that even if you're allowed to declare a static const integral value in a class header, you're still supposed to define it somewhere so that it exists in an object file?

as you cross-posted on both user and dev mailing list, i also cross-post my answer, not knowing where a discussion may start.

regards,

--
Matthieu

fc15-32>  g++ -Wall -o CppServer -I/home/gthaker/usr/include/thrift
-I/usr/include/boost  -I../gen-cpp -L/h>
../gen-cpp/Calculator.h: In member function 'virtual int32_t
tutorial::CalculatorMultiface::calculate(int32_t, const tutorial::Work&)':
../gen-cpp/Calculator.h:491:3: warning: control reaches end of non-void
function [-Wreturn-type]
../gen-cpp/Calculator.h: In member function 'virtual int32_t
tutorial::CalculatorMultiface::add(int32_t, int32_t)':
../gen-cpp/Calculator.h:480:3: warning: control reaches end of non-void
function [-Wreturn-type]
../gen-cpp/Calculator.h: In member function 'virtual int32_t
tutorial::CalculatorMultiface::calculate(int32_t, const tutorial::Work&)':
../gen-cpp/Calculator.h:491:3: warning: control reaches end of non-void
function [-Wreturn-type]
../gen-cpp/Calculator.h: In member function 'virtual int32_t
tutorial::CalculatorMultiface::add(int32_t, int32_t)':
../gen-cpp/Calculator.h:480:3: warning: control reaches end of non-void
function [-Wreturn-type]
/tmp/ccrEAa1g.o: In function
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::writeMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char>  >  const&,
apache::thrift::protocol::TMessageType, int)':
CppServer.cpp:(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE17writeMessageBeginERKSsNS1_12TMessageTypeEi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::writeMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char>  >  const&,
apache::thrift::protocol::TMessageType, int)]+0x15): undefined reference
to
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'
/tmp/ccrEAa1g.o: In function
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char>  >&,
apache::thrift::protocol::TMessageType&, int&)':
CppServer.cpp:(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE16readMessageBeginERSsRNS1_12TMessageTypeERi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char>  >&,
apache::thrift::protocol::TMessageType&, int&)]+0x33): undefined
reference to
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_MASK'
CppServer.cpp:(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE16readMessageBeginERSsRNS1_12TMessageTypeERi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char>  >&,
apache::thrift::protocol::TMessageType&, int&)]+0x3d): undefined
reference to
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'
collect2: ld returned 1 exit status

Regards
Roger

-----Ursprüngliche Nachricht-----
Von: Gautam Thaker [mailto:gautam.h.tha...@lmco.com]
Gesendet: Dienstag, 28. Juni 2011 21:15
An: d...@thrift.apache.org
Betreff: undefined references to VERSION_MASK and VERSION_1

When compiling the  "cpp" example in "tutorial", i get:

CppServer.o
          U

apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTrans
p
ort>::VERSION_MASK
          U

apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTrans
p
ort>::VERSION_1

I am running on Fedora 15 w/ GCC/G++ 4.6.0. The  ./configure and "make"
and "make install" had gone w/o errors (as far as I could tell.)

Any hints welcome. I tried to google this, but found nothing.

Gautam

Reply via email to