I have Thrift and Scribe built and have passed messages successfully using the example code included in these projects, like the Python scribe_cat file under /scribe-2.0/examples. I am attempting to build my own Scribe C++ client, but I get a hundred different errors when I compile. I am grateful for any help offered.
I'm on Ubuntu 8.04
I've tried compiling using g++ 4.2.4 and g++ 3.4
I'm using Boost 1.37
I'm using Thrift 20080411-r733188
I'm using Scribe 2.0 Scribe version 2.0 Last Update: Oct 29 2008
Here is a snapshot of the first few errors:
g++ -o CppClient -I/usr/local/include/thrift -I/usr/local/include/boost-1_37 -I/usr/local/include/thrift/fb303 -Igen-cpp -L/usr/local/lib -lthrift CppClient.cpp gen-cpp/scribe.cpp
/tmp/ccRkmGTP.o: In function `scribe::thrift::scribeProcessor::process_fn(facebook::thrift::protocol::TProtocol*, facebook::thrift::protocol::TProtocol*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)':
scribe.cpp:(.text+0x14d): undefined reference to `facebook::fb303::FacebookServiceProcessor::process_fn(facebook::thrift::protocol::TProtocol*, facebook::thrift::protocol::TProtocol*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)'
/tmp/ccRkmGTP.o: In function `scribe::thrift::scribe_Log_pargs::write(facebook::thrift::protocol::TProtocol*) const':
scribe.cpp:(.text+0xcac): undefined reference to `scribe::thrift::LogEntry::write(facebook::thrift::protocol::TProtocol*) const'
/tmp/ccRkmGTP.o: In function `scribe::thrift::scribe_Log_args::write(facebook::thrift::protocol::TProtocol*) const':
scribe.cpp:(.text+0x1014): undefined reference to `scribe::thrift::LogEntry::write(facebook::thrift::protocol::TProtocol*) const'
/tmp/ccRkmGTP.o: In function `scribe::thrift::scribe_Log_args::read(facebook::thrift::protocol::TProtocol*)':
scribe.cpp:(.text+0x11d9): undefined reference to `scribe::thrift::LogEntry::read(facebook::thrift::protocol::TProtocol*)'
/tmp/ccRkmGTP.o: In function `facebook::fb303::FacebookServiceClient::~FacebookServiceClient()':
I'm not sure what is causing this error. However, I was able to build your CppClient.cpp by copying all of scribe's makefiles over and editing Makefile.am to just build cppclient.cpp instead of scribe's cpp files. If you don't mind running bootstrap.sh/configure.sh to build, then this should work for you.
-Anthony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have Thrift and Scribe built and have passed messages successfully using the example code included in these projects, like the Python scribe_cat file under /scribe-2.0/examples. I am attempting to build my own Scribe C++ client, but I get a hundred different errors when I compile. I am grateful for any help offered.
I'm on Ubuntu 8.04
I've tried compiling using g++ 4.2.4 and g++ 3.4
I'm using Boost 1.37
I'm using Thrift 20080411-r733188
I'm using Scribe 2.0 Scribe version 2.0 Last Update: Oct 29 2008
Here is a snapshot of the first few errors:
g++ -o CppClient -I/usr/local/include/thrift -I/usr/local/include/boost-1_37 -I/usr/local/include/thrift/fb303 -Igen-cpp -L/usr/local/lib -lthrift CppClient.cpp gen-cpp/scribe.cpp
/tmp/ccRkmGTP.o: In function `scribe::thrift::scribeProcessor::process_fn(facebook::thrift::protocol::TProtocol*, facebook::thrift::protocol::TProtocol*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)':
scribe.cpp:(.text+0x14d): undefined reference to `facebook::fb303::FacebookServiceProcessor::process_fn(facebook::thrift::protocol::TProtocol*, facebook::thrift::protocol::TProtocol*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)'
/tmp/ccRkmGTP.o: In function `scribe::thrift::scribe_Log_pargs::write(facebook::thrift::protocol::TProtocol*) const':
scribe.cpp:(.text+0xcac): undefined reference to `scribe::thrift::LogEntry::write(facebook::thrift::protocol::TProtocol*) const'
/tmp/ccRkmGTP.o: In function `scribe::thrift::scribe_Log_args::write(facebook::thrift::protocol::TProtocol*) const':
scribe.cpp:(.text+0x1014): undefined reference to `scribe::thrift::LogEntry::write(facebook::thrift::protocol::TProtocol*) const'
/tmp/ccRkmGTP.o: In function `scribe::thrift::scribe_Log_args::read(facebook::thrift::protocol::TProtocol*)':
scribe.cpp:(.text+0x11d9): undefined reference to `scribe::thrift::LogEntry::read(facebook::thrift::protocol::TProtocol*)'
/tmp/ccRkmGTP.o: In function `facebook::fb303::FacebookServiceClient::~FacebookServiceClient()':
My CppClient.cpp looks like this:
-------------------------------------------
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <protocol/TBinaryProtocol.h>
#include <transport/TSocket.h>
#include <transport/TTransportUtils.h>
#include "gen-cpp/scribe.h"
using namespace std;
using namespace facebook::thrift;
using namespace facebook::thrift::protocol;
using namespace facebook::thrift::transport;
using namespace boost;
int main(int argc, char** argv) {
shared_ptr<TTransport> socket(new TSocket("localhost", 9090));
shared_ptr<TTransport> transport(new TBufferedTransport(socket));
shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
return 0;
}
-------------------------------------------
My gen-cpp/ directory contains the generated scribe files from scribe-2.0/if/scribe.thrift
My Makefile looks like this:
------------------------------------------------
BOOST_DIR = /usr/local/include/boost-1_37
THRIFT_DIR = /usr/local/include/thrift
LIB_DIR = /usr/local/lib
SCRIBE_INC = /usr/local/include/thrift/fb303
GEN_SRC = gen-cpp/scribe.cpp
default: client
client: CppClient.cpp
g++ -o CppClient -I${THRIFT_DIR} -I${BOOST_DIR} -I${SCRIBE_INC} -Igen-cpp -L${LIB_DIR} -lthrift CppClient.cpp ${GEN_SRC}
Again, any suggestions or debugging pointers would be greatly appreciated.
--Alex
I'm not sure what is causing this error. However, I was able to build your CppClient.cpp by copying all of scribe's makefiles over and editing Makefile.am to just build cppclient.cpp instead of scribe's cpp files. If you don't mind running bootstrap.sh/configure.sh to build, then this should work for you.
-Anthony