Mac installation Protobuf

Source: Internet
Author: User

Mac installation Protobuf
First download from http://code.google.com/p/protobuf/protobuf


After that, you need to install brew
[Non-root]
Brew install Autoconf[need to across the Great Wall and reach the bigger world]
Brew Install Automake
Brew Install libel
[Root]
sudo./autogen.sh
./configure (First autogen.sh only, if no permissions chmod +x Configure)
Make
Make check
Make install


Protoc-version
Show Results:
sh-3.2# Protoc--version
Libprotoc 3.0.0


First handwritten a proto file, and then placed in the make successful SRC folder, saw the glittering Protoc, that is to compile the source proto called the target file compiler. Set up a folder to hold the Proto file ready for compilation, but it seems to be placed under the SRC directory, otherwise it seems to be a problem ... Follow the resources tutorial to be no problem.
The parameters of which ptotoc:
-I (-proto_path) = $SRC _dir is the absolute path of SRC
-cpp_out = ... Path to Output
Finally, the absolute path of the proto to be compiled.




Resources:
Better 8, 9, 3, 11


1.PROTOBUF Installation
http://blog.csdn.net/yohunl/article/details/41797621


2. Problems encountered:
[Libprotobuf WARNING google/protobuf/compiler/parser.cc:547] No syntax specified for the proto File:yzh-proto/yzh.proto. Please use ' syntax = ' proto2 ', ' or ' syntax = ' proto3 '; ' To specify a syntax version. (defaulted to Proto2 syntax.)


Http://stackoverflow.com/questions/27958571/serializing-part-of-a-message-with-protobuf


WORKAROUND: Add syntax = "Proto2" at the front of the proto


3. A more comprehensive introduction from IBM developer


4.object C
Http://www.cnblogs.com/uniy/archive/2011/12/21/2296405.html
http://www.kelvinkaodev.com/blog/2010/08/compiling-the-protocol-buffer-compiler-for-objective-c/


5.mac + protobuf
http://blog.csdn.net/yohunl/article/details/41797621


6. Scripts for compiling Google Protobuf 2.5.0 for Xcode5.0/ios7 on Mac
http://blog.csdn.net/hherima/article/details/17172441


7. An automatically installed script
https://gist.github.com/BennettSmith/7150245


8. Usage and coding
http://blog.csdn.net/hherima/article/details/21534673


9.Google PROTOBUF Development Guide is a comprehensive introduction
Http://my.oschina.net/macwe/blog/157862?fromerr=dTsRN7pl


The most useful part of a person's opinion
Application of PROTOBUF in network communication
PROTOBUF Considerations for using TCP
My test program uses TCP, so a very natural problem, the message boundary or message length problem, Google on the internet after a lap to find that this is really a problem, the solution is very straightforward, the message is preceded by a field to indicate the length of the entire message (including the added field).




BOOL Serializetoarray (void * data, int size) const


BOOL Serializetostring (String * output) const


Of course there are some other variants, I don't like to use STL string, so I chose Serializetoarray





You can use the API to deserialize:


Boolparsefromarray (const void * data, int size)


Boolparsefromstring (const string & data)


The above-written functions are defined in google/protobuf/message_lite.h.




10.google PROTOBUF Code Style
Https://developers.google.com/protocol-buffers/docs/style#message-and-field-names


11.github official
Https://github.com/google/protobuf


12.third party add ones is unrelated to Google but uses the PROTOBUF technology project
Third party ADD ONS

Mac installation Protobuf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.