got errors saying conflicting declaration in protobuf/arena.h
I've got these errors saying there is conflicting declaration in protobuf/arena.h. I use Protocol Buffers v3.0.0-beta-1, and install it on Ubuntu 14.04 as
$./autogen.sh
$ ./configure
$ make
$ make check
$ make install
How did these errors occur? like because I did sth wrong during installing protobuf or ...? and how can I fix it?
I got the errors when make all the caffe library from https://github.com/bharath272/caffe-sds which uses protobuf.
Thanks a lot.
/usr/local/include/google/protobuf/arena.h:909:38: error: conflicting declaration ‘const google::protobuf::internal::integral_constant<bool, ((sizeof (DestructorSkippable<const T>(static_cast<const T*>(0))) == sizeof (char)) || (google::protobuf::internal::has_trivial_destructor<A>::value == true))> google::protobuf::Arena::is_destructor_skippable<T>::value’
Arena::is_destructor_skippable<T>::value =
^
/usr/local/include/google/protobuf/arena.h:589:19: error: ‘google::protobuf::Arena::is_destructor_skippable<T>::value’ has a previous declaration as ‘const type google::protobuf::Arena::is_destructor_skippable<T>::value’
static const type value;
^
/usr/local/include/google/protobuf/arena.h:909:38: error: declaration of ‘const type google::protobuf::Arena::is_destructor_skippable<T>::value’ outside of class is not definition [-fpermissive]
Arena::is_destructor_skippable<T>::value =
^
This seems to be the same error as in: https://github.com/google/protobuf/issues/787
Could you try the patch provided by Yangqing and see if it works for you?
Yes, it's the same issue. I tried the patch provided by Yangqing and it works!
Hello Yafangshih, I have the same problem. Could you please explain a little bit more what you did to make protobuf work during caffe compilation. Thank you.
I replace the code between line 576 to 590 in /usr/local/include/google/protobuf/arena.h to the following provided by Yangqing
template<typename T>
struct is_destructor_skippable {
template<typename U>
static char DestructorSkippable(
const typename U::DestructorSkippable_*);
template<typename U>
static double DestructorSkippable(...);
static const bool skippable =
sizeof(DestructorSkippable<const T>(static_cast<const T*>(0))) ==
sizeof(char) || google::protobuf::internal::has_trivial_destructor<T>::value == true;
// This will resolve to either google::protobuf::internal::true_type or google::protobuf::internal::false_type.
typedef google::protobuf::internal::integral_constant<bool, skippable> type;
static const type value;
};
Hope it works for you.
Thanks @yafangshih, I made the change but the error persists... Now I got this:
/usr/local/include/google/protobuf/arena.h:916:38: error: conflicting declaration ‘const google::protobuf::internal::integral_constant<bool, ((sizeof (DestructorSkippable<const T>(static_cast<const T*>(0))) == sizeof (char)) || (google::protobuf::internal::has_trivial_destructor<T>::value == true))> google::protobuf::Arena::is_destructor_skippable<T>::value’
Arena::is_destructor_skippable<T>::value =
^
/usr/local/include/google/protobuf/arena.h:596:19: note: previous declaration as ‘const type google::protobuf::Arena::is_destructor_skippable<T>::value’
static const type value;
^
/usr/local/include/google/protobuf/arena.h:916:38: error: declaration of ‘const type google::protobuf::Arena::is_destructor_skippable<T>::value’ outside of class is not definition [-fpermissive]
Arena::is_destructor_skippable<T>::value =
^
Makefile:549: recipe for target '.build_release/cuda/src/caffe/util/im2col.o' failed
make: *** [.build_release/cuda/src/caffe/util/im2col.o] Error 1
Please let me know if I am doing something wrong.
Thanks a lot.
@jdariasl could you try to this path: https://github.com/xfxyjwf/protobuf/commit/494716a682ef854168e92231a3cdcc89d587d9b9
It works, thank you so much!
hi is this patch gonna make it to proto's trunk?
thanks @yafangshih , it works for me.
@xfxyjwf I change the 576 to 590 to the above modified codes, but I get the similar situation like you. How did you fix this later on? Thanks