| OLD | NEW |
| 1 Protocol Buffers - Google's data interchange format | 1 Protocol Buffers - Google's data interchange format |
| 2 =================================================== |
| 3 |
| 4 [](https
://travis-ci.org/google/protobuf) [](https://ci.appveyor.com/project/proto
buf/protobuf) |
| 5 |
| 2 Copyright 2008 Google Inc. | 6 Copyright 2008 Google Inc. |
| 3 http://code.google.com/apis/protocolbuffers/ | 7 |
| 8 https://developers.google.com/protocol-buffers/ |
| 4 | 9 |
| 5 C++ Installation - Unix | 10 C++ Installation - Unix |
| 6 ======================= | 11 ----------------------- |
| 12 |
| 13 If you get the source from github, you need to generate the configure script |
| 14 first: |
| 15 |
| 16 $ ./autogen.sh |
| 17 |
| 18 This will download gmock source (which is used for C++ Protocol Buffer |
| 19 unit-tests) to the current directory and run automake, autoconf, etc. |
| 20 to generate the configure script and various template makefiles. |
| 21 |
| 22 You can skip this step if you are using a release package (which already |
| 23 contains gmock and the configure script). |
| 7 | 24 |
| 8 To build and install the C++ Protocol Buffer runtime and the Protocol | 25 To build and install the C++ Protocol Buffer runtime and the Protocol |
| 9 Buffer compiler (protoc) execute the following: | 26 Buffer compiler (protoc) execute the following: |
| 10 | 27 |
| 11 $ ./configure | 28 $ ./configure |
| 12 $ make | 29 $ make |
| 13 $ make check | 30 $ make check |
| 14 $ make install | 31 $ make install |
| 15 | 32 |
| 16 If "make check" fails, you can still install, but it is likely that | 33 If "make check" fails, you can still install, but it is likely that |
| 17 some features of this library will not work correctly on your system. | 34 some features of this library will not work correctly on your system. |
| 18 Proceed at your own risk. | 35 Proceed at your own risk. |
| 19 | 36 |
| 20 "make install" may require superuser privileges. | 37 "make install" may require superuser privileges. |
| 21 | 38 |
| 22 For advanced usage information on configure and make, see INSTALL.txt. | 39 For advanced usage information on configure and make, see INSTALL.txt. |
| 23 | 40 |
| 24 ** Hint on install location ** | 41 **Hint on install location** |
| 25 | 42 |
| 26 By default, the package will be installed to /usr/local. However, | 43 By default, the package will be installed to /usr/local. However, |
| 27 on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH. | 44 on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH. |
| 28 You can add it, but it may be easier to just install to /usr | 45 You can add it, but it may be easier to just install to /usr |
| 29 instead. To do this, invoke configure as follows: | 46 instead. To do this, invoke configure as follows: |
| 30 | 47 |
| 31 ./configure --prefix=/usr | 48 ./configure --prefix=/usr |
| 32 | 49 |
| 33 If you already built the package with a different prefix, make sure | 50 If you already built the package with a different prefix, make sure |
| 34 to run "make clean" before building again. | 51 to run "make clean" before building again. |
| 35 | 52 |
| 36 ** Compiling dependent packages ** | 53 **Compiling dependent packages** |
| 37 | 54 |
| 38 To compile a package that uses Protocol Buffers, you need to pass | 55 To compile a package that uses Protocol Buffers, you need to pass |
| 39 various flags to your compiler and linker. As of version 2.2.0, | 56 various flags to your compiler and linker. As of version 2.2.0, |
| 40 Protocol Buffers integrates with pkg-config to manage this. If you | 57 Protocol Buffers integrates with pkg-config to manage this. If you |
| 41 have pkg-config installed, then you can invoke it to get a list of | 58 have pkg-config installed, then you can invoke it to get a list of |
| 42 flags like so: | 59 flags like so: |
| 43 | 60 |
| 44 pkg-config --cflags protobuf # print compiler flags | 61 pkg-config --cflags protobuf # print compiler flags |
| 45 pkg-config --libs protobuf # print linker flags | 62 pkg-config --libs protobuf # print linker flags |
| 46 pkg-config --cflags --libs protobuf # print both | 63 pkg-config --cflags --libs protobuf # print both |
| (...skipping 17 matching lines...) Expand all Loading... |
| 64 Buffers, you should probably use the PKG_CHECK_MODULES macro in your | 81 Buffers, you should probably use the PKG_CHECK_MODULES macro in your |
| 65 configure script like: | 82 configure script like: |
| 66 | 83 |
| 67 PKG_CHECK_MODULES([protobuf], [protobuf]) | 84 PKG_CHECK_MODULES([protobuf], [protobuf]) |
| 68 | 85 |
| 69 See the pkg-config man page for more info. | 86 See the pkg-config man page for more info. |
| 70 | 87 |
| 71 If you only want protobuf-lite, substitute "protobuf-lite" in place | 88 If you only want protobuf-lite, substitute "protobuf-lite" in place |
| 72 of "protobuf" in these examples. | 89 of "protobuf" in these examples. |
| 73 | 90 |
| 74 ** Note for cross-compiling ** | 91 **Note for Mac users** |
| 92 |
| 93 For a Mac system, Unix tools are not available by default. You will first need |
| 94 to install Xcode from the Mac AppStore and then run the following command from |
| 95 a terminal: |
| 96 |
| 97 $ sudo xcode-select --install |
| 98 |
| 99 To install Unix tools, you can install "port" following the instructions at |
| 100 https://www.macports.org . This will reside in /opt/local/bin/port for most |
| 101 Mac installations. |
| 102 |
| 103 $ sudo /opt/local/bin/port install autoconf automake libtool |
| 104 |
| 105 Then follow the Unix instructions above. |
| 106 |
| 107 **Note for cross-compiling** |
| 75 | 108 |
| 76 The makefiles normally invoke the protoc executable that they just | 109 The makefiles normally invoke the protoc executable that they just |
| 77 built in order to build tests. When cross-compiling, the protoc | 110 built in order to build tests. When cross-compiling, the protoc |
| 78 executable may not be executable on the host machine. In this case, | 111 executable may not be executable on the host machine. In this case, |
| 79 you must build a copy of protoc for the host machine first, then use | 112 you must build a copy of protoc for the host machine first, then use |
| 80 the --with-protoc option to tell configure to use it instead. For | 113 the --with-protoc option to tell configure to use it instead. For |
| 81 example: | 114 example: |
| 82 | 115 |
| 83 ./configure --with-protoc=protoc | 116 ./configure --with-protoc=protoc |
| 84 | 117 |
| 85 This will use the installed protoc (found in your $PATH) instead of | 118 This will use the installed protoc (found in your $PATH) instead of |
| 86 trying to execute the one built during the build process. You can | 119 trying to execute the one built during the build process. You can |
| 87 also use an executable that hasn't been installed. For example, if | 120 also use an executable that hasn't been installed. For example, if |
| 88 you built the protobuf package for your host machine in ../host, | 121 you built the protobuf package for your host machine in ../host, |
| 89 you might do: | 122 you might do: |
| 90 | 123 |
| 91 ./configure --with-protoc=../host/src/protoc | 124 ./configure --with-protoc=../host/src/protoc |
| 92 | 125 |
| 93 Either way, you must make sure that the protoc executable you use | 126 Either way, you must make sure that the protoc executable you use |
| 94 has the same version as the protobuf source code you are trying to | 127 has the same version as the protobuf source code you are trying to |
| 95 use it with. | 128 use it with. |
| 96 | 129 |
| 97 ** Note for Solaris users ** | 130 **Note for Solaris users** |
| 98 | 131 |
| 99 Solaris 10 x86 has a bug that will make linking fail, complaining | 132 Solaris 10 x86 has a bug that will make linking fail, complaining |
| 100 about libstdc++.la being invalid. We have included a work-around | 133 about libstdc++.la being invalid. We have included a work-around |
| 101 in this package. To use the work-around, run configure as follows: | 134 in this package. To use the work-around, run configure as follows: |
| 102 | 135 |
| 103 ./configure LDFLAGS=-L$PWD/src/solaris | 136 ./configure LDFLAGS=-L$PWD/src/solaris |
| 104 | 137 |
| 105 See src/solaris/libstdc++.la for more info on this bug. | 138 See src/solaris/libstdc++.la for more info on this bug. |
| 106 | 139 |
| 107 ** Note for HP C++ Tru64 users ** | 140 **Note for HP C++ Tru64 users** |
| 108 | 141 |
| 109 To compile invoke configure as follows: | 142 To compile invoke configure as follows: |
| 110 | 143 |
| 111 ./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM" | 144 ./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM" |
| 112 | 145 |
| 113 Also, you will need to use gmake instead of make. | 146 Also, you will need to use gmake instead of make. |
| 114 | 147 |
| 148 **Note for AIX users** |
| 149 |
| 150 Compile using the IBM xlC C++ compiler as follows: |
| 151 |
| 152 ./configure CXX=xlC |
| 153 |
| 154 Also, you will need to use GNU `make` (`gmake`) instead of AIX `make`. |
| 155 |
| 115 C++ Installation - Windows | 156 C++ Installation - Windows |
| 116 ========================== | 157 -------------------------- |
| 117 | 158 |
| 118 If you are using Microsoft Visual C++, see vsprojects/readme.txt. | 159 If you are using Microsoft Visual C++, see cmake/README.md. |
| 119 | 160 |
| 120 If you are using Cygwin or MinGW, follow the Unix installation | 161 If you are using Cygwin or MinGW, follow the Unix installation |
| 121 instructions, above. | 162 instructions, above. |
| 122 | 163 |
| 123 Binary Compatibility Warning | 164 Binary Compatibility Warning |
| 124 ============================ | 165 ---------------------------- |
| 125 | 166 |
| 126 Due to the nature of C++, it is unlikely that any two versions of the | 167 Due to the nature of C++, it is unlikely that any two versions of the |
| 127 Protocol Buffers C++ runtime libraries will have compatible ABIs. | 168 Protocol Buffers C++ runtime libraries will have compatible ABIs. |
| 128 That is, if you linked an executable against an older version of | 169 That is, if you linked an executable against an older version of |
| 129 libprotobuf, it is unlikely to work with a newer version without | 170 libprotobuf, it is unlikely to work with a newer version without |
| 130 re-compiling. This problem, when it occurs, will normally be detected | 171 re-compiling. This problem, when it occurs, will normally be detected |
| 131 immediately on startup of your app. Still, you may want to consider | 172 immediately on startup of your app. Still, you may want to consider |
| 132 using static linkage. You can configure this package to install | 173 using static linkage. You can configure this package to install |
| 133 static libraries only using: | 174 static libraries only using: |
| 134 | 175 |
| 135 ./configure --disable-shared | 176 ./configure --disable-shared |
| 136 | 177 |
| 137 Java and Python Installation | 178 Java and Python Installation |
| 138 ============================ | 179 ---------------------------- |
| 139 | 180 |
| 140 The Java and Python runtime libraries for Protocol Buffers are located | 181 The Java and Python runtime libraries for Protocol Buffers are located |
| 141 in the java and python directories. See the README file in each | 182 in the java and python directories. See the README file in each |
| 142 directory for more information on how to compile and install them. | 183 directory for more information on how to compile and install them. |
| 143 Note that both of them require you to first install the Protocol | 184 Note that both of them require you to first install the Protocol |
| 144 Buffer compiler (protoc), which is part of the C++ package. | 185 Buffer compiler (protoc), which is part of the C++ package. |
| 145 | 186 |
| 146 Usage | 187 Usage |
| 147 ===== | 188 ----- |
| 148 | 189 |
| 149 The complete documentation for Protocol Buffers is available via the | 190 The complete documentation for Protocol Buffers is available via the |
| 150 web at: | 191 web at: |
| 151 | 192 |
| 152 http://code.google.com/apis/protocolbuffers/ | 193 https://developers.google.com/protocol-buffers/ |
| OLD | NEW |