Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use protobuf-codegen-pure crate #307

Closed
jamesray1 opened this issue Jun 15, 2018 · 9 comments
Closed

Can't use protobuf-codegen-pure crate #307

jamesray1 opened this issue Jun 15, 2018 · 9 comments

Comments

@jamesray1
Copy link
Contributor

libp2p/rust-libp2p#183 (comment)

@eira-fransham
Copy link

The issue is that it generates code using ::protobuf::reflect::accessor, which is a private module.

@jamesray1
Copy link
Contributor Author

I see. So what is the best way to fix this?

@stepancheg
Copy link
Owner

Could you please provide an example which doesn't work? .proto file and command used? Ideally a small crate example.

I tried this https://github.com/jamesray1/rust-libp2p/tree/master/floodsub, it works with this patch:

diff --git a/floodsub/Cargo.toml b/floodsub/Cargo.toml
index 0d187c7..392eedb 100644
--- a/floodsub/Cargo.toml
+++ b/floodsub/Cargo.toml
@@ -17,3 +17,6 @@ protobuf = "2"
 smallvec = "0.6.0"
 tokio-io = "0.1"
 varint = { path = "../varint-rs" }
+
+[build-dependencies]
+protobuf-codegen-pure = "2"
diff --git a/floodsub/build.rs b/floodsub/build.rs
index dc63fab..53cfd25 100644
--- a/floodsub/build.rs
+++ b/floodsub/build.rs
@@ -1,9 +1,12 @@
 extern crate protobuf_codegen_pure;
 
+fn main() {
 protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
     out_dir: "src",
-    input: "rpc.proto",
+    input: &["rpc.proto"],
+    includes: &[""],
     customize: protobuf_codegen_pure::Customize {
       ..Default::default()
     },
-}).expect("protoc");
\ No newline at end of file
+}).expect("protoc");
+}

@eira-fransham
Copy link

eira-fransham commented Jun 18, 2018

Looks like it works, there was just a leftover file generated by the previous version (in relay, same project).

@jamesray1
Copy link
Contributor Author

jamesray1 commented Jun 20, 2018

If fails on Windows (normally I use Linux, but I need to use Windows on my desktop as my WiFi extender to connect to the desktop via Ethernet has gone missing and there is limited WiFi support for Linux desktops, and my laptop also keeps freezing with Manjaro Linux):

error: failed to run custom build command for ring v0.12.1 (https://github.com/briansmith/ring?rev=3a14ef619559f7d4b69e2286d49c833409eef34a#3a14ef61)

Full output: https://gist.github.com/jamesray1/923e16382a7df268c775dfe86f549d88. File an issue with @briansmith?

@stepancheg
Copy link
Owner

Protobuf doesn’t depend on ring. Are you trying to use grpc?

@jamesray1
Copy link
Contributor Author

jamesray1 commented Jun 20, 2018

Not that I'm aware of.

I'm on Windows 10, Visual Studio, RLS is installed, and the terminal is bash: "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe".

I installed VS with the C++ build tools.

@stepancheg
Copy link
Owner

What project are trying to compile? I assume it’s rust-libp2p which likely depends on ring. So it’s not rust-protobuf issue, and you should probably post comments there.

@jamesray1
Copy link
Contributor Author

Yeah, true, it's rust-libp2p, will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants