Hi Kenton,

-pthread : did work
-lpthread : did not work - although I don't understand why

Thanks for the pointer to GTEST_HAS_DEATH_TEST - I was able to run the full
tests and sadly they all didn't pass.  Here are the results - you think it's
safe to use on the blackfin?  The other tests passed
(./protobuf-lazy-descriptor-test and ./protobuf-lite-test)

Full results are here:
http://pastie.org/665409

[----------] Global test environment
> tear-down
>
> [==========] 677 tests from 94 test cases ran. (30793 ms
> total)
>
> [  PASSED  ] 664
> tests.
>
> [  FAILED  ] 13 tests, listed
> below:
>
> [  FAILED  ]
> ParseDecriptorDebugTest.TestAllDescriptorTypes
>
> [  FAILED  ]
> TextFormatTest.PrintExotic
>
> [  FAILED  ]
> TextFormatTest.PrintFloatPrecision
>
> [  FAILED  ]
> TextFormatTest.ParseExotic
>
> [  FAILED  ]
> DynamicMessageTest.Descriptor
>
> [  FAILED  ]
> DynamicMessageTest.OnePrototype
>
> [  FAILED  ]
> DynamicMessageTest.Defaults
>
> [  FAILED  ]
> DynamicMessageTest.IndependentOffsets
>
> [  FAILED  ]
> DynamicMessageTest.Extensions
>
> [  FAILED  ]
> DynamicMessageTest.PackedFields
>
> [  FAILED  ]
> DynamicMessageTest.SpaceUsed
>
> [  FAILED  ]
> MiscTest.DefaultValues
>
> [  FAILED  ]
> DatabaseBackedPoolTest.UnittestProto
>
>

Some Actual errors:

[ RUN      ] ParseDecriptorDebugTest.TestAllDescriptorTypes
> google/protobuf/compiler/parser_unittest.cc:1215: Failure
> Value of: error_collector_.text_
>   Actual: "102:54: Expected integer.
> 370:64: Expected integer.
>

[ RUN      ] TextFormatTest.PrintExotic
> google/protobuf/text_format_unittest.cc:423: Failure
> Value of:
> RemoveRedundantZeros(message.DebugString())
>   Actual: "repeated_int64: -42949672960


>



On Wed, Oct 21, 2009 at 5:27 PM, Kenton Varda <ken...@google.com> wrote:

> The lite test does not actually test all the features of the lite runtime.
>  It only tests that the lite runtime works stand-alone.  The full tests
> verify other features (many of which are shared between the two
> implementations).  So you want to run the full tests.
> The problem you seem to have is actually in gtest, not in protobuf.  Gtest
> has a feature called "death tests" which lets you verify that some code
> crashes.  It is implemented using fork().  vfork() would not work since the
> fork() is not followed by exec().
>
> The solution is to edit the gtest headers such that they do not #define
> GTEST_HAS_DEATH_TEST on your platform -- then all death tests will be
> omitted.  You can find the gtest source code in the "gtest" subdirectory of
> the protobuf package.  You might want to submit a patch back to them, which
> will then be picked up in future protobuf versions.
>
> Back on the original topic, I think I might have misunderstood you before.
>  You're saying that -lpthread *didn't* work and -pthread *did*?  Then that
> explains why the tests compile fine.  I thought you were saying th opposite.
>
>
> On Wed, Oct 21, 2009 at 5:19 PM, Rob <r...@rmdashr.com> wrote:
>
>> Oh, I didn't even see the 'Abort'.  It must be related to the uClinux's
>> lack of 'fork()'.  Maybe use 'vfork()' as a drop in replacement?
>>
>> http://docs.blackfin.uclinux.org/doku.php?id=living_without_forks
>>
>> Would you recommend sticking to the 'lite' interface? That test actually
>> passed!
>>
>>
>> On Wed, Oct 21, 2009 at 5:07 PM, Kenton Varda <ken...@google.com> wrote:
>>
>>> From your output, it appears that the tests are, in fact, crashing
>>> mid-run (hence "Abort").  You may want to run in a debugger and find out
>>> what is happening.
>>> But what I was expecting was that you wouldn't be able to compile the
>>> test in the first place due to the -pthread/-lpthread issue.  I'm pretty
>>> sure the makefiles pass the same linker args as pkg-config --libs reports
>>> when compiling the tests.
>>>
>>>
>>> On Wed, Oct 21, 2009 at 4:51 PM, Rob <r...@rmdashr.com> wrote:
>>>
>>>> Hi Kenton,
>>>>
>>>> I've crosscompiled the tests and ran them on the target board, here are
>>>> the results...  everything appears to have passed!  I'm assuming some of
>>>> those tests verify the threading (pthreads)?  Is there anything else I
>>>> should run?
>>>>
>>>> -Rob
>>>>
>>>> root:~>
>>>>> ./protobuf-lite-test
>>>>> PASS
>>>>>
>>>>
>>>>
>>>>
>>>> And...
>>>>
>>>>> root:~>
>>>>> ./protobuf-lazy-descriptor-test
>>>>> Running main() from
>>>>> gtest_main.cc
>>>>> [==========] Running 34 tests from 3 test
>>>>> cases.
>>>>> [----------] Global test environment
>>>>> set-up.
>>>>> [----------] 30 tests from
>>>>> GeneratedMessageTest
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.Defaults
>>>>> [       OK ] GeneratedMessageTest.Defaults (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.FloatingPointDefaults
>>>>> [       OK ] GeneratedMessageTest.FloatingPointDefaults (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.Accessors
>>>>> [       OK ] GeneratedMessageTest.Accessors (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.MutableStringDefault
>>>>> [       OK ] GeneratedMessageTest.MutableStringDefault (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.Clear
>>>>> [       OK ] GeneratedMessageTest.Clear (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.EmbeddedNullsInBytesCharStar
>>>>> [       OK ] GeneratedMessageTest.EmbeddedNullsInBytesCharStar (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.ClearOneField
>>>>> [       OK ] GeneratedMessageTest.ClearOneField (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.StringCharStarLength
>>>>> [       OK ] GeneratedMessageTest.StringCharStarLength (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.CopyFrom
>>>>> [       OK ] GeneratedMessageTest.CopyFrom (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.SwapWithEmpty
>>>>> [       OK ] GeneratedMessageTest.SwapWithEmpty (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.SwapWithSelf
>>>>> [       OK ] GeneratedMessageTest.SwapWithSelf (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.SwapWithOther
>>>>> [       OK ] GeneratedMessageTest.SwapWithOther (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.CopyConstructor
>>>>> [       OK ] GeneratedMessageTest.CopyConstructor (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.CopyAssignmentOperator
>>>>> [       OK ] GeneratedMessageTest.CopyAssignmentOperator (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.UpcastCopyFrom
>>>>> [       OK ] GeneratedMessageTest.UpcastCopyFrom (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.NonEmptyMergeFrom
>>>>> [       OK ] GeneratedMessageTest.NonEmptyMergeFrom (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.MergeFromSelf
>>>>>
>>>>>
>>>>> [WARNING] src/gtest-death-test.cc:743: Death tests use fork(), which is
>>>>> unsafe .
>>>>> Abort
>>>>>
>>>>>
>>>>
>>>> And Finally...
>>>>
>>>>> root:~>
>>>>> ./protobuf-test
>>>>>
>>>>> Running main() from
>>>>> gtest_main.cc
>>>>>
>>>>> [==========] Running 684 tests from 94 test
>>>>> cases.
>>>>>
>>>>> [----------] Global test environment
>>>>> set-up.
>>>>>
>>>>> [----------] 1 test from
>>>>> GeneratedDescriptorTest
>>>>>
>>>>> [ RUN      ]
>>>>> GeneratedDescriptorTest.IdenticalDescriptors
>>>>>
>>>>> [       OK ] GeneratedDescriptorTest.IdenticalDescriptors (258
>>>>> ms)
>>>>> [----------] 1 test from GeneratedDescriptorTest (258 ms
>>>>> total)
>>>>>
>>>>>
>>>>> [----------] 34 tests from
>>>>> GeneratedMessageTest
>>>>>
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.Defaults
>>>>>
>>>>> [       OK ] GeneratedMessageTest.Defaults (1
>>>>> ms)
>>>>>
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.FloatingPointDefaults
>>>>>
>>>>> [       OK ] GeneratedMessageTest.FloatingPointDefaults (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.Accessors
>>>>>
>>>>> [       OK ] GeneratedMessageTest.Accessors (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.MutableStringDefault
>>>>>
>>>>> [       OK ] GeneratedMessageTest.MutableStringDefault (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.Clear
>>>>>
>>>>> [       OK ] GeneratedMessageTest.Clear (1
>>>>> ms)
>>>>>
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.EmbeddedNullsInBytesCharStar
>>>>>
>>>>> [       OK ] GeneratedMessageTest.EmbeddedNullsInBytesCharStar (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.ClearOneField
>>>>>
>>>>> [       OK ] GeneratedMessageTest.ClearOneField (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.StringCharStarLength
>>>>>
>>>>> [       OK ] GeneratedMessageTest.StringCharStarLength (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.CopyFrom
>>>>>
>>>>> [       OK ] GeneratedMessageTest.CopyFrom (1
>>>>> ms)
>>>>>
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.SwapWithEmpty
>>>>>
>>>>> [       OK ] GeneratedMessageTest.SwapWithEmpty (2
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.SwapWithSelf
>>>>>
>>>>> [       OK ] GeneratedMessageTest.SwapWithSelf (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.SwapWithOther
>>>>>
>>>>> [       OK ] GeneratedMessageTest.SwapWithOther (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.CopyConstructor
>>>>>
>>>>> [       OK ] GeneratedMessageTest.CopyConstructor (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.CopyAssignmentOperator
>>>>>
>>>>> [       OK ] GeneratedMessageTest.CopyAssignmentOperator (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.UpcastCopyFrom
>>>>>
>>>>> [       OK ] GeneratedMessageTest.UpcastCopyFrom (0
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.DynamicMessageCopyFrom
>>>>>
>>>>> [       OK ] GeneratedMessageTest.DynamicMessageCopyFrom (2
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.NonEmptyMergeFrom
>>>>>
>>>>> [       OK ] GeneratedMessageTest.NonEmptyMergeFrom (1
>>>>> ms)
>>>>> [ RUN      ]
>>>>> GeneratedMessageTest.MergeFromSelf
>>>>>
>>>>>
>>>>>
>>>>> [WARNING] src/gtest-death-test.cc:743: Death tests use fork(), which is
>>>>> unsafe particularly in a threaded context. For thi.
>>>>> Abort
>>>>>
>>>>
>>>> On Wed, Oct 21, 2009 at 12:32 PM, Kenton Varda <ken...@google.com>wrote:
>>>>
>>>>> It seems there's some ambiguity as to whether -pthread implies
>>>>> -lpthread.  Are you able to compile and run the tests?
>>>>>
>>>>> On Wed, Oct 21, 2009 at 12:29 PM, Rob <r...@rmdashr.com> wrote:
>>>>>
>>>>>>
>>>>>> Hmm... not sure if my last msg got eaten or not, but the issue was
>>>>>> specifying '-pthread' instead of '-lpthread'.  Not sure why the
>>>>>> protobuf requires this when nothing else does...  but regardless,
>>>>>> thanks for the pointer to pkg-config... it helped solve the problem
>>>>>> for me!  :)
>>>>>>
>>>>>> Thanks again!
>>>>>>
>>>>>> -Rob
>>>>>>
>>>>>> On Oct 21, 11:13 am, Kenton Varda <ken...@google.com> wrote:
>>>>>> > When you compile a program against libprotobuf, you need to use
>>>>>> pkg-config
>>>>>> > to find out what additional cflags and libs are necessary.  Example:
>>>>>> >
>>>>>> >   g++ -c my_prog.cc `pkg-config --cflags protobuf`
>>>>>> >   g++ -o my_prog my_prog.o `pkg-config --libs protobuf`
>>>>>> >
>>>>>> > Your specific problem is probably that you are not linking against
>>>>>> > libpthread.
>>>>>> >
>>>>>> > On Wed, Oct 21, 2009 at 10:42 AM, Rob <r...@rmdashr.com> wrote:
>>>>>> >
>>>>>> > > Hi,
>>>>>> >
>>>>>> > > This is my build script to cross compile protobuf 2.2.0:
>>>>>> > > ================
>>>>>> > > #!/bin/sh
>>>>>> >
>>>>>> > > FLAGS="--disable-shared --disable-crypto-auth --without-gnutls --
>>>>>> > > without-ssl --without-zlib \
>>>>>> > >    --without-libssh2 --disable-ipv6 --disable-manual
>>>>>> --disable-telnet
>>>>>> > > --disable-tftp \
>>>>>> > >    --disable-ldap --disable-file --disable-ftp"
>>>>>> >
>>>>>> > > cd $1
>>>>>> > > make distclean
>>>>>> > > mkdir host
>>>>>> > > cd host
>>>>>> > > make distclean
>>>>>> > > ../configure $FLAGS --prefix=`pwd`/install && make -j4 && make
>>>>>> install
>>>>>> > > cd ..
>>>>>> > > ./configure --with-protoc=host/src/protoc --host=bfin-uclinux
>>>>>> $FLAGS --
>>>>>> > > prefix=`pwd`/bfin CPPFLAGS="-DUCLINUX" LDFLAGS="-Wl,-elf2flt" &&
>>>>>> > > make -j4 && make install
>>>>>> > > ================
>>>>>> >
>>>>>> > > When I go to link something against it I get all kinds of errors
>>>>>> like
>>>>>> > > "undefined reference to `_pthread_once'"
>>>>>> >
>>>>>> > > The configure script output regarding pthreads looks like this:
>>>>>> > > t...@godbox:~/work/blackfin/trunk/lib/protobuf$ ./configure --with-
>>>>>> > > protoc=host/src/protoc --host=bfin-linux-uclibc --disable-shared
>>>>>> --
>>>>>> > > disable-crypto-auth --without-gnutls --without-ssl --without-zlib
>>>>>> > > --without-libssh2 --disable-ipv6 --disable-manual --disable-telnet
>>>>>> --
>>>>>> > > disable-tftp     --disable-ldap --disable-file --disable-ftp --
>>>>>> > > prefix=`pwd`/bfin CPPFLAGS="-DUCLINUX" LDFLAGS="-Wl,-elf2flt" 2>&1
>>>>>> |
>>>>>> > > grep -i pthread
>>>>>> > > checking for the pthreads library -lpthreads... no
>>>>>> > > checking whether pthreads work without any flags... no
>>>>>> > > checking whether pthreads work with -Kthread... no
>>>>>> > > checking whether pthreads work with -kthread... no
>>>>>> > > checking for the pthreads library -llthread... no
>>>>>> > > checking whether pthreads work with -pthread... yes
>>>>>> > > checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
>>>>>> > > checking if more special flags are required for pthreads... no
>>>>>> > > checking whether to check for GCC pthread/shared
>>>>>> inconsistencies...
>>>>>> > > yes
>>>>>> > > checking whether -pthread is sufficient with -shared... yes
>>>>>> > > checking for the pthreads library -lpthreads... no
>>>>>> > > checking whether pthreads work without any flags... no
>>>>>> > > checking whether pthreads work with -Kthread... no
>>>>>> > > checking whether pthreads work with -kthread... no
>>>>>> > > checking for the pthreads library -llthread... no
>>>>>> > > checking whether pthreads work with -pthread... yes
>>>>>> > > checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
>>>>>> > > checking if more special flags are required for pthreads... no
>>>>>> > > checking whether to check for GCC pthread/shared
>>>>>> inconsistencies...
>>>>>> > > yes
>>>>>> > > checking whether -pthread is sufficient with -shared... yes
>>>>>> >
>>>>>> > > I'm somewhat confused what the issue is - I'm assuming the
>>>>>> configure
>>>>>> > > script isn't working quit right with the bfin toolchain?  Here is
>>>>>> the
>>>>>> > > full configure results:
>>>>>> > >http://pastie.org/private/prkft9dz5v2t6harphyw
>>>>>> >
>>>>>> > > Anything else I can do to help figure out what's going on?
>>>>>> >
>>>>>> > > Thanks!
>>>>>> >
>>>>>> >
>>>>>>
>>>>>> >>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to