Re: [protobuf] proto3 backward compatibility problem

2015-09-14 Thread sam sun
Since the map type is important to me, i decided to use proto3, so i moved 
hashLong method from  com.google.protobuf.Internal.hashLong/hashEnum/xx to 
GeneratedMessage in proto3 source code and solved the problem,  however, to 
maintain a special version by myself is really a bad idea. 
I do think it's  very import to keep full backward compatibility with code 
generated by proto2 since so many widely used opensource libs depends on 
protobuf as i have mentioned before,   especially protobuf2.5.
Thanks

在 2015年9月7日星期一 UTC+8下午3:05:50,sam sun写道:
>
> I knew it, because yarn depends on proto2 but my lib depends on proto3. 
> The reason is that proto3 runtime doesn't keep backward compatibility. The 
> problem can be reproduced if set option java_generate_equals_and_hash = 
> true with proto2.
>
> I hope msg with proto2 still work with proto3 jar since proto2 has been 
> widely used in opensource system like yarn, hbase, etc.
>
>
>
> 在 2015年9月7日星期一 UTC+8下午2:31:04,Feng Xiao写道:
>>
>> On Sat, Sep 5, 2015 at 9:08 PM, sam sun  wrote:
>>
>>> I use proto3 to log user event and then run a mapreduce to stat same 
>>> metrics. But it reports an error:
>>>
>>> Exception in thread "Thread-2" java.lang.NoSuchMethodError: 
>>> org.apache.hadoop.yarn.proto.YarnProtos$LocalResourceProto.hashLong(J)I
>>> at 
>>> org.apache.hadoop.yarn.proto.YarnProtos$LocalResourceProto.hashCode(YarnProtos.java:11555)
>>> at 
>>> org.apache.hadoop.yarn.api.records.impl.pb.LocalResourcePBImpl.hashCode(LocalResourcePBImpl.java:62)
>>> at java.util.HashMap.hash(HashMap.java:338)
>>> at java.util.HashMap.put(HashMap.java:611)
>>>
>>> The problem is proto3 doesn't keep backward compatibility with proto2. 
>>> hashLong is no longer exists in generated code with proto3. Now I faced a 
>>> deed situation that neither proto2 nor proto3 can be loaded when i run a 
>>>  mapreduce job.
>>>
>> It seems the problem is that your binary depends on both proto2 Java 
>> runtime and also proto3 Java runtime. One of them will be shadowed by the 
>> other and you will see such runtime errors. The suggestion is to stick with 
>> one version through out your project (including all your project's 
>> dependencies).
>>  
>>
>>>
>>>
>>> -- 
>>> 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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] MSVS 2013 Linker error, while trying to use proto

2015-09-14 Thread 'Feng Xiao' via Protocol Buffers
Have you been able to build the bundled protobuf tests successfully?

On Mon, Sep 14, 2015 at 2:50 AM, Александр Куринной 
wrote:

> Hey, i'm trying to use protocol buffers, but i keep getting LNK2001 error
> no matter, what i do
>
> Error 1 error LNK2001: unresolved external symbol "class
> std::basic_string std::allocator > const * const
> google::protobuf::internal::empty_string_" (?empty_string_@internal
> @protobuf@google@@3PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D
> @2@@std@@B) D:\Projects\protobufSerealizer\protobufSerealizer\test.pb.obj
> protobufSerealizer
>
> Error 2 error LNK2001: unresolved external symbol "int
> google::protobuf::internal::empty_string_once_init_"
> (?empty_string_once_init_@internal@protobuf@google@@3HA)
> D:\Projects\protobufSerealizer\protobufSerealizer\test.pb.obj
> protobufSerealizer
>
> so, could you please give me a hint on how to solve it?
>
> I've added to project's solution additional include libraries for
> google\... source files, and added to additional dependencies libprotobuf.lib,
> libprotobuf-lite.lib, and libprotoc.lib.
>
> --
> 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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] demo with protobuf-3.0.0-beta-1: unresolved external symbol

2015-09-14 Thread 'Feng Xiao' via Protocol Buffers
Hi,

This is a known issue: https://github.com/google/protobuf/issues/240

Someone has already posted a solution to address this problem and you can
give it a try.

On Mon, Sep 14, 2015 at 12:45 AM,  wrote:

> Hi All,
>
>   I compiled my demo to practice the protobuf , but LINKED ERROR.   It
> is VS2015.   And the Debug & x64 is OK。
> I have try my best to deal with this problem, oh.  Please help me ,
> thanks a lot!
>
>
> 
>
> 
>
> --
> 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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] proto3 backward compatibility problem

2015-09-14 Thread 'Feng Xiao' via Protocol Buffers
On Mon, Sep 14, 2015 at 5:23 AM, sam sun  wrote:

> Since the map type is important to me, i decided to use proto3, so i moved
> hashLong method from  com.google.protobuf.Internal.hashLong/hashEnum/xx
> to GeneratedMessage in proto3 source code and solved the problem,  however,
> to maintain a special version by myself is really a bad idea.
> I do think it's  very import to keep full backward compatibility with code
> generated by proto2 since so many widely used opensource libs depends on
> protobuf as i have mentioned before,   especially protobuf2.5.
>
We will take this into consideration and see what we can do. Maintaining
full compatibility is hard though (especially when we already have
incompatible changes in v3.0.0 alpha/beta releases).


> Thanks
>
> 在 2015年9月7日星期一 UTC+8下午3:05:50,sam sun写道:
>
>> I knew it, because yarn depends on proto2 but my lib depends on proto3.
>> The reason is that proto3 runtime doesn't keep backward compatibility. The
>> problem can be reproduced if set option java_generate_equals_and_hash =
>> true with proto2.
>>
>> I hope msg with proto2 still work with proto3 jar since proto2 has been
>> widely used in opensource system like yarn, hbase, etc.
>>
>>
>>
>> 在 2015年9月7日星期一 UTC+8下午2:31:04,Feng Xiao写道:
>>>
>>> On Sat, Sep 5, 2015 at 9:08 PM, sam sun  wrote:
>>>
 I use proto3 to log user event and then run a mapreduce to stat same
 metrics. But it reports an error:

 Exception in thread "Thread-2" java.lang.NoSuchMethodError:
 org.apache.hadoop.yarn.proto.YarnProtos$LocalResourceProto.hashLong(J)I
 at
 org.apache.hadoop.yarn.proto.YarnProtos$LocalResourceProto.hashCode(YarnProtos.java:11555)
 at
 org.apache.hadoop.yarn.api.records.impl.pb.LocalResourcePBImpl.hashCode(LocalResourcePBImpl.java:62)
 at java.util.HashMap.hash(HashMap.java:338)
 at java.util.HashMap.put(HashMap.java:611)

 The problem is proto3 doesn't keep backward compatibility with proto2.
 hashLong is no longer exists in generated code with proto3. Now I faced a
 deed situation that neither proto2 nor proto3 can be loaded when i run a
  mapreduce job.

>>> It seems the problem is that your binary depends on both proto2 Java
>>> runtime and also proto3 Java runtime. One of them will be shadowed by the
>>> other and you will see such runtime errors. The suggestion is to stick with
>>> one version through out your project (including all your project's
>>> dependencies).
>>>
>>>


 --
 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 http://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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] MSVS 2013 Linker error, while trying to use proto

2015-09-14 Thread Александр Куринной
Hey, i'm trying to use protocol buffers, but i keep getting LNK2001 error 
no matter, what i do

Error 1 error LNK2001: unresolved external symbol "class 
std::basic_string const * const 
google::protobuf::internal::empty_string_" 
(?empty_string_@internal@protobuf@google@@3PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B)
 
D:\Projects\protobufSerealizer\protobufSerealizer\test.pb.obj 
protobufSerealizer

Error 2 error LNK2001: unresolved external symbol "int 
google::protobuf::internal::empty_string_once_init_" 
(?empty_string_once_init_@internal@protobuf@google@@3HA) 
D:\Projects\protobufSerealizer\protobufSerealizer\test.pb.obj 
protobufSerealizer

so, could you please give me a hint on how to solve it?

I've added to project's solution additional include libraries for 
google\... source files, and added to additional dependencies libprotobuf.lib, 
libprotobuf-lite.lib, and libprotoc.lib.

-- 
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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Demo with protobuf-3.0.0-beta-1: unresolved external symbol when

2015-09-14 Thread baoshanqiang
Hi all,
 
  When I am compiling my demo with protobuf-3.0.0-beta-1, Debug & x64 
can be compiled successfully, but Release & x64 can not be compiled 
successfully.
the LINK ERROR is "public: static class google::protobuf::Arena * __cdecl 
google::protobuf::internal::GenericTypeHandler::GetArena(class google::protobuf::Message *)" (
?GetArena@?$GenericTypeHandler@VMessage@protobuf@google@@@internal@protobuf@google@@SAPEAVArena@34@PEAVMessage@34@@Z)
 test2 
E:\Music6\protobuftest\test2\libprotobuf.lib(generated_message_reflection.obj)  
  
and   "public: static void * __cdecl 
google::protobuf::internal::GenericTypeHandler::GetMaybeArenaPointer(class 
google::protobuf::Message *)" (
?GetMaybeArenaPointer@?$GenericTypeHandler@VMessage@protobuf@google@@@internal@protobuf@google@@SAPEAXPEAVMessage@34@@Z
) test2 
E:\Music6\protobuftest\test2\libprotobuf.lib(generated_message_reflection.obj).
 
  I used the vs2015 to compile my demo. Of course, the 
test2\libprotobuf.lib is release version.
 
  I have try my best to deal with this problem, oh.   Please help me, 
thanks a lot!

-- 
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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] demo with protobuf-3.0.0-beta-1: unresolved external symbol

2015-09-14 Thread baoshanqiang
Hi All,
 
  I compiled my demo to practice the protobuf , but LINKED ERROR.   It 
is VS2015.   And the Debug & x64 is OK。
I have try my best to deal with this problem, oh.  Please help me ,  thanks 
a lot!


  


-- 
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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] compilation error for "undefined reference to `google::protobuf::internal::AtomicOps_Internalx86CPUFeatures'"

2015-09-14 Thread kushal umarkar
Thank you Feng. I could resolve issue by adding 
atomicops_internal_x86_gcc.cc file in a build. Actually I am using Jambuild 
so in Jamfile it was miss placed.

On Friday, 11 September 2015 23:35:38 UTC+5:30, Feng Xiao wrote:
>
>
>
> On Fri, Sep 11, 2015 at 4:44 AM, kushal umarkar  > wrote:
>
>> I have been using Ubuntu 14.04 Lts. 64Bit in Virual Machine on windows.
>> I have some of proto files created for my project, I have been compiling 
>> complete c++ project using g++ compiler along with proto files but I am 
>> facing a compilation error below.
>>
>> /home/auto/Desktop/perforce/depot/project/Research/box/build64/Debug/lib/libprotobuf.a(once.o):
>>  
>> In function `google::protobuf::internal::Acquire_CompareAndSwap(long 
>> volatile*, long, long)':
>> /home/auto/Desktop/perforce/depot/project/Research/box/src/Components/ExternalLibraries/protobuf/2.6.0/stubs/atomicops_internals_x86_gcc.h:273:
>>  
>> undefined reference to 
>> `google::protobuf::internal::AtomicOps_Internalx86CPUFeatures'
>> collect2: error: ld returned 1 exit status
>> ...failed _AWAppBuild 
>> /home/auto/Desktop/perforce/depot/project/Research/box/build64/Debug/runTime/bin/tconduit
>>  
>> ...
>> ...failed updating 1 target(s)...
>>
>> May I know what is wrong happening in compilation. However I tried 
>> adding -DGOOGLE_PROTOBUF_ARCH_X64 -DHAVE_THREAD compiler flags as well but 
>> no change.
>>
> How did you build the library? It seems you missed 
> atomicops_internals_x86_gcc.cc in your build. Judging from the file path of 
> your build, it doesn't seem like using our provided build files.
>  
>
>>
>> Thanks for help in advance.
>>
>> -- 
>> 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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.