|
@@ -33,6 +33,44 @@ For advanced usage information on configure and make, see INSTALL.txt.
|
|
|
If you already built the package with a different prefix, make sure
|
|
|
to run "make clean" before building again.
|
|
|
|
|
|
+** Compiling dependent packages **
|
|
|
+
|
|
|
+ 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:
|
|
|
+
|
|
|
+ pkg-config --cflags protobuf # print compiler flags
|
|
|
+ pkg-config --libs protobuf # print linker flags
|
|
|
+ pkg-config --cflags --libs protobuf # print both
|
|
|
+
|
|
|
+ For example:
|
|
|
+
|
|
|
+ c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf`
|
|
|
+
|
|
|
+ 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:
|
|
|
+
|
|
|
+ configure CXXFLAGS="$(pkg-config --cflags protobuf)" \
|
|
|
+ LIBS="$(pkg-config --libs protobuf)"
|
|
|
+
|
|
|
+ This will force it to use the correct flags.
|
|
|
+
|
|
|
+ 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:
|
|
|
+
|
|
|
+ PKG_CHECK_MODULES([protobuf], [protobuf])
|
|
|
+
|
|
|
+ See the pkg-config man page for more info.
|
|
|
+
|
|
|
+ If you only want protobuf-lite, substitute "protobuf-lite" in place
|
|
|
+ of "protobuf" in these examples.
|
|
|
+
|
|
|
** Note for cross-compiling **
|
|
|
|
|
|
The makefiles normally invoke the protoc executable that they just
|