rs-ipfs / rust-ipfs

The InterPlanetary File System (IPFS), implemented in Rust.
Apache License 2.0
1.26k stars 163 forks source link

can not run example fetch_and_cat #513

Open conanchen opened 1 year ago

conanchen commented 1 year ago

Describe the bug

  1. When I tried to run the example as below: ❯ cargo run --example fetch_and_cat -- --default-bootstrappers bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi

To Reproduce

  1. console log: Blocking waiting for file lock on package cache Blocking waiting for file lock on package cache Blocking waiting for file lock on package cache Compiling ipfs v0.2.1 (/Users/CC/github/rs-ipfs/rust-ipfs) Finished dev [unoptimized + debuginfo] target(s) in 8.47s Running target/debug/examples/fetch_and_cat --default-bootstrappers bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi ... restore_bootstrappers

Expected behavior the example can fetch the file ( bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi ) from ipfs network:

Environment (please complete the following information)

Additional context

  1. update the cargo.toml with latest dependencies e.g. libp2p with 0.48.0
  2. cargo run the example , there are compile errors
    
    ❯ cargo run --example fetch_and_cat -- --default-bootstrappers  bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
    Compiling ipfs v0.2.1 (/Users/CC/github/rs-ipfs/rust-ipfs)
    error[E0432]: unresolved import `libp2p::swarm::NetworkBehaviourEventProcess`
    --> src/p2p/behaviour.rs:19:39
    |
    19 | use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourEventProcess};
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `NetworkBehaviourEventProcess` in the root

error[E0432]: unresolved import libp2p::core::connection::ListenerId --> src/p2p/pubsub.rs:11:48 | 11 | connection::{ConnectedPoint, ConnectionId, ListenerId}, | ^^^^^^^^^^ no ListenerId in connection

error[E0432]: unresolved import libp2p::tcp::TokioTcpConfig --> src/p2p/transport.rs:9:5 | 9 | use libp2p::tcp::TokioTcpConfig; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no TokioTcpConfig in the root

error[E0432]: unresolved import libp2p::core::connection::ListenerId --> src/lib.rs:93:9 | 93 | connection::ListenerId, multiaddr::multiaddr, multiaddr::Protocol, Multiaddr, PeerId, | ^^^^^^^^^^^^^^^^^^^^^^ no ListenerId in connection

For more information about this error, try rustc --explain E0432. error: could not compile ipfs due to 4 previous errors

koivunej commented 1 year ago

Thanks for letting us know. We are currently sunsetting the project though, please see #512. You may have more luck with the latest version from master branch. I've already yanked all of the releases.

dariusc93 commented 1 year ago

Hey @conanchen. The issue is that rust-ipfs isnt updated for libp2p v0.48. There has been breaking changes done. I do have it working on my own fork at https://github.com/dariusc93/rust-ipfs but you might want to fork off of it since I have been doing passive maintenance on it, while also making changes as an experiment, but overall it does work with the latest libp2p (which also do work with that example) and do try to keep it up dated with it.