conflicting declaration of C function 'uint32_t google::protobuf::internal::little_endian::FromHost(uint32_t)'

Skip to first unread message

Claude Robitaille

Jan 19, 2023, 11:24:17 AMJan 19
to Protocol Buffers
My solution is probably similar to this post:

 however the versions I find problematic are different. So not sure it is indeed the same problem. In any case, the solution mentioned is not working for me....

In my case, all is fine up to 3.20.3, using the autoconf method. Moving to 3.21.1 (and presumably 3.21.0), autoconf support was removed. So I switched to cmake (most of the other open source libraries I am using are cmake based so all is good on supporting cmake). 

protoc does its duty and generate all the .pb.h and

libprotobuf also compiles properly

But when I start compiling my sources I get similar messages to:
conflicting declaration of C function 'uint32_t google::protobuf::internal::little_endian::FromHost(uint32_t)'

I am cross-compiling using:  x86_64-unknown-linux-gnu-g++ (crosstool-NG 1.24.0) 8.3.0

Interestingly, when this happens, I also get:

waitstatus.h:79:27: error: redeclaration of 'unsigned int wait::<unnamed struct>::__w_retcode'
waitstatus.h:74:27: note: previous declaration 'unsigned int wait::<unnamed struct>::__w_retcode'

In waitstatus, both lines are inside #ifdef __USE_BSD. But I am targeting Linux so that does not make sense. Also, line 74 is under # if    __BYTE_ORDER == __LITTLE_ENDIAN and line 79 is under # if    __BYTE_ORDER == __BIG_ENDIAN. The ifdef should be mutually exclisive so I am guessing __LITTLE_ENDIAN and __BIG_ENDIAN are not defined.

The post I am referring to above mentions using -isystem instead of -I to include the protobuf headers. That did not solve my problem.

Reply all
Reply to author
0 new messages