stepancheg / grpc-rust

Rust implementation of gRPC
MIT License
1.37k stars 124 forks source link

cannot install protobuf and grpc-compiler #118

Closed felberj closed 6 years ago

felberj commented 6 years ago
16:20[tdb]$ cargo install protobuf
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading protobuf v1.6.0                                                    
  Installing protobuf v1.6.0                                                    
error: specified package has no binaries
❌ code 101
16:20[tdb]$ cargo install grpc-compiler
    Updating registry `https://github.com/rust-lang/crates.io-index`
  Installing grpc-compiler v0.3.0
   Compiling protobuf v1.6.0
   Compiling grpc-compiler v0.3.0
error[E0432]: unresolved import `protobuf::code_writer`
 --> src/codegen.rs:5:15
  |
5 | use protobuf::code_writer::CodeWriter;
  |               ^^^^^^^^^^^ Could not find `code_writer` in `protobuf`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: failed to compile `grpc-compiler v0.3.0`, intermediate artifacts can be found at `/var/folders/2c/f2h4tggn2f598897sff8hn3h0000gp/T/cargo-install9Eez0W`

Caused by:
  Could not compile `grpc-compiler`.

To learn more, run the command again with --verbose.
❌ code 101
16:25[tdb]$ rustc --version
rustc 1.26.0 (a77568041 2018-05-07)

rustc: 1.26.0 (a77568041 2018-05-07) OS: macOS high sierra

I can also reproduce this with the rust:1.26 docker container:

root@554cfa04fb67:/# cargo install protobuf
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading protobuf v1.6.0                                                    
  Installing protobuf v1.6.0                                                    
error: specified package has no binaries
root@554cfa04fb67:/# cargo install grpc-compiler
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading grpc-compiler v0.3.0
  Installing grpc-compiler v0.3.0                                               
   Compiling protobuf v1.6.0
   Compiling grpc-compiler v0.3.0
error[E0432]: unresolved import `protobuf::code_writer`
 --> src/codegen.rs:5:15
  |
5 | use protobuf::code_writer::CodeWriter;
  |               ^^^^^^^^^^^ Could not find `code_writer` in `protobuf`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: failed to compile `grpc-compiler v0.3.0`, intermediate artifacts can be found at `/tmp/cargo-installAqs9c1`

Caused by:
  Could not compile `grpc-compiler`.

To learn more, run the command again with --verbose.
root@554cfa04fb67:/# 
repi commented 6 years ago

Just ran into this problem myself also. The code worked a few days ago but it looks like in the last few days there were a few updates to a couple of related libraries and latest grpc-compiler crate does indeed not build. If one syncs down this repo and builds latest in grpc-compiler directory it works though because it then uses protobuf 1.5.1 instead of the latest 1.6.0.

I've filed a PR (https://github.com/stepancheg/grpc-rust/pull/119) that should fix this

stepancheg commented 6 years ago

I have updated the readme, and updated grpc to force protobuf 1.5; published version 0.3.1.

Sorry!

repi commented 6 years ago

Thanks that solved it!

eberkund commented 6 years ago

@stepancheg can we expect a 0.4 branch that uses protobuf 1.6? Or what would be the recommended way to use 1.6 right now?

Thanks

stepancheg commented 6 years ago

I plan to upgrade grpc to newer protobuf soon and release a new branch.

Hope it will be as easy as PR #119.

However, note that one of the important features of rust-protobuf 1.6 is pure-rust codegen (without dependency on protoc command). To make grpc-compiler available without dependency on protoc, it may require some work. So pure-rust codegen for grpc won't be available soon.

eberkund commented 6 years ago

Thanks for the quick reply, eagerly awaiting 1.6 with public oneof enum generation 😃

stepancheg commented 6 years ago

Published version 0.4.0