| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset='utf-8'>
- <meta http-equiv="X-UA-Compatible" content="chrome=1">
- <meta name="description" content="Google Protocol Buffers : ">
- <link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
- <title>Google Protocol Buffers</title>
- </head>
- <body>
- <!-- HEADER -->
- <div id="header_wrap" class="outer">
- <header class="inner">
- <a id="forkme_banner" href="https://github.com/google/protobuf">View on GitHub</a>
- <h1 id="project_title">Google Protocol Buffers</h1>
- <h2 id="project_tagline"></h2>
- <section id="downloads">
- <a class="zip_download_link" href="https://github.com/google/protobuf/zipball/master">Download this project as a .zip file</a>
- <a class="tar_download_link" href="https://github.com/google/protobuf/tarball/master">Download this project as a tar.gz file</a>
- </section>
- </header>
- </div>
- <!-- MAIN CONTENT -->
- <div id="main_content_wrap" class="outer">
- <section id="main_content" class="inner">
- <h1>
- <a name="protocol-buffers---googles-data-interchange-format" class="anchor" href="#protocol-buffers---googles-data-interchange-format"><span class="octicon octicon-link"></span></a>Protocol Buffers - Google's data interchange format</h1>
- <p>Copyright 2008 Google Inc.</p>
- <p><a href="https://developers.google.com/protocol-buffers/">https://developers.google.com/protocol-buffers/</a></p>
- <h2>
- <a name="c-installation---unix" class="anchor" href="#c-installation---unix"><span class="octicon octicon-link"></span></a>C++ Installation - Unix</h2>
- <p>If you get the source from github, you need to generate the configure script
- first:</p>
- <pre><code>$ ./autogen.sh
- </code></pre>
- <p>This will download gtest source (which is used for C++ Protocol Buffer
- unit-tests) to the current directory and run automake, autoconf, etc.
- to generate the configure script and various template makefiles.</p>
- <p>You can skip this step if you are using a release package (which already
- contains gtest and the configure script).</p>
- <p>To build and install the C++ Protocol Buffer runtime and the Protocol
- Buffer compiler (protoc) execute the following:</p>
- <pre><code>$ ./configure
- $ make
- $ make check
- $ make install
- </code></pre>
- <p>If "make check" fails, you can still install, but it is likely that
- some features of this library will not work correctly on your system.
- Proceed at your own risk.</p>
- <p>"make install" may require superuser privileges.</p>
- <p>For advanced usage information on configure and make, see INSTALL.txt.</p>
- <p><strong>Hint on install location</strong></p>
- <p>By default, the package will be installed to /usr/local. However,
- on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH.
- You can add it, but it may be easier to just install to /usr
- instead. To do this, invoke configure as follows:</p>
- <pre><code>./configure --prefix=/usr
- </code></pre>
- <p>If you already built the package with a different prefix, make sure
- to run "make clean" before building again.</p>
- <p><strong>Compiling dependent packages</strong></p>
- <p>To compile a package that uses Protocol Buffers, you need to pass
- various flags to your compiler and linker. As of version 2.2.0,
- Protocol Buffers integrates with pkg-config to manage this. If you
- have pkg-config installed, then you can invoke it to get a list of
- flags like so:</p>
- <pre><code>pkg-config --cflags protobuf # print compiler flags
- pkg-config --libs protobuf # print linker flags
- pkg-config --cflags --libs protobuf # print both
- </code></pre>
- <p>For example:</p>
- <pre><code>c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf`
- </code></pre>
- <p>Note that packages written prior to the 2.2.0 release of Protocol
- Buffers may not yet integrate with pkg-config to get flags, and may
- not pass the correct set of flags to correctly link against
- libprotobuf. If the package in question uses autoconf, you can
- often fix the problem by invoking its configure script like:</p>
- <pre><code>configure CXXFLAGS="$(pkg-config --cflags protobuf)" \
- LIBS="$(pkg-config --libs protobuf)"
- </code></pre>
- <p>This will force it to use the correct flags.</p>
- <p>If you are writing an autoconf-based package that uses Protocol
- Buffers, you should probably use the PKG_CHECK_MODULES macro in your
- configure script like:</p>
- <pre><code>PKG_CHECK_MODULES([protobuf], [protobuf])
- </code></pre>
- <p>See the pkg-config man page for more info.</p>
- <p>If you only want protobuf-lite, substitute "protobuf-lite" in place
- of "protobuf" in these examples.</p>
- <p><strong>Note for cross-compiling</strong></p>
- <p>The makefiles normally invoke the protoc executable that they just
- built in order to build tests. When cross-compiling, the protoc
- executable may not be executable on the host machine. In this case,
- you must build a copy of protoc for the host machine first, then use
- the --with-protoc option to tell configure to use it instead. For
- example:</p>
- <pre><code>./configure --with-protoc=protoc
- </code></pre>
- <p>This will use the installed protoc (found in your $PATH) instead of
- trying to execute the one built during the build process. You can
- also use an executable that hasn't been installed. For example, if
- you built the protobuf package for your host machine in ../host,
- you might do:</p>
- <pre><code>./configure --with-protoc=../host/src/protoc
- </code></pre>
- <p>Either way, you must make sure that the protoc executable you use
- has the same version as the protobuf source code you are trying to
- use it with.</p>
- <p><strong>Note for Solaris users</strong></p>
- <p>Solaris 10 x86 has a bug that will make linking fail, complaining
- about libstdc++.la being invalid. We have included a work-around
- in this package. To use the work-around, run configure as follows:</p>
- <pre><code>./configure LDFLAGS=-L$PWD/src/solaris
- </code></pre>
- <p>See src/solaris/libstdc++.la for more info on this bug.</p>
- <p><strong>Note for HP C++ Tru64 users</strong></p>
- <p>To compile invoke configure as follows:</p>
- <pre><code>./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM"
- </code></pre>
- <p>Also, you will need to use gmake instead of make.</p>
- <h2>
- <a name="c-installation---windows" class="anchor" href="#c-installation---windows"><span class="octicon octicon-link"></span></a>C++ Installation - Windows</h2>
- <p>If you are using Microsoft Visual C++, see vsprojects/readme.txt.</p>
- <p>If you are using Cygwin or MinGW, follow the Unix installation
- instructions, above.</p>
- <h2>
- <a name="binary-compatibility-warning" class="anchor" href="#binary-compatibility-warning"><span class="octicon octicon-link"></span></a>Binary Compatibility Warning</h2>
- <p>Due to the nature of C++, it is unlikely that any two versions of the
- Protocol Buffers C++ runtime libraries will have compatible ABIs.
- That is, if you linked an executable against an older version of
- libprotobuf, it is unlikely to work with a newer version without
- re-compiling. This problem, when it occurs, will normally be detected
- immediately on startup of your app. Still, you may want to consider
- using static linkage. You can configure this package to install
- static libraries only using:</p>
- <pre><code>./configure --disable-shared
- </code></pre>
- <h2>
- <a name="java-and-python-installation" class="anchor" href="#java-and-python-installation"><span class="octicon octicon-link"></span></a>Java and Python Installation</h2>
- <p>The Java and Python runtime libraries for Protocol Buffers are located
- in the java and python directories. See the README file in each
- directory for more information on how to compile and install them.
- Note that both of them require you to first install the Protocol
- Buffer compiler (protoc), which is part of the C++ package.</p>
- <h2>
- <a name="usage" class="anchor" href="#usage"><span class="octicon octicon-link"></span></a>Usage</h2>
- <p>The complete documentation for Protocol Buffers is available via the
- web at:</p>
- <pre><code>https://developers.google.com/protocol-buffers/
- </code></pre>
- </section>
- </div>
- <!-- FOOTER -->
- <div id="footer_wrap" class="outer">
- <footer class="inner">
- <p class="copyright">Google Protocol Buffers maintained by <a href="https://github.com/google">google</a></p>
- <p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
- </footer>
- </div>
-
- </body>
- </html>
|