Comments (27)
@EvgenKor, the problem here is related to the protoc_rust
crate. Its run
function takes paths relative to the crate root. In my case the relative paths in build.rs work OK and the final absolute path is the crate root concatenated with the relative paths. In your case the base path is instead the build script working directory, which leads to incorrect behaviour. I tried computing and supplying absolute paths in build.rs, but it looks like protoc_rust
cannot work with absolute paths. This is what I tried:
use std::env;
extern crate protoc_rust;
fn generate_proto_rs() {
let current_dir = env::current_dir().unwrap();
let protoc_out_dir = current_dir.join("src").join("proto");
let protoc_input = current_dir.join("proto").join("message.proto");
let protoc_output = current_dir.join("src").join("proto")
.join("message.rs");
let rerun_on_input_change =
format!("cargo:rerun-if-changed={}", protoc_input.to_str().unwrap());
let rerun_on_output_change =
format!("cargo:rerun-if-changed={}", protoc_output.to_str().unwrap());
println!("{}", rerun_on_input_change);
println!("{}", rerun_on_output_change);
protoc_rust::run(protoc_rust::Args {
out_dir: protoc_out_dir.to_str().unwrap(),
input: &[protoc_input.to_str().unwrap()],
includes: &[],
}).expect("protoc");
}
fn main() {
generate_proto_rs();
}
Can you try on your Mac? If it doesn't work - which is likely - please try to compile in Linux.
from hbbft.
@EvgenKor, try this branch and let me know what errors you have on your Mac: https://github.com/poanetwork/hbbft/tree/proto-build
from hbbft.
thread 'main' panicked at 'protoc: Error { repr: Os { code: 2, message: "No such file or directory" } }', src/libcore/result.rs:916:5
This looks like it can't find the protoc
binary; is it installed and in the path?
from hbbft.
from hbbft.
@EvgenKor, try this branch and let me know what errors you have on your Mac: https://github.com/poanetwork/hbbft/tree/proto-build
@vkomenda, the same error occured:
error: failed to run custom build command for `hbbft v0.1.0 (file:///Projects/hbbft)`
process didn't exit successfully: `/Projects/hbbft/target/debug/build/hbbft-b8fd1374e3e5d302/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=/Projects/hbbft/proto/message.proto
cargo:rerun-if-changed=/Projects/hbbft/src/proto/message.rs
--- stderr
thread 'main' panicked at 'protoc: Error { repr: Os { code: 2, message: "No such file or directory" } }', src/libcore/result.rs:916:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:68
at src/libstd/sys_common/backtrace.rs:57
at src/libstd/panicking.rs:381
2: std::panicking::default_hook
at src/libstd/panicking.rs:397
3: std::panicking::begin_panic
at src/libstd/panicking.rs:577
4: std::panicking::begin_panic
at src/libstd/panicking.rs:538
5: std::panicking::try::do_call
at src/libstd/panicking.rs:522
6: std::panicking::try::do_call
at src/libstd/panicking.rs:498
7: <core::ops::range::Range<Idx> as core::fmt::Debug>::fmt
at src/libcore/panicking.rs:71
8: core::result::unwrap_failed
at /Users/travis/build/rust-lang/rust/src/libcore/macros.rs:23
9: <core::result::Result<T, E>>::expect
at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:809
10: build_script_build::generate_proto_rs
at ./build.rs:18
11: build_script_build::main
at ./build.rs:26
12: std::rt::lang_start::{{closure}}
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
13: std::panicking::try::do_call
at src/libstd/rt.rs:59
at src/libstd/panicking.rs:480
14: panic_unwind::dwarf::eh::read_encoded_pointer
at src/libpanic_unwind/lib.rs:101
15: std::sys_common::bytestring::debug_fmt_bytestring
at src/libstd/panicking.rs:459
at src/libstd/panic.rs:365
at src/libstd/rt.rs:58
16: std::rt::lang_start
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
17: build_script_build::main
from hbbft.
I have a different error in proto-build branch
macOS 10.13.4
~> cargo -V
cargo 0.20.0 (a60d185c8 2017-07-13)
proto-build ~/r/hbbft> cargo build
Compiling parking_lot_core v0.2.13
Compiling reed-solomon-erasure v3.0.3
Compiling crossbeam-epoch v0.2.0
Compiling protoc-rust v1.5.1
error: associated constants are experimental (see issue #29646)
--> /Users/igor/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-epoch-0.2.0/src/internal.rs:52:5
|
52 | const COLLECT_STEPS: usize = 8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: associated constants are experimental (see issue #29646)
--> /Users/igor/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-epoch-0.2.0/src/internal.rs:188:5
|
188 | const PINNINGS_BETWEEN_COLLECT: usize = 128;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error(s)
error: Could not compile `crossbeam-epoch`.
Build failed, waiting for other jobs to finish...
error: build failed
exit 101
from hbbft.
from hbbft.
~> rustc --version
rustc 1.19.0 (0ade33941 2017-07-17)
from hbbft.
from hbbft.
@EvgenKor, the problem here is related to the protoc_rust crate. Its run function takes paths relative to the crate root. In my case the relative paths in build.rs work OK and the final absolute path is the crate root concatenated with the relative paths. In your case the base path is instead the build script working directory, which leads to incorrect behaviour. I tried computing and supplying absolute paths in build.rs, but it looks like protoc_rust cannot work with absolute paths. This is what I tried:
use std::env;
extern crate protoc_rust;fn generate_proto_rs() {
let current_dir = env::current_dir().unwrap();
let protoc_out_dir = current_dir.join("src").join("proto");
let protoc_input = current_dir.join("proto").join("message.proto");
let protoc_output = current_dir.join("src").join("proto")
.join("message.rs");
let rerun_on_input_change =
format!("cargo:rerun-if-changed={}", protoc_input.to_str().unwrap());
let rerun_on_output_change =
format!("cargo:rerun-if-changed={}", protoc_output.to_str().unwrap());println!("{}", rerun_on_input_change); println!("{}", rerun_on_output_change); protoc_rust::run(protoc_rust::Args { out_dir: protoc_out_dir.to_str().unwrap(), input: &[protoc_input.to_str().unwrap()], includes: &[], }).expect("protoc");
}
fn main() {
generate_proto_rs();
}
Can you try on your Mac? If it doesn't work - which is likely - please try to compile in Linux.
BTW, I compiled this code successfully. But when I try to run it, I get the same error. Both OS X 10.13.3 (ruustc ver 1.24.1) and Ubuntu Server 16.04 LTS (rustc ver 1.22.1). I was add protoc-rust
in the Cargo.toml
as following:
[dependencies]
protoc-rust = "1.4.4"
OS X output:
Evgens-MacBook-Pro:rustest user$ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/rustest`
cargo:rerun-if-changed=/Projects/rustest/proto/message.proto
cargo:rerun-if-changed=/Projects/rustest/src/proto/message.rs
thread 'main' panicked at 'protoc: Error { repr: Os { code: 2, message: "No such file or directory" } }', src/libcore/result.rs:916:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:68
at src/libstd/sys_common/backtrace.rs:57
at src/libstd/panicking.rs:381
2: std::panicking::default_hook
at src/libstd/panicking.rs:397
3: std::panicking::begin_panic
at src/libstd/panicking.rs:577
4: std::panicking::begin_panic
at src/libstd/panicking.rs:538
5: std::panicking::try::do_call
at src/libstd/panicking.rs:522
6: std::panicking::try::do_call
at src/libstd/panicking.rs:498
7: <core::ops::range::Range<Idx> as core::fmt::Debug>::fmt
at src/libcore/panicking.rs:71
8: core::result::unwrap_failed
at /Users/travis/build/rust-lang/rust/src/libcore/macros.rs:23
9: <core::result::Result<T, E>>::expect
at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:809
10: rustest::generate_proto_rs
at src/main.rs:18
11: rustest::main
at src/main.rs:26
12: std::rt::lang_start::{{closure}}
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
13: std::panicking::try::do_call
at src/libstd/rt.rs:59
at src/libstd/panicking.rs:480
14: panic_unwind::dwarf::eh::read_encoded_pointer
at src/libpanic_unwind/lib.rs:101
15: std::sys_common::bytestring::debug_fmt_bytestring
at src/libstd/panicking.rs:459
at src/libstd/panic.rs:365
at src/libstd/rt.rs:58
16: std::rt::lang_start
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
17: rustest::main
Ubuntu output:
~/rustest$ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/rustest`
cargo:rerun-if-changed=/home/evgen/rustest/proto/message.proto
cargo:rerun-if-changed=/home/evgen/rustest/src/proto/message.rs
thread 'main' panicked at 'protoc: Error { repr: Os { code: 2, message: "No such file or directory" } }', src/libcore/result.rs:906:4
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: std::panicking::rust_panic_with_hook
5: std::panicking::begin_panic
6: std::panicking::begin_panic_fmt
7: rust_begin_unwind
8: core::panicking::panic_fmt
9: core::result::unwrap_failed
at src/libcore/macros.rs:23
10: <core::result::Result<T, E>>::expect
at src/libcore/result.rs:799
11: rustest::generate_proto_rs
at src/main.rs:18
12: rustest::main
at src/main.rs:26
13: __rust_maybe_catch_panic
14: std::rt::lang_start
15: main
16: __libc_start_main
17: _start
I used clean Rust installation. Should I install additional items?
from hbbft.
from hbbft.
Thank you, now I have the same problem as Eugene 😬
Compiling merkle v1.5.1-pre (https://github.com/vkomenda/merkle.rs?branch=public-proof#f34be0aa)
error: failed to run custom build command for `hbbft v0.1.0 (file:///Users/igor/r/hbbft)`
process didn't exit successfully: `/Users/igor/r/hbbft/target/debug/build/hbbft-1cdba426f8aa7dea/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=/Users/igor/r/hbbft/proto/message.proto
cargo:rerun-if-changed=/Users/igor/r/hbbft/src/proto/message.rs
--- stderr
thread 'main' panicked at 'protoc: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
exit 101
proto-build ~/r/hbbft>
from hbbft.
from hbbft.
@vkomenda I installed protobuf-compiler
package @ Ubuntu with sudo apt install protobuf-compiler
and I can run protoc
within my console. The same error occured
from hbbft.
from hbbft.
@vkomenda I compiled your simple example:
use std::env;
extern crate protoc_rust;
fn generate_proto_rs() {
let current_dir = env::current_dir().unwrap();
let protoc_out_dir = current_dir.join("src").join("proto");
let protoc_input = current_dir.join("proto").join("message.proto");
let protoc_output = current_dir.join("src").join("proto")
.join("message.rs");
let rerun_on_input_change =
format!("cargo:rerun-if-changed={}", protoc_input.to_str().unwrap());
let rerun_on_output_change =
format!("cargo:rerun-if-changed={}", protoc_output.to_str().unwrap());
println!("{}", rerun_on_input_change);
println!("{}", rerun_on_output_change);
protoc_rust::run(protoc_rust::Args {
out_dir: protoc_out_dir.to_str().unwrap(),
input: &[protoc_input.to_str().unwrap()],
includes: &[],
}).expect("protoc");
}
fn main() {
generate_proto_rs();
}
from hbbft.
from hbbft.
@vkomenda, build-time error is happened :(
evgen@Caesar:~/test/hbbft$ cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
Updating git repository `https://github.com/vkomenda/merkle.rs`
Downloading ring v0.12.1
Downloading crossbeam-channel v0.1.2
Downloading simple_logger v0.5.0
Downloading crossbeam v0.3.2
Downloading reed-solomon-erasure v3.0.3
Downloading untrusted v0.5.1
Downloading rayon v0.8.2
Downloading gcc v0.3.54
Downloading rayon-core v1.4.0
Downloading crossbeam-deque v0.2.0
Downloading num_cpus v1.8.0
Downloading lazy_static v1.0.0
Downloading crossbeam-epoch v0.3.1
Downloading crossbeam-utils v0.2.2
Downloading scopeguard v0.3.3
Downloading arrayvec v0.4.7
Downloading memoffset v0.2.1
Downloading nodrop v0.1.12
Downloading crossbeam-epoch v0.2.0
Downloading parking_lot v0.4.8
Downloading memoffset v0.1.0
Downloading lazy_static v0.2.11
Downloading parking_lot_core v0.2.13
Downloading owning_ref v0.3.3
Downloading smallvec v0.6.0
Downloading stable_deref_trait v1.0.0
Downloading time v0.1.39
Downloading rayon v1.0.1
Downloading either v1.5.0
Downloading cc v1.0.10
Compiling lazy_static v0.2.11
Compiling memoffset v0.1.0
Compiling crossbeam v0.3.2
Compiling remove_dir_all v0.5.0
Compiling libc v0.2.40
Compiling rayon-core v1.4.0
Compiling nodrop v0.1.12
Compiling scopeguard v0.3.3
Compiling either v1.5.0
Compiling lazy_static v1.0.0
Compiling untrusted v0.5.1
Compiling protobuf v1.5.1
Compiling stable_deref_trait v1.0.0
Compiling smallvec v0.6.0
Compiling memoffset v0.2.1
Compiling cc v1.0.10
Compiling gcc v0.3.54
Compiling cfg-if v0.1.2
Compiling time v0.1.39
Compiling num_cpus v1.8.0
Compiling rand v0.4.2
Compiling arrayvec v0.4.7
Compiling owning_ref v0.3.3
Compiling reed-solomon-erasure v3.0.3
Compiling crossbeam-utils v0.2.2
Compiling log v0.4.1
Compiling crossbeam-epoch v0.3.1
Compiling crossbeam-epoch v0.2.0
Compiling tempdir v0.3.7
Compiling parking_lot_core v0.2.13
Compiling protoc v1.5.1
Compiling simple_logger v0.5.0
Compiling crossbeam-deque v0.2.0
Compiling protoc-rust v1.5.1
Compiling parking_lot v0.4.8
Compiling crossbeam-channel v0.1.2
Compiling hbbft v0.1.0 (file:///home/evgen/test/hbbft)
Compiling rayon v0.8.2
Compiling rayon v1.0.1
Compiling ring v0.12.1
error: failed to run custom build command for `hbbft v0.1.0 (file:///home/evgen/test/hbbft)`
process didn't exit successfully: `/home/evgen/test/hbbft/target/debug/build/hbbft-52654cfd4496555b/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=proto/message.proto
--- stderr
message.proto:1:10: Unrecognized syntax identifier "proto3". This parser only recognizes "proto2".
thread 'main' panicked at 'protoc: Error { repr: Custom(Custom { kind: Other, error: StringError("protoc exited with non-zero exit code") }) }', src/libcore/result.rs:906:4
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: std::panicking::rust_panic_with_hook
5: std::panicking::begin_panic
6: std::panicking::begin_panic_fmt
7: rust_begin_unwind
8: core::panicking::panic_fmt
9: core::result::unwrap_failed
at src/libcore/macros.rs:23
10: <core::result::Result<T, E>>::expect
at src/libcore/result.rs:799
11: build_script_build::main
at ./build.rs:5
12: __rust_maybe_catch_panic
13: std::rt::lang_start
14: main
15: __libc_start_main
16: _start
warning: build failed, waiting for other jobs to finish...
error: build failed
from hbbft.
from hbbft.
@yrashk, I added a check for protoc in build.rs in master.
from hbbft.
master ~/r/hbbft> protoc --version
libprotoc 3.5.1
master ~/r/hbbft> cargo build
Compiling hbbft v0.1.0 (file:///Users/igor/r/hbbft)
error[E0554]: #![feature] may not be used on the stable release channel
--> src/lib.rs:40:1
|
40 | #![feature(optin_builtin_traits)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: Could not compile `hbbft`.
To learn more, run the command again with --verbose.
exit 101
from hbbft.
@igorbarinov, it needs the nightly version of rustc:
$ rustup install nightly
$ rustup default nightly
from hbbft.
Finally! Thanks
Compiling merkle v1.5.1-pre (https://github.com/vkomenda/merkle.rs?branch=public-proof#f34be0aa)
warning: unused import: `std::fmt::Debug`
--> src/connection.rs:4:5
|
4 | use std::fmt::Debug;
| ^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
warning: unused import: `std::hash::Hash`
--> src/broadcast/mod.rs:4:5
|
4 | use std::hash::Hash;
| ^^^^^^^^^^^^^^^
warning: unused variable: `algorithm`
--> src/proto/mod.rs:217:17
|
217 | algorithm, // TODO: use
| ^^^^^^^^^ help: try ignoring the field: `algorithm: _`
|
= note: #[warn(unused_variables)] on by default
warning: variant is never constructed: `ProtocolError`
--> src/proto_io.rs:22:5
|
22 | ProtocolError,
| ^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default
Finished dev [unoptimized + debuginfo] target(s) in 32.64 secs
master ~/r/hbbft> ls
from hbbft.
Ok, thank you! I compiled it on OS X. But I cannot start an example code now
Evgens-MacBook-Pro:hbbft user$ ./target/debug/examples/consensus-node --bind-address=localhost:6666
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: AddrParseError(())', libcore/result.rs:945:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:205
3: std::panicking::default_hook
at libstd/panicking.rs:221
4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
at libstd/panicking.rs:457
5: std::panicking::try::do_call
at libstd/panicking.rs:344
6: std::panicking::try::do_call
at libstd/panicking.rs:322
7: <core::fmt::Write::write_fmt::Adapter<'a, T> as core::fmt::Write>::write_str
at libcore/panicking.rs:71
8: core::result::unwrap_failed
at /Users/travis/build/rust-lang/rust/src/libcore/macros.rs:26
9: <core::result::Result<T, E>>::unwrap
at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:782
10: consensus_node::parse_args
at examples/consensus-node.rs:45
11: consensus_node::main
at examples/consensus-node.rs:55
12: std::rt::lang_start::{{closure}}
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
13: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:304
14: panic_unwind::dwarf::eh::read_encoded_pointer
at libpanic_unwind/lib.rs:105
15: std::sys_common::bytestring::debug_fmt_bytestring
at libstd/panicking.rs:283
at libstd/panic.rs:361
at libstd/rt.rs:58
16: std::rt::lang_start
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
17: <consensus_node::Args as core::fmt::Debug>::fmt
from hbbft.
Excellent! @EvgenKor, remote addresses are required. I suggest 4 nodes for a start: one defined by --bind-address and 3 defined by --remote-node each.
Also try cargo test --test broadcast
. When it doesn't block, it passes. 1 in 20 times on average in my experience. I'm not fixing it because I'm rewriting the whole internal communications now.
from hbbft.
Excellent! @EvgenKor, remote addresses are required. I suggest 4 nodes for a start: one defined by --bind-address and 3 defined by --remote-node each.
@vkomenda Does following commandline correct?
consensus-node --bind-address=localhost:6666 --remote-address=localhost:7777 --remote-address=localhost:8888 --remote-address=localhost:9999
from hbbft.
Project builds can be monitored on github. There is a README with compilation instructions. The master branch is now protected and the code there has been tested on multiple machines to be compilable.
from hbbft.
Related Issues (20)
- More tests: Honey Badger HOT 2
- More tests: DynamicHoneyBadger
- More tests (?): QueueingHoneyBadger
- Make non-threshold cryptography generic?
- Why isn't there an example telling how to use QueueingHoneyBadger with socket HOT 2
- Change the `Target` variants for less cloning and less duplicated code.
- Is there any solution to do some customized verification HOT 2
- Add a method for skipping the current epoch. HOT 3
- Vulnerability in memoffset.
- Add markdownlint to CI?
- Common coin in private network HOT 8
- Error Cargo.toml HOT 1
- Implement a journal, to persist and restore the algorithms' state? HOT 6
- API for use from other languages? HOT 1
- Infinite loop in QueueingHoneyBadger HOT 1
- Question regarding missed batch HOT 1
- question regarding operation mutiple nodes
- `failure` dependency CVE-2019-25010
- How do we save serialize Secret Key to Vec<u8>? HOT 1
- How to setup a network? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hbbft.