How to build protobuf with zlib

How to build protobuf with zlib

I recently worked on a task to deliver protobuf messages through Keryx. I needed to cache these messages in memory and on disk and discovered that the messages were uncompressed. I was glad to find that the protobuf C++ API provides zlib-based compression, since this is a good enough way to quickly reduce storage size and delivery time. Protobuf provides the GzipOutputStream and GzipInputStream classes in the google::protobuf::io namespace. These classes are defined in google/protobuf/io/gzip_stream.h. However, a few linker errors revealed zlib support was not enabled in my initial protobuf build. Windows is the main development environment and target for Keryx, so this guide will explain how to enable zlib compression for protobuf 3.5.1 built from source using Visual Studio 2015. The process for building with Visual Studio 2017 should be similar. A simpler approach is to install protobuf with zlib support using vcpkg: [crayon-6826071b370d6141719054/] You can learn more about vcpkg at GitHub. This guide will instead explain how to manually clone and build...
Read More