capnproto-rust
capnproto-rust copied to clipboard
Please consider making a build script to build the actual C library
The crates documentation discusses build scripts where you would have a git submodule in tree which is built. Usually this is done in a separate -sys
crate but there's no requirement. Building the underlying library is done because there is a desire to reduce the dependencies on system wide installed libraries since it results in inconsistent behaviour. It also means that when cargo has built a package, it's ready to go and doesn't result in errors like these.
Interesting suggestion! I guess we could basically follow the pattern of libgit2-sys and add a submodule pointing to the capnp compiler source code. I think it would make sense to bundle this as part of the capnpc crate rather than create an entirely new crate. Note that the -sys
suffix usually implies linking to native libraries and using the foreign function interface --- which capnpc does not do. Rather, it is a "schema compiler plugin", and invokes the upstream capnp
as an executable, not a library.
Note also that building the capnp
executable requires a recent-ish c++ compiler plus autotools or cmake. So it's not like we'd be completely eliminating the dependencies on non-Rust things.
I guess we could basically follow the pattern of libgit2-sys and add a submodule pointing to the capnp compiler source code. I think it would make sense to bundle this as part of the capnpc crate rather than create an entirely new crate.
I think that's a good idea. The crates that @alexcrichton works on also tend to use pkg-config
and a few other heuristics to see if a library is installed. This could be used to see if capnp is installed.
Note that the -sys suffix usually implies linking to native libraries and using the foreign function interface --- which capnpc does not do. Rather, it is a "schema compiler plugin", and invokes the upstream capnp as an executable, not a library.
I hadn't realized that when I made the ticket. I'm not sure how that is/should be handled.
Note also that building the capnp executable requires a recent-ish c++ compiler plus autotools or cmake. So it's not like we'd be completely eliminating the dependencies on non-Rust things.
Maybe just sticking the dependencies and required versions in the README.md will be 70-80% of the solution.