Skip to content

Instantly share code, notes, and snippets.

@l2dy
Last active April 12, 2016 15:11
Show Gist options
  • Save l2dy/b8a5d0fac7ea91b0234d to your computer and use it in GitHub Desktop.
Save l2dy/b8a5d0fac7ea91b0234d to your computer and use it in GitHub Desktop.

Protobuf-C For Embedded Developers (and other cross compilers)

TODO: move these general comments to a new page and provide an example, as promised by the page title.

Most embedded developers need to compile protobuf-c twice: 1. they need a copy of protoc-c that runs on their build environment (the build environment is for the machine on which they develop the application. 1. they need to have a copy of libprotobuf-c, which is the runtime library, that is compiled for the embedded platform (which we will call the target environment).

For (1), you need to install the main protobuf package, since protoc-c uses its parser and code generator libraries. Running 'configure' as usual should be fine.

For (2), you can configure with --disable-protoc which means you won't have to build the main protobuf package for the embedded platform (since you don't need to do code gen on the embedded platform). The usual details of cross-compilation for your specific embedded platform apply. Sometimes merely providing the name of the platform to configure suffices (as in, ./configure atmel)-- but other environments need a mass of overrides like CC=atmel-cc LD=atmel-ld.

If embedded developers do not modify the .proto files, then then all they really need are the generated .pb-c.ch files, and then they can skip (1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment