Hi,
I'm one of the maintainers for protobuf-c, a Protocol Buffers
implementation in C (
https://github.com/protobuf-c/protobuf-c). I'm
considering replacing our existing autotools and cmake build systems
with a meson build system. I started porting the build system yesterday,
without having any previous experience with meson.
Here is what I have so far, which seems to be largely feature complete
compared to the autotools build system:
https://github.com/protobuf-c/protobuf-c/tree/edmonds/meson-build-system
(the development branch)
https://github.com/protobuf-c/protobuf-c/compare/next...edmonds/meson-build-system?expand=1
(the development branch compared against its merge target)
https://travis-ci.org/protobuf-c/protobuf-c/builds/423769279
(the most recent CI build log)
How does this look so far?
I also have a few questions:
1)
protobuf-c has a dependency on Google's protobuf, which in the CI
environment is built from source and installed to a non-system path, to
avoid needing root privileges (and also because this is how some users
install the protobuf dependency). During the build, a helper utility has
to be linked against the protobuf library and executed to generate data
for other build steps (the 'cxx-generate-packed-data' utility).
Previously, all I had to do was set the PKG_CONFIG_PATH environment
variable and autotools was able to pick up the protobuf dependency and
run the helper utility during the build.
With meson, I have to set LD_LIBRARY_PATH in addition to
PKG_CONFIG_PATH, or otherwise the build will fail when invoking the
built utility with an error like:
/tmp/protobuf-c/build/cxx-generate-packed-data: error while loading shared libraries: libprotobuf.so.17: cannot open shared object file: No such file or directory
Is there a way to get this to work without having to manually set
LD_LIBRARY_PATH in the build environment?
2)
At least on Linux, we need to install a few symlinks. The library's
public header file is installed so that it should be included as
'#include <protobuf-c/protobuf-c.h>', but for historical reasons it also
needs to be accessible as '#include <google/protobuf-c/protobuf-c.h>'
(eventually this compatibility symlink will be dropped).
The protobuf-c compiler (protoc-c) is also usable as a plugin for the
protobuf compiler (protoc), but in order to do so the plugin binary must
be named 'protoc-gen-c'. So the protobuf-c compiler changes behavior
based on whether it's invoked as 'protoc-c' or 'protoc-gen-c'.
It looks like meson does not have built-in support for symlinks, so I've
resorted to shelling out directly to 'mkdir -p' and 'ln -s'. Is there a
better way to do this? I would imagine this just doesn't work on
Windows, and the reason protobuf-c even has a cmake build system in the
first place is to support Windows users. (We can probably get away with
just not installing the symlinks on Windows.)
3)
protobuf-c is somewhat popular with developers that cross-compile to
embedded systems. Is there anything special I need to do to support
these kinds of users?
Thanks!
--
Robert Edmonds
edm...@debian.org