I (a random Rust/C Cap'n Proto user) started helping Tanguille on the
Discord and then saw their emails here, so I'll reply here in case
others find it in a search.

> I needed to understand that capnp disables the use of the std lib

Even though we accounted for what was happening here, just for future
readers — it's more than that. There's some weird interaction with
transitive dependencies and features (ie. conditional compilation
flags) in build scripts that I don't understand. I don't think it's
capnp or capnpc specific. I am going to see if I can repro it and post
an issue to the appropriate project.

> The build seems to have worked when I use the absolute path, while the 
> examples can use just the filename or schema/filename. For me it searches in 
> the root dir when doing that, any idea why that could be?

It's hard to tell without more information, so you should provide some
example compiler output (with any obvious noise removed). Strip out
anything not Cap'n Proto related from a project and try with that. All
the paths in the builder are relative to your project directory ie.
the one containing Cargo.toml.

> The other problem I'm facing is that I can't see the actual files the 
> compiler created. Where should I expect those files?

These will appear in Cargo's target directory, which may be different
for different runs. The full path includes a hash that's designed to
allow certain kinds of caching but without causing invalid stale
builds to ruin your process. You almost certainly shouldn't specify
your OUT_DIR yourself. It's documented here:

https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts

For example, my generated files (for your sandbox project) appear at
this path relative to the project root:

target/debug/build/sandbox-81257fcdc875cd8e/out/user_capnp.rs

It works fine for me if I have:

capnpc::CompilerCommand::new()
    .src_prefix("src/schema")
    .file("src/schema/user.capnp")

...in build.rs and:

pub mod user_schema {
    include!(concat!(env!("OUT_DIR"), "/user_capnp.rs"));
}

...in lib.rs. If yours doesn't, it could be environment-related.

Cheers,
Jason

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CA%2BZd3Fe3CoTgN0ZFnwv%3Dvm_uJFra%3DQi0q%3DdtweD3xnu%3DYriZsw%40mail.gmail.com.

Reply via email to