You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Rust, via ::capnpc::CompilerCommand. If I put this in my .capnp file:
using Rust = import "rust.capnp";
Then I get this error
error: Import failed: rust.capnp
I think the "proper" solution is to add include paths to the compile command that point to /usr/include/capnp or something like that. But that is rubbish. I shouldn't have to figure out where those files are (on every platform too!) when Capnp could just bundle them itself.
To use the new feature, you need to import rust.capnp. Probably the easiest way to do that is to copy it and include it among your own schema files.
It's easier to just copy the files into your project than to do it the "proper" way.
I suggest adding the standard include path as a compile time constant to the compiler. Similar to how C++ compilers always include /usr/include without you having to explicitly ask for it.
An alternative possibly more robust approach would be to create some kind of virtual file system and embed the files in the binary during compilation. I think that is the best approach but it is a little more work.
The text was updated successfully, but these errors were encountered:
add include paths to the compile command that point to /usr/include/capnp
The schema compiler already does that by default. (It can be disabled via --no-standard-import.) The problem is that rust.capnp is not a part of the main capnproto-c++ distribution. Maybe we should submit a pull request to https://github.com/capnproto/capnproto to add it, though I'm not super excited by the idea of needing to keep that in sync with this repo.
An alternative possibly more robust approach would be to create some kind of virtual file system and embed the files in the binary during compilation
It's not clear to me what you mean by "virtual file system". Anything I can think of along those lines would be platform-dependent and therefore involve a lot of work.
I still think the best solution would be to fix rust-lang/cargo#3544 and then include the file from the cargo dependency.
I'm using Rust, via
::capnpc::CompilerCommand
. If I put this in my.capnp
file:Then I get this error
I think the "proper" solution is to add include paths to the compile command that point to
/usr/include/capnp
or something like that. But that is rubbish. I shouldn't have to figure out where those files are (on every platform too!) when Capnp could just bundle them itself.Note this comment:
It's easier to just copy the files into your project than to do it the "proper" way.
I suggest adding the standard include path as a compile time constant to the compiler. Similar to how C++ compilers always include
/usr/include
without you having to explicitly ask for it.An alternative possibly more robust approach would be to create some kind of virtual file system and embed the files in the binary during compilation. I think that is the best approach but it is a little more work.
The text was updated successfully, but these errors were encountered: