I actually ran across this a couple of days ago. The issue is that if you don't define specific flags when configuring the project, you won't include the <netinet/in.h> header correctly. Try
% ./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H" % make when you're building thrift / fb303 and hopefully your compile errors will be resolved. cheers, -jw On Tue, Dec 20, 2011 at 6:53 PM, air <[email protected]> wrote: > I compile fb303 on CentOS 5.4, compiling thrift is OK, but when compile > fb303 it reports: > > [root@x00 fb303]# make > make all-recursive > make[1]: Entering directory `/usr/local/src/thrift-0.8.0/contrib/fb303' > Making all in . > make[2]: Entering directory `/usr/local/src/thrift-0.8.0/contrib/fb303' > make[2]: Nothing to be done for `all-am'. > make[2]: Leaving directory `/usr/local/src/thrift-0.8.0/contrib/fb303' > Making all in cpp > make[2]: Entering directory `/usr/local/src/thrift-0.8.0/contrib/fb303/cpp' > /usr/local/bin/thrift -o . -I /usr/local/share --gen cpp:pure_enums > ../if/fb303.thrift > make all-am > make[3]: Entering directory `/usr/local/src/thrift-0.8.0/contrib/fb303/cpp' > if g++ -DPACKAGE_NAME=\"libfb303\" -DPACKAGE_TARNAME=\"libfb303\" > -DPACKAGE_VERSION=\"20080209\" -DPACKAGE_STRING=\"libfb303\ 20080209\" > -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -I. -I. > -I.. -Igen-cpp -I/usr/local/include/thrift -I/usr/include -Wall -O3 -MT > FacebookService.o -MD -MP -MF ".deps/FacebookService.Tpo" -c -o > FacebookService.o `test -f 'gen-cpp/FacebookService.cpp' || echo > './'`gen-cpp/FacebookService.cpp; \ > then mv -f ".deps/FacebookService.Tpo" ".deps/FacebookService.Po"; > else rm -f ".deps/FacebookService.Tpo"; exit 1; fi > if g++ -DPACKAGE_NAME=\"libfb303\" -DPACKAGE_TARNAME=\"libfb303\" > -DPACKAGE_VERSION=\"20080209\" -DPACKAGE_STRING=\"libfb303\ 20080209\" > -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -I. -I. > -I.. -Igen-cpp -I/usr/local/include/thrift -I/usr/include -Wall -O3 -MT > fb303_constants.o -MD -MP -MF ".deps/fb303_constants.Tpo" -c -o > fb303_constants.o `test -f 'gen-cpp/fb303_constants.cpp' || echo > './'`gen-cpp/fb303_constants.cpp; \ > then mv -f ".deps/fb303_constants.Tpo" ".deps/fb303_constants.Po"; > else rm -f ".deps/fb303_constants.Tpo"; exit 1; fi > if g++ -DPACKAGE_NAME=\"libfb303\" -DPACKAGE_TARNAME=\"libfb303\" > -DPACKAGE_VERSION=\"20080209\" -DPACKAGE_STRING=\"libfb303\ 20080209\" > -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -I. -I. > -I.. -Igen-cpp -I/usr/local/include/thrift -I/usr/include -Wall -O3 -MT > fb303_types.o -MD -MP -MF ".deps/fb303_types.Tpo" -c -o fb303_types.o `test > -f 'gen-cpp/fb303_types.cpp' || echo './'`gen-cpp/fb303_types.cpp; \ > then mv -f ".deps/fb303_types.Tpo" ".deps/fb303_types.Po"; else rm > -f ".deps/fb303_types.Tpo"; exit 1; fi > if g++ -DPACKAGE_NAME=\"libfb303\" -DPACKAGE_TARNAME=\"libfb303\" > -DPACKAGE_VERSION=\"20080209\" -DPACKAGE_STRING=\"libfb303\ 20080209\" > -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -I. -I. > -I.. -Igen-cpp -I/usr/local/include/thrift -I/usr/include -Wall -O3 -MT > FacebookBase.o -MD -MP -MF ".deps/FacebookBase.Tpo" -c -o FacebookBase.o > FacebookBase.cpp; \ > then mv -f ".deps/FacebookBase.Tpo" ".deps/FacebookBase.Po"; else > rm -f ".deps/FacebookBase.Tpo"; exit 1; fi > /usr/local/include/thrift/protocol/TBinaryProtocol.tcc: In member function > ‘uint32_t > > apache::thrift::protocol::TBinaryProtocolT<Transport_>::writeI16(int16_t)’: > /usr/local/include/thrift/protocol/TBinaryProtocol.tcc:147: error: there > are no arguments to ‘htons’ that depend on a template parameter, so a > declaration of ‘htons’ must be available > /usr/local/include/thrift/protocol/TBinaryProtocol.tcc:147: error: (if you > use ‘-fpermissive’, G++ will accept your code, but allowing the use of > an undeclared name is deprecated) > /usr/local/include/thrift/protocol/TBinaryProtocol.tcc: In member function > ‘uint32_t > > apache::thrift::protocol::TBinaryProtocolT<Transport_>::writeI32(int32_t)’: > /usr/local/include/thrift/protocol/TBinaryProtocol.tcc:154: error: there > are no arguments to ‘htonl’ that depend on a template parameter, so a > declaration of ‘htonl’ must be available > make[3]: *** [FacebookBase.o] Error 1 > make[3]: Leaving directory `/usr/local/src/thrift-0.8.0/contrib/fb303/cpp' > make[2]: *** [all] Error 2 > make[2]: Leaving directory `/usr/local/src/thrift-0.8.0/contrib/fb303/cpp' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/usr/local/src/thrift-0.8.0/contrib/fb303' > make: *** [all] Error 2 > > what caused this, thank you for your help in advance ! > > -- > Knowledge Mangement . >
