I'm trying to get Protobuf 2.6.0 to compile on an embedded system that uses a customized version of clang as its compiler. The compiler is giving me an error, and after looking at it for a while I think agree with the compiler. After a quick glance it appears that Protobuf 2.6.1 is the same, but I haven't tried it yet.
The error is in once.h, with GOOGLE_PROTOBUF_NO_THREAD_SAFETY defined. The exact error is: In file included from *[snip]* \protobuf-2.6.0\src\google\protobuf\descriptor.cc:45: 1> In file included from ../src\google/protobuf/descriptor.pb.h:22: 1> In file included from ../src\google/protobuf/generated_message_util.h:44: 1>../src\google/protobuf/stubs/once.h(152,4): error : no matching function for call to 'GoogleOnceInit' 1> *[snip]*\protobuf-2.6.0\src\google\protobuf\descriptor.cc(889,26) : note: in instantiation of function template specialization 'google::protobuf::GoogleOnceDynamic::Init<std::pair<const google::protobuf::FileDescriptorTables *, const google::protobuf::SourceCodeInfo *> >' requested here 1> ../src\google/protobuf/stubs/once.h(101,12) : note: candidate function [with Arg = std::pair<const google::protobuf::FileDescriptorTables *, const google::protobuf::SourceCodeInfo *>] not viable: no known conversion from 'void (*)(std::pair<const google::protobuf::FileDescriptorTables *, const google::protobuf::SourceCodeInfo *> *)' to 'void (*)(std::pair<const google::protobuf::FileDescriptorTables *, const google::protobuf::SourceCodeInfo *>)' for 2nd argument At the bottom of the file we can see the function GoogleOnceDynamic::Init. The function takes two parameters: func_with_arg, a function that takes a T*, and secondly arg, which is a T* . In the case of the error above, T is a std::pair of pointers. GoogleOnceDynamic::Init passes func_with_arg and arg to the function GoogleOnceInit<T>. However, GoogleOnceInit is declared as taking a function taking an *actual* T (not a T*), and an *actual* T (again, not a T*). In the case where GOOGLE_PROTOBUF_NO_THREAD_SAFETY is *not* defined, GoogleOnceInit takes a function taking a T*, and a T*. Should the GOOGLE_PROTOBUF_NO_THREAD_SAFETY version of GoogleOnceInit be altered to take T*? Thanks, Peter Pimley -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
