Re: [protobuf] Segmentation fault

2017-04-08 Thread Xuanting Cai
I am using protoc 3.1.0

# protoc --version
libprotoc 3.1.0

I am building my project with bazel, which load proto build rule 
from https://github.com/pubref/rules_protobuf.

https://github.com/pubref/rules_protobuf says it support protobuf 3.1.x

It seems the segmentation fault happens at destroy stage.

Thanks.


On Tuesday, April 4, 2017 at 4:39:36 AM UTC+8, Adam Cozzette wrote:
>
> What protobuf version are you using? Also, are you linking against a 
> libprotobuf that has the same version as the protoc that was used to 
> generate your code? It's important for the version to match, because for 
> C++ we frequently change the interface between the generated code and the 
> runtime library.
>
> On Sat, Apr 1, 2017 at 2:36 PM, Xuanting Cai  > wrote:
>
>> Hi 
>>
>> I am running some very simple code, but I got Segmentation fault.
>> I compiled it with bazel and some proto complie library for bazel.
>>
>> Here is my code in .cc file
>>
>> string ToString(const Message& message) {
>> TextFormat::Printer printer;
>>   printer.SetSingleLineMode(true);
>>   
>>   string proto_in_line_string;
>>   printer.PrintToString(message, _in_line_string);
>>   
>>   return proto_in_line_string;
>> }
>>
>> Here is my code in test.cc file
>>
>> struct ProtoHelperFixture {};
>>
>> BOOST_FIXTURE_TEST_SUITE(ProtoHelperTests, ProtoHelperFixture)
>>
>> BOOST_AUTO_TEST_CASE(ToStringTest) {
>> TimeInterval time_interval;
>> TextFormat::ParseFromString(
>> R"(begin_time: "2017-01-01 10:00:00")"
>> R"(end_time: "2017-01-01 10:30:00")",
>> _interval);
>> LOG(INFO) << ToString(time_interval);
>> }
>>
>> BOOST_AUTO_TEST_SUITE_END()
>>
>> Run it in gdb, I got
>>
>> #0  0x002965707954 in ?? ()
>> #1  0x77f2da5d in 
>> google::protobuf::Arena::AllocateAligned(std::type_info const*, unsigned 
>> long) ()
>>from 
>> /home/caixuanting/.cache/bazel/_bazel_caixuanting/6f27b1af69abf374829e79d372f6b04b/execroot/myth-trading-system/bazel-out/local-opt/bin/utils/../_solib_k8/libexternal_Scom_Ugithub_Ugoogle_Uprotobuf_Slibprotobuf_Ulite.so
>> #2  0x77f2da92 in google::protobuf::Arena::AddListNode(void*, 
>> void (*)(void*)) ()
>>from 
>> /home/caixuanting/.cache/bazel/_bazel_caixuanting/6f27b1af69abf374829e79d372f6b04b/execroot/myth-trading-system/bazel-out/local-opt/bin/utils/../_solib_k8/libexternal_Scom_Ugithub_Ugoogle_Uprotobuf_Slibprotobuf_Ulite.so
>> #3  0x77cc23ef in 
>> google::protobuf::FileDescriptorProto::New(google::protobuf::Arena*) const 
>> ()
>>from 
>> /home/caixuanting/.cache/bazel/_bazel_caixuanting/6f27b1af69abf374829e79d372f6b04b/execroot/myth-trading-system/bazel-out/local-opt/bin/utils/../_solib_k8/libexternal_Scom_Ugithub_Ugoogle_Uprotobuf_Slibprotobuf.so
>> #4  0x77270acb in 
>> google::protobuf::MessageLite::ParseFromArray(void const*, int) ()
>>from /usr/lib/x86_64-linux-gnu/libprotobuf.so.8
>> #5  0x772b30f3 in 
>> google::protobuf::EncodedDescriptorDatabase::Add(void const*, int) ()
>>from /usr/lib/x86_64-linux-gnu/libprotobuf.so.8
>> #6  0x7727a40a in 
>> google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, 
>> int) () from /usr/lib/x86_64-linux-gnu/libprotobuf.so.8
>> #7  0x772ac41c in 
>> google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() 
>> () from /usr/lib/x86_64-linux-gnu/libprotobuf.so.8
>> #8  0x77dea10a in call_init (l=, argc=argc@entry=1,
>> argv=argv@entry=0x7fffe428, env=env@entry=0x7fffe438) at 
>> dl-init.c:78
>> #9  0x77dea1f3 in call_init (env=, argv=> out>,
>> argc=, l=) at dl-init.c:36
>> #10 _dl_init (main_map=0x77ffe1c8, argc=1, argv=0x7fffe428, 
>> env=0x7fffe438)
>> at dl-init.c:126
>> #11 0x77ddb30a in _dl_start_user () from 
>> /lib64/ld-linux-x86-64.so.2
>> #12 0x0001 in ?? ()
>> #13 0x7fffe660 in ?? ()
>> #14 0x in ?? ()
>>
>>
>> -- 
>> 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 protobuf+u...@googlegroups.com .
>> To post to this group, send email to prot...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Segmentation fault

2017-04-03 Thread 'Adam Cozzette' via Protocol Buffers
What protobuf version are you using? Also, are you linking against a
libprotobuf that has the same version as the protoc that was used to
generate your code? It's important for the version to match, because for
C++ we frequently change the interface between the generated code and the
runtime library.

On Sat, Apr 1, 2017 at 2:36 PM, Xuanting Cai  wrote:

> Hi
>
> I am running some very simple code, but I got Segmentation fault.
> I compiled it with bazel and some proto complie library for bazel.
>
> Here is my code in .cc file
>
> string ToString(const Message& message) {
> TextFormat::Printer printer;
>   printer.SetSingleLineMode(true);
>
>   string proto_in_line_string;
>   printer.PrintToString(message, _in_line_string);
>
>   return proto_in_line_string;
> }
>
> Here is my code in test.cc file
>
> struct ProtoHelperFixture {};
>
> BOOST_FIXTURE_TEST_SUITE(ProtoHelperTests, ProtoHelperFixture)
>
> BOOST_AUTO_TEST_CASE(ToStringTest) {
> TimeInterval time_interval;
> TextFormat::ParseFromString(
> R"(begin_time: "2017-01-01 10:00:00")"
> R"(end_time: "2017-01-01 10:30:00")",
> _interval);
> LOG(INFO) << ToString(time_interval);
> }
>
> BOOST_AUTO_TEST_SUITE_END()
>
> Run it in gdb, I got
>
> #0  0x002965707954 in ?? ()
> #1  0x77f2da5d in 
> google::protobuf::Arena::AllocateAligned(std::type_info
> const*, unsigned long) ()
>from /home/caixuanting/.cache/bazel/_bazel_caixuanting/
> 6f27b1af69abf374829e79d372f6b04b/execroot/myth-trading-
> system/bazel-out/local-opt/bin/utils/../_solib_k8/
> libexternal_Scom_Ugithub_Ugoogle_Uprotobuf_Slibprotobuf_Ulite.so
> #2  0x77f2da92 in google::protobuf::Arena::AddListNode(void*,
> void (*)(void*)) ()
>from /home/caixuanting/.cache/bazel/_bazel_caixuanting/
> 6f27b1af69abf374829e79d372f6b04b/execroot/myth-trading-
> system/bazel-out/local-opt/bin/utils/../_solib_k8/
> libexternal_Scom_Ugithub_Ugoogle_Uprotobuf_Slibprotobuf_Ulite.so
> #3  0x77cc23ef in 
> google::protobuf::FileDescriptorProto::New(google::protobuf::Arena*)
> const ()
>from /home/caixuanting/.cache/bazel/_bazel_caixuanting/
> 6f27b1af69abf374829e79d372f6b04b/execroot/myth-trading-
> system/bazel-out/local-opt/bin/utils/../_solib_k8/
> libexternal_Scom_Ugithub_Ugoogle_Uprotobuf_Slibprotobuf.so
> #4  0x77270acb in google::protobuf::MessageLite::ParseFromArray(void
> const*, int) ()
>from /usr/lib/x86_64-linux-gnu/libprotobuf.so.8
> #5  0x772b30f3 in 
> google::protobuf::EncodedDescriptorDatabase::Add(void
> const*, int) ()
>from /usr/lib/x86_64-linux-gnu/libprotobuf.so.8
> #6  0x7727a40a in 
> google::protobuf::DescriptorPool::InternalAddGeneratedFile(void
> const*, int) () from /usr/lib/x86_64-linux-gnu/libprotobuf.so.8
> #7  0x772ac41c in google::protobuf::protobuf_
> AddDesc_google_2fprotobuf_2fdescriptor_2eproto() () from
> /usr/lib/x86_64-linux-gnu/libprotobuf.so.8
> #8  0x77dea10a in call_init (l=, argc=argc@entry=1,
> argv=argv@entry=0x7fffe428, env=env@entry=0x7fffe438) at
> dl-init.c:78
> #9  0x77dea1f3 in call_init (env=, argv= out>,
> argc=, l=) at dl-init.c:36
> #10 _dl_init (main_map=0x77ffe1c8, argc=1, argv=0x7fffe428,
> env=0x7fffe438)
> at dl-init.c:126
> #11 0x77ddb30a in _dl_start_user () from
> /lib64/ld-linux-x86-64.so.2
> #12 0x0001 in ?? ()
> #13 0x7fffe660 in ?? ()
> #14 0x in ?? ()
>
>
> --
> 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 protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.