Skip to content

Protobufs

Edward A. Lee edited this page Dec 24, 2019 · 11 revisions

Using gRPC with Lingua Franca

The grpc-c git repo includes grpc, protobuf, and protobuf-c as git submodules. Download from here:

https://github.com/Juniper/grpc-c.git

and build using instructions. Below are installation instructions for protobufs alone, without grpc. The install instructions for the above, however, fail with:

configure: error: Could not find grpc.h anywhere, install grpc

You can cd into third_party/grpc and follow the instructions to install grpc. Presumably, you need to do the same for protobuf and protobuf-c, but I had already installed these, so I'm not sure.

Using Protobufs with Lingua Franca

The following has been tested on MacOS. If your platforms differs and the installation procedures differ, please update the wiki with instructions for your platform.

Install Protobufs

Clone the git repository from Github:

git clone https://github.com/protocolbuffers/protobuf.git
git submodule update --init --recursive

Then build:

cd protobuf
./autogen.sh
./configure
make

If you run into this error: autoreconf: failed to run aclocal: No such file or directory, run this:

brew install autoconf && brew install automake

and start over from autogen.sh. Otherwise, if make succeeded, continue:

make check
sudo make install

The make install command installs the binary and library files in standard places, hence the need for sudo. You should now see this:

> which protoc
/usr/local/bin/protoc
> protoc --version
libprotoc 3.11.0

(or some more recent version).

It may be tempting to download binary from https://github.com/protocolbuffers/protobuf/releases/tag/v3.11.1 for your platform, but this will not give you the packages required to compile protobuf-c.

Install protobuf-c

Clone protobuf-c from Github:

git clone https://github.com/protobuf-c/protobuf-c.git

Then build:

cd protobuf-c
./autogen.sh
./configue
make
sudo make install

The last command puts files into /usr/local/include to be included in your C files, hence the need for sudo.

Install gRPC

Instructions for several platforms are here: https://github.com/grpc/grpc/blob/v1.25.0/BUILDING.md The following worked for me on MacOS.

Clone gRPC from Github:

git clone https://github.com/grpc/grpc.git
git submodule update --init --recursive

Then build:

make

Install protobuf-c-rpc

Clone protobuf-c-rpc from Github: https://github.com/protobuf-c/protobuf-c-rpc.git. Then build:

cd protobuf-c-rpc
./autogen.sh
./configue
make

FIXME: The above fails for me with this:

EALMAC:protobuf-c-rpc eal$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
CCLD     protobuf-c-rpc/libprotobuf-c-rpc.la
Undefined symbols for architecture x86_64:
  "_protobuf_c_buffer_simple_append", referenced from:
      _server_connection_response_closure in protobuf-c-rpc-server.o