capnproto/capnpc-rust

Compiling the example fails with "Premature EOF"

clamydo opened this issue · 4 comments

After cloning this repository and cding into the examples/addressbook directory

cargo build --release                                                                                                                                                    
   Compiling byteorder v0.4.2
   Compiling capnp v0.6.2
   Compiling capnpc v0.6.0 (file:///PATH/capnpc-rust)
   Compiling addressbook v0.0.0 (file:///PATHt/capnpc-rust/example/addressbook)
       error failed to run custom build command for `addressbook v0.0.0 (file://PATH/capnpc-rust/example/addressbook)`
Process didn't exit successfully: `PATH/capnpc-rust/example/addressbook/target/release/build/addressbook-202ecf71d1cf3aa5/build-script-build` (exit code: 101)
--- stderr
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Failed, description: "Premature EOF" }', ../src/libcore/result.rs:746
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Failed, description: "Premature EOF" }', ../src/libcore/result.rs:746
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Doing a manual

capnp-rust compile -orust:out --src-prefix=. addressbook.capnp

where capnp-rust is the bin compile from this crate, just never terminates. Am I doing something wrong?

Do I need the capnp binary from the website, to compule the scheme files?

Got it,the Cap'n Proto scheme file compile has to be installed from https://capnproto.org/install.html.
Could you please document this somewhere?

Hi! Thanks for reporting this.

The error ought to display a message pointing you to https://capnproto.org/install.html . In your case, it looks like somehow this call to command.spawn() succeeds, even though the capnp executable is not installed on your system. I'm interested in figuring out how that could happen. What operating system are you on?

The solution is probably to bubble that map_err() call out a bit, so that it would have caught the error in your case.

This is on Debian 8 using Rust nightly.

Fixed in da15eac and released in version 0.6.1.

I guess that command.spawn() was succeeding because your package manager was displaying something like "The program capnp is not installed on the system. To install it, do apt-get capnproto".