datrs / hypercore

Secure, distributed, append-only log
https://docs.rs/hypercore
Apache License 2.0
334 stars 37 forks source link

Building latest version fails #118

Open DylanVerstraete opened 4 years ago

DylanVerstraete commented 4 years ago

version 0.11.0 does not build.

Stacktrace:

   Compiling hypercore v0.11.0
error[E0277]: the trait bound `random_access_memory::RandomAccessMemory: random_access_storage::RandomAccess` is not satisfied
   --> /Users/dylan/.cargo/registry/src/github.com-1ecc6299db9ec823/hypercore-0.11.0/src/feed.rs:572:6
    |
30  | pub struct Feed<T>
    |            ---- required by a bound in this
31  | where
32  |     T: RandomAccess<Error = Error> + Debug,
    |        --------------------------- required by this bound in `feed::Feed`
...
572 | impl Default for Feed<RandomAccessMemory> {
    |      ^^^^^^^ the trait `random_access_storage::RandomAccess` is not implemented for `random_access_memory::RandomAccessMemory`
    |
help: trait impl with same name found
   --> /Users/dylan/.cargo/registry/src/github.com-1ecc6299db9ec823/random-access-memory-1.2.0/src/lib.rs:55:1
    |
55  | / impl RandomAccess for RandomAccessMemory {
56  | |   type Error = Box<dyn std::error::Error + Send + Sync>;
57  | |
58  | |   fn write(&mut self, offset: u64, data: &[u8]) -> Result<(), Self::Error> {
...   |
203 | |   }
204 | | }
    | |_^
    = note: perhaps two different versions of crate `random_access_storage` are being used?
bltavares commented 4 years ago

Sorry about this, there has been some new work merged that required a new version of random_access_storage and the versions need to match to have it working. Note the last line on the error:

= note: perhaps two different versions of crate random_access_storage are being used?

Would you mind trying out:

[dependencies]
hypercore = "0.11.1-beta.8"
random-access-disk = "2.0.0"
random-access-memory = "2.0.0"
random-access-storage = "4.0.0"
xoryouyou commented 3 years ago

I had to also add the following crates

async-std = {version = "1", features = ["attributes"]}
anyhow = "1.0.40"

so that examples/main.rs would build

jalcine commented 3 years ago

Came here for the same reason - the changes suggested here work for me. Do we have a sense as to when that'll be placed into a stable patch version (or minor)?

ntauth commented 2 years ago

Adding this to Cargo.toml fixed it for me:

hypercore = "0.11.1-beta.10"
log = "0.4.16"