Building with debug symbols?

449 views
Skip to first unread message

Aaron Glenn

unread,
Apr 1, 2018, 6:20:11 AM4/1/18
to Protocol Buffers
Hi,

I am the next foolish person in line trying to get any version of protobuf 3.x compiled and tests passing on OpenBSD. Release 3.5.1 compiles without much fuss but when running tests, a segmentation fault occurs at the start of JsonStreamParserTest.

[----------] 70 tests from JsonStreamParserTest
[ RUN      ] JsonStreamParserTest.SimpleTrue

Program received signal SIGSEGV, Segmentation fault.
0x00000cd0eddfdd54 in testing::Sequence::AddExpectation(testing::Expectation const&) const () from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgmock.so.0.0
(gdb) bt
#0  0x00000cd0eddfdd54 in testing::Sequence::AddExpectation(testing::Expectation const&) const () from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgmock.so.0.0
#1  0x00000cceb7261033 in testing::internal::MockSpec<google::protobuf::util::converter::ObjectWriter* (google::protobuf::StringPiece, bool)>::InternalExpectedAt(char const*, int, char const*, char const*) ()
#2  0x00000cceb7266825 in google::protobuf::util::converter::ExpectingObjectWriter::RenderBool(google::protobuf::StringPiece, bool) ()
#3  0x00000cceb72805f6 in google::protobuf::util::converter::JsonStreamParserTest_SimpleTrue_Test::TestBody() ()
#4  0x00000cd1178b8d81 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
   from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgtest.so.0.0
#5  0x00000cd1178af48a in testing::Test::Run() () from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgtest.so.0.0
#6  0x00000cd1178af5d8 in testing::TestInfo::Run() () from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgtest.so.0.0
#7  0x00000cd1178af6b5 in testing::TestCase::Run() () from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgtest.so.0.0
#8  0x00000cd1178af9c8 in testing::internal::UnitTestImpl::RunAllTests() () from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgtest.so.0.0
#9  0x00000cd1178b92f1 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
   from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgtest.so.0.0
#10 0x00000cd1178afca7 in testing::UnitTest::Run() () from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgtest.so.0.0
#11 0x00000cd19db06519 in main () from /usr/ports/pobj/protobuf-3.5.1/build-amd64/src/.libs/libgmock_main.so.0.0
#12 0x00000cceb6e05026 in _start ()
(gdb)

I am woefully out of my element, and concerted Google/GitHub/mailing list searching did not produce any actionable data for me. I fully understand no developers have access to OpenBSD machines in their testing infra (and while that can be arranged to whatever specifics required, I understand the project is not interested in having an OpenBSD machine in their infra to reproduce this on).

My questions are:

1) how can I build with debug symbols to get `backtrace full` output working as intended? where do I put the -g flag to get passed to gcc in the CMake makefile system? do I pass this with ./configure?
2) would anyone be so kind as to venture a guess or three where I should be looking or attempting next?

Again, I understand no one can reproduce this due to lack (and seemingly desire) of having an OpenBSD machine. I am that someone. I am highly motivated to get this working. I humbly ask for any and all assistance anyone can be bothered to provide.

Many thanks,
Aaron

Feng Xiao

unread,
Apr 2, 2018, 6:36:05 PM4/2/18
to aag...@gmail.com, Protocol Buffers
If you are using cmake, do:
cmake -DCMAKE_BUILD_TYPE=Debug

or if you want to pass specific C++ flags:
cmake -DCMAKE_CXX_FLAGS=-g

If you are using autotools (i.e., ./configure && make), do:
./configure CXXFLAGS=-g
 
2) would anyone be so kind as to venture a guess or three where I should be looking or attempting next?
The issue could be in gmock, or the way gmock is built. I suggest you try different ways to build the tests and see if that makes any difference. For example, try build the tests statically, try both autotools build and cmake build.
 

Again, I understand no one can reproduce this due to lack (and seemingly desire) of having an OpenBSD machine. I am that someone. I am highly motivated to get this working. I humbly ask for any and all assistance anyone can be bothered to provide.

Many thanks,
Aaron

--
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.
Reply all
Reply to author
Forward
0 new messages