Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2553

C++ linker error - transport/TSocket

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.1
    • Fix Version/s: 0.9.1
    • Component/s: C++ - Library
    • 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.

      Description

      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.

        Attachments

        1. Something_client.cpp
          0.9 kB
          Connor Manning
        2. sample.thrift
          0.1 kB
          Connor Manning

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              csmannin Connor Manning
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: