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

cmake build is broken on FreeBSD

VotersStop watchingWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.3
    • None
    • FreeBSD/amd64 10.1-STABLE
      C++ compiler: FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
      Boost 1.55.0
      cmake 3.1.3

    Description

      Cmake build is broken on FreeBSD.

      Among the problems:

      Building the c_glib tests require to specify the Boost include directory

      Building CXX object lib/c_glib/test/CMakeFiles/testgenc_cpp.dir/gen-cpp/ThriftTest.cpp.o
      In file included from /home/marco/src/thrift.marco.hg/thebuild/lib/c_glib/test/gen-cpp/ThriftTest.cpp:7:
      In file included from /home/marco/src/thrift.marco.hg/thebuild/lib/c_glib/test/gen-cpp/ThriftTest.h:10:
      In file included from /home/marco/src/thrift.marco.hg/lib/cpp/src/thrift/TDispatchProcessor.h:22:
      In file included from /home/marco/src/thrift.marco.hg/lib/cpp/src/thrift/TProcessor.h:24:
      In file included from /home/marco/src/thrift.marco.hg/lib/cpp/src/thrift/protocol/TProtocol.h:23:
      In file included from /home/marco/src/thrift.marco.hg/lib/cpp/src/thrift/transport/TTransport.h:23:
      /home/marco/src/thrift.marco.hg/lib/cpp/src/thrift/Thrift.h:45:10: fatal error: 'boost/utility/enable_if.hpp' file not found
      #include <boost/utility/enable_if.hpp>
      

      Compiler complaints about unspecified shared_ptr

      • Compiler is confused by shared_ptr, it wants boost::shared_ptr (same problem for MacOSX, which uses Clang as FreeBSD):
      /home/marco/src/thrift.marco.hg/lib/c_glib/test/testthrifttestclient.cpp:594:5: error: reference to 'shared_ptr' is ambiguous
          shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
          ^
      /usr/include/c++/v1/memory:3750:29: note: candidate found by name lookup is 'std::__1::shared_ptr'
      class _LIBCPP_TYPE_VIS_ONLY shared_ptr
                                  ^
      /usr/local/include/boost/smart_ptr/shared_ptr.hpp:722:36: note: candidate found by name lookup is 'boost::shared_ptr'
          template<class Y> friend class shared_ptr;
      

      libevent and TestClient

      Linking CXX executable ../../bin/TestClient
      
      ../../lib/libcrosstestgencpp.a(ThriftTest_types.cpp.o): In function `std::__1::__tree_node_base<void*>*& std::__1::__tree<std::__1::__value_type<thrift::test::Insanity, 
      ...
      /home/marco/src/thrift.marco.hg/thebuild/test/cpp/gen-cpp/ThriftTest_types.cpp:
      ...
      undefined reference to `thrift::test::Insanity::operator<(thrift::test::Insanity const&) const'
      

      It seems that Clang and gcc (compliers or linkers, haven't investigated) have a slightly different behavior as below:

      On FreeBSD:

      codino% for i in lib/*.a; do echo $i; nm --demangle $i | grep 'Insanity::operator<'; done
      lib/libcrossstressgencpp.a
      lib/libcrosstestgencpp.a
                       U thrift::test::Insanity::operator<(thrift::test::Insanity const&) const
      lib/liblibparse.a
      lib/libtestgenc.a
      lib/libtestgenc_cpp.a
                       U thrift::test::Insanity::operator<(thrift::test::Insanity const&) const
      lib/libtestgencpp.a
                       U thrift::test::Insanity::operator<(thrift::test::Insanity const&) const
      0000000000000000 T thrift::test::Insanity::operator<(thrift::test::Insanity const&) const
      lib/libtestgencpp_cob.a
      lib/libthrift.a
      lib/libthrift_c_glib.a
      lib/libthriftnb.a
      lib/libthriftz.a
      

      On Linux:

      for i in lib/*.a; do echo $i; nm --demangle $i | grep 'Insanity::operator<'; done
      lib/libcrossstressgencpp.a
      lib/libcrosstestgencpp.a
      lib/liblibparse.a
      lib/libtestgencpp.a
                       U thrift::test::Insanity::operator<(thrift::test::Insanity const&) const
      0000000000000000 T thrift::test::Insanity::operator<(thrift::test::Insanity const&) const
      lib/libtestgencpp_cob.a
      lib/libthrift.a
      lib/libthriftnb.a
      lib/libthriftz.a
      

      Function Insanity::operator< is defined in two indentical files:

      lib/cpp/test/ThriftTest_extras.cpp
      test/cpp/src/ThriftTest_extras.cpp
      

      Solved by adding ThriftTest_extras.cpp also to library crosstestgencpp. Tested on Linux, no complaints.

      Upcoming pull request.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            marco.molteni Marco Molteni
            Votes:
            0 Vote for this issue
            Watchers:
            3 Stop watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment