Connor Manning created THRIFT-2553:
--------------------------------------
Summary: C++ linker error - transport/TSocket
Key: THRIFT-2553
URL: https://issues.apache.org/jira/browse/THRIFT-2553
Project: Thrift
Issue Type: Bug
Components: C++ - Library
Affects Versions: 0.9.1
Environment: OS X Mavericks. Clang. Thrift 0.9.1 installed via
Homebrew. Patches 2201, 667, 1755, 2045, and 2229 have been applied via the
current default Homebrew formula for 0.9.1.
Reporter: Connor Manning
Trying to create a Thrift project with a C++ client, I could not complete the
linking step. I then distilled my project to very basic functionality assuming
a coding error, and could not link successfully. From there, I started from
scratch with the CPP Tutorial, and have found the same error there. It appears
that transport/TSocket has not successfully been built into the dynamic library.
My thrift file is called sample.thrift and declares a simple service called
"Something", which contains only a ping() method.
My build step looks like:
g++ -lthrift -Wall -I/usr/local/include/thrift -stdlib=libstdc++
Something_client.cpp sample_constants.cpp sample_types.cpp Something.cpp -o
Client
The result looks like:
Undefined symbols for architecture x86_64:
"apache::thrift::transport::TSocket::TSocket(std::string, int)", referenced
from:
_main in Something_client-ca4a8d.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have replicated this error with separate compile/linking steps (as shown in
the client section in http://wiki.apache.org/thrift/ThriftUsageC%2B%2B). The
server compiles and links successfully, and the client compiles, but does not
like. I have also replicated it via the given Makefile.
Aside from the TSocket, the rest of the file compiles and links successfully.
The TBufferedTransport and TBinaryProtocol are linked with no issues when the
TSocket is replaced with a dummy, e.g.:
TSocket* t(0);
boost::shared_ptr<TTransport> socket(t);
Leading me to my conclusion that somehow the TSocket did not make it into my
Thrift library. Are there any suggestions for what could be causing this and
how it could be resolved?
Thank you.
--
This message was sent by Atlassian JIRA
(v6.2#6252)