#### Beyond Linux® From Scratch (systemd Edition) - Version r13.0-491

### Chapter 9. General Libraries

- Prev

  Popt-1.19

- Next

  Protobuf-c-1.5.2

- Up
- Home

# Protobuf-34.1

## Introduction to Protobuf

The Protobuf package contains utilities and libraries for using data in Google's data interchange format.

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://github.com/protocolbuffers/protobuf/releases/download/v34.1/protobuf-34.1.tar.gz

- Download MD5 sum: e47d104c917c9297b6241c87f27a9558

- Download size: 6.8 MB

- Estimated disk space required: 113 MB

- Estimated build time: 1.2 SBU (with parallelism=4)

### Protobuf Dependencies

#### Required

Abseil-cpp-20260107.1 and CMake-4.3.2

#### Optional

gtest (for tests)

## Installation of Protobuf

Install Protobuf by running the following commands:

    mkdir build &&
    cd    build &&

    cmake -D CMAKE_INSTALL_PREFIX=/usr      \
          -D CMAKE_BUILD_TYPE=Release       \
          -D CMAKE_SKIP_INSTALL_RPATH=ON    \
          -D protobuf_BUILD_TESTS=OFF       \
          -D protobuf_BUILD_SHARED_LIBS=ON  \
          -G Ninja ..                       &&
    ninja

This package does come with a test suite, but it requires gtest, which is not part of BLFS.

Now, as the `root` user:

    ninja install

## Command Explanations

`-D CMAKE_SKIP_INSTALL_RPATH=ON`: This switch makes cmake remove hardcoded library search paths (rpath) when installing a binary executable file or a shared library. This package does not need rpath once it's installed into the standard location, and rpath may sometimes cause unwanted effects or even security issues.

`-D protobuf_BUILD_TESTS=OFF`: This parameter prevents the tests from being built because gtest is not part of BLFS.

`-D protobuf_BUILD_SHARED_LIBS=ON`: This parameter enables building shared versions of the libraries provided by this package instead of static versions.

## Contents

Installed Programs: protoc (a symlink to protoc-34.1.0), protoc-gen-upb (a symlink to protoc-gen-upb-34.1.0), and protoc-gen-upbdefs (a symlink to protoc-gen-upbdefs-34.1.0) protoc-gen-upb_minitable(a symlink to protoc-gen-upb_minitable-34.1.0)
Installed Libraries: libprotobuf.so, libprotobuf-lite.so, libprotoc.so, libupb.a, libutf8_range.so, and libutf8_validity.so
Installed Directories: /usr/include/google, /usr/include/upb, /usr/lib/cmake/protobuf, and /usr/lib/cmake/utf8_range

### Short Descriptions

protoc | parses protocol buffer files and generates output for several programming languages and formats
`libprotobuf.so` | contains functions for utilizing data in Google's data interchange format
`libprotobuf-lite.so` | contains a simpler version of the functions for utilizing data in Google's data interchange format
`libprotoc.so` | contains functions used by protoc at runtime for outputting data for several programming languages and formats
`libupb.a` | is a small protobuf implementation written in C
`libutf8_range.so` | contains functions that allow a program to determine whether a sequence of characters is a valid UTF-8 sequence
`libutf8_validity.so` | contains functions that allow a program to determine whether a sequence of bytes is a valid UTF-8 sequence, and to find what the longest valid prefix of the sequence is

- Prev

  Popt-1.19

- Next

  Protobuf-c-1.5.2

- Up
- Home