protoc-gen-c command not found

In this troubleshooting guide we learn how to fix protoc-gen-c command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

protoc-gen-c: command not found

or when using sudo you get the following error message

sudo: protoc-gen-c: command not found

Solutions to protoc-gen-c: command not found

How To Fix protoc-gen-c: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu protoc-gen-c is provided by protobuf-c-compiler package.

protobuf-c-compiler is:

Protocol Buffers are a flexible, efficient, automated mechanism for serializing structured data - similar to XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the “old” format.

This is the “protobuf-c” implementation of Protocol Buffers in C.

This package contains the “protoc-c” code generator that creates C stubs from Protocol Buffers .proto files. These stubs must be compiled and linked against the libprotobuf-c support library.

To fix this problem, we can install more using the command below.

sudo apt-get -y install protobuf-c-compiler

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install protobuf-c-compiler.

sudo apt -y install protobuf-c-compiler

Or if you have aptitude installed you can use the following command.

sudo aptitude install protobuf-c-compiler

Summary

In this tutorial we learn how to fix protoc-gen-c command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.