[protobuf] Getting empty strings from protobuf
Hi. I'm trying to use protobuf for cross-platform, cross-architecture communication - Java 64-bit to C++ 32-bit. The integer data is passed fine - problem is in the strings, which are coming empty. Used version is 2.3, lite (for faster speed). Any idea? Thanks! -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Cross-compiling protobuf to 32-bit
Hi. I'm trying to compile a 32-bit protobuf on 64-bit machine. No matter what I tried (changing build option, host option or setting - m32 flag), I couldn't get it working. Either I stuck on compile stage, or the resulting binaries are 64-bit. I do able to compile other apps via -m32 flag. (I solved this for now by compiling on another 32-bit machine, which is awfully inconvenient, plus may cause the strings issue I wrote earlier.) Any advice how to sort it out? Thanks! -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] Problems de-serialising a string, C++
What is the return value of ParseFromIStream()? My guess is false. Are you making sure to open your files in binary mode? You *must* pass the ios::binary flag when opening, otherwise newline conversion will corrupt the file. Are you writing anything else to the file other than your protobuf? Protobufs are not self-delimiting so if you do this, you must do something like write the size first so that you can make sure to read and parse only that many bytes. On Thu, Jan 28, 2010 at 9:59 AM, iWalsh iain.d.wa...@googlemail.com wrote: Hi I've created some logging functionality for a project I'm working on. It creates a series of LogEvents for different system events. Here's part of the message definition: message Log { message LogEvent { message NetInfo { optional string ip_address =1; optional string login =2; optional bytes mac =3; optional bool wireless =4; optional string ssid =5; enum wlessSecEnum { NOAUTH =0; WEP =1; WPAPSK_TKIP =2; WPAPSK_AES =3; UNSUPPORTED =4; } optional wlessSecEnum wless_security =6; enum ipconfigEnum { DHCP=0; STATIC =1; PPPOE =2; } optional wlessSecEnum wless_security =6; enum ipconfigEnum { DHCP=0; STATIC =1; PPPOE =2; } optional ipconfigEnum ip_config =7; optional string default_route =8; optional string primary_DNS =9; optional string secondary_DNS =10; optional bool proxy =11; } optional sfixed64 timestamp =3; optional string productId =4; optional string detail =5; optional NetInfonetDetail =9; } repeated LogEvent events =1; optional string version =2; optional sfixed64 writetimestamp =3; } Sorry for the convoluted structure. Anyway it serialises to a file correctly, it's in a correct state then I use the SerializeToOstream() method to write to a file. The file from inspection has all the data and lots of events after the net connection event. So I know it's correct as the strings are readable in notepad++. However when I try to read back from the file using ParseFromIstream() I get a properly constructed Log message. However all the fields after the NetInfo.mac are set to defaults, and all the repeated LogEvents after that one are missing. I know they're in the serialised file but I can't parse them back in. I've tried doing mac as a string, bytes, making sure there are no null characters etc. However nothing seems to fix it. Any help would be appreciated. Regards Iain -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] Cross-compiling protobuf to 32-bit
What OS? What compiler? What is your ./configure command line? On Thu, Jan 28, 2010 at 5:12 AM, SyRenity stas.os...@gmail.com wrote: Hi. I'm trying to compile a 32-bit protobuf on 64-bit machine. No matter what I tried (changing build option, host option or setting - m32 flag), I couldn't get it working. Either I stuck on compile stage, or the resulting binaries are 64-bit. I do able to compile other apps via -m32 flag. (I solved this for now by compiling on another 32-bit machine, which is awfully inconvenient, plus may cause the strings issue I wrote earlier.) Any advice how to sort it out? Thanks! -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Problems de-serialising a string, C++
Hi Thanks for the reply. The methods are both returning correctly. It's the only thing I write to the file. They are also open in binary mode I think, I'll have to double check the binary mode part. Regards Iain -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Problems de-serialising a string, C++
Ah Sorry I should also mention that leaving the mac address field empty/default means that the file works correctly. On Jan 28, 7:45 pm, iWalsh iain.d.wa...@googlemail.com wrote: Hi Thanks for the reply. The methods are both returning correctly. It's the only thing I write to the file. They are also open in binary mode I think, I'll have to double check the binary mode part. Regards Iain -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] Re: Problems de-serialising a string, C++
There's a bug in your code, but I don't know what. Can you please reduce it to a small, self-contained example and send it to the list? On Thu, Jan 28, 2010 at 11:47 AM, iWalsh iain.d.wa...@googlemail.comwrote: Ah Sorry I should also mention that leaving the mac address field empty/default means that the file works correctly. On Jan 28, 7:45 pm, iWalsh iain.d.wa...@googlemail.com wrote: Hi Thanks for the reply. The methods are both returning correctly. It's the only thing I write to the file. They are also open in binary mode I think, I'll have to double check the binary mode part. Regards Iain -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] Re: Cross-compiling protobuf to 32-bit
On Thu, Jan 28, 2010 at 11:45 AM, SyRenity stas.os...@gmail.com wrote: CentOS 5.4 GCC 4.1.2 Configure for example: ./configure --prefix=/tmp/protobuf --host i386-redhat-linux And when you configure other autotool-based packages the same way, it works? You said you were using the -m32 flag. Where is it? On Jan 28, 9:22 pm, Kenton Varda ken...@google.com wrote: What OS? What compiler? What is your ./configure command line? On Thu, Jan 28, 2010 at 5:12 AM, SyRenity stas.os...@gmail.com wrote: Hi. I'm trying to compile a 32-bit protobuf on 64-bit machine. No matter what I tried (changing build option, host option or setting - m32 flag), I couldn't get it working. Either I stuck on compile stage, or the resulting binaries are 64-bit. I do able to compile other apps via -m32 flag. (I solved this for now by compiling on another 32-bit machine, which is awfully inconvenient, plus may cause the strings issue I wrote earlier.) Any advice how to sort it out? Thanks! -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com protobuf%2bunsubscr...@googlegroups.comprotobuf%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.