Marco Molteni created THRIFT-3099:
-------------------------------------

             Summary: cmake build is broken on FreeBSD
                 Key: THRIFT-3099
                 URL: https://issues.apache.org/jira/browse/THRIFT-3099
             Project: Thrift
          Issue Type: Bug
    Affects Versions: 1.0
         Environment: 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
            Reporter: Marco Molteni


Cmake build is broken on FreeBSD.

Among the problems:

h4. Building the c_glib tests require to specify the Boost include directory

{noformat}
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>
{noformat}

h4. 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):

{noformat}
/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;
{noformat}

h4. libevent and TestClient

{noformat}
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'
{noformat}

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

On FreeBSD:

{noformat}
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
{noformat}

On Linux:

{noformat}
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
{noformat}

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

{noformat}
lib/cpp/test/ThriftTest_extras.cpp
test/cpp/src/ThriftTest_extras.cpp
{noformat}

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




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to