On Aug 5, 2009, at 12:23 AM, Jonathan Stoppani wrote:

Hi All,
I'm triyng to install thrift on my PowerMac G5 (OS X 10.5.7) but I'm
getting the following errors:

   src/protocol/TCompactProtocol.cpp: In member function 'virtual
uint32_t apache::thrift::protocol::TCompactProtocol::writeDouble(double)':
   src/protocol/TCompactProtocol.cpp:217: error: 'htolell' was not
declared in this scope
   src/protocol/TCompactProtocol.cpp: In member function 'virtual
uint32_t apache::thrift::protocol::TCompactProtocol::readDouble(double&)':
   src/protocol/TCompactProtocol.cpp:582: error: 'letohll' was not
declared in this scope

Anyone has an idea of why is it happening?

Hi Jonathan,

These macros are defined in lib/cpp/src/protocol/TProtocol.h, but they're (obviously) dependent on the byte order of your machine. I have built Thrift many times under 10.5.7, but I'm on an Intel Mac so I have never built on a PPC machine.

I just compiled TCompactProtocol.cpp after adding #warnings to TProtocol.h that let me know what path was taken through the header definitions. It turns out that I got the definitions at line 134 (the "else" that goes with "# if defined(__GNUC__) && defined(__GLIBC__)"), so I suspect that you see the definitions starting at line 114, which do NOT define htolell or letohll.

This looks like a bug. It can be fixed by adding the proper definitions for the macros. I can't seem to find anything that defines what these do, though, so it's not a slam dunk. If I look at the little endian code, neither of these macros do anything, so I would guess that for your case they should be defined as:

#  define htolell(n) bswap_64(n)
#  define letohll(n) bswap_64(n)

which would agree with what's done at line 111. That gives me confidence. You could try adding these lines after line 124, but I don't know how you verify that they're the correct definitions. (What does htolell mean? Host to Little Endian Long Long?)

Best regards,
Rush

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to