Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[C++] Linking against generated protobuf files from multiple projects

49 views
Skip to first unread message

Aldrin

unread,
Sep 12, 2024, 4:08:13 PM9/12/24
to Protocol Buffers
Hello!

I am trying to figure out how to make this work and hitting issues with every approach I have tried.

The core of my scenario can be seen here Gist - protobuf dependency graph. I have my own project mohair (we can call "A") and I am trying to link against duckdb (we can call "B"), and both use substrait (we can call "ProtoLib") and arrow (we can call "C").

I am hoping to find some reasonable solution to the above that either uses only cmake (used by duckdb), or is build system diagnostic (I prefer to use meson). Below, I describe what I have tried and what errors I get.

When building duckdb and arrow together (B + C + ProtoLib), all is well. When building mohair and arrow together (A + C + ProtoLib), all is well. When building mohair and duckdb and arrow together (A + B + C + ProtoLib), I get one of a variety of errors:
* with duckdb's vendored protobuf sources, I get version mismatch on protoc
* when updating duckdb's vendored protobuf sources, I get duplicate descriptor errors (sharing a pool without sharing descriptors?)
* when migrating substrait to its own library, which I link against from duckdb and mohair, I get either: (1) undefined symbol errors (trying to change which library links protobuf) or (2) duplicate descriptor errors
* when trying to build everything together (in hopes of explicitly reusing the same descriptors), I have various build issues

As far as building everything together, I am customizing duckdb extensions which seem to be required to be out-of-source. However, building it as a meson subproject seemingly requires the extensions to be in-source. The last thing I am going to try is to build everything together using cmake only, but this will not work beyond this prototype and I need a portable solution.

Thank you for any help!

Aldrin

unread,
Sep 17, 2024, 1:49:35 PM9/17/24
to Protocol Buffers
Thank you, this is solved now.
Reply all
Reply to author
Forward
0 new messages