ipfs-rust / ipfs-embed

A small embeddable ipfs implementation
360 stars 48 forks source link

Error building library with ipfs-embed v 0.23.0 as a dependency #110

Closed humnandy closed 2 years ago

humnandy commented 2 years ago

When I add ipfs-embed = "0.22.4" as a dependency to my rust lib, cargo build runs successfully without error.

But when I add ipfs-embed = "0.23.0" as a dependency then the cargo build fails with the error below:

I have run cargo-tree and it looks like there are two versions of trust-dns-resolver in the dependency tree for 0.23.0

trust-dns-resolver v0.21.2 (*) trust-dns-resolver v0.20.4

Can I fix this with some sort of override, or does in need to be fixed in the downstream dependencies?

error[E0308]: mismatched types --> /Users/novocodev/.cargo/registry/src/github.com-1ecc6299db9ec823/ipfs-embed-0.23.0/src/net/mod.rs:132:72 132 Ok((config, opts)) => Dns::custom(quic_or_tcp, config, opts).await?.boxed(), ^^^^^^ expected struct libp2p::libp2p_dns::ResolverConfig, found struct trust_dns_resolver::config::ResolverConfig
= note: perhaps two different versions of crate `trust_dns_resolver` are being used?
error[E0308]: mismatched types --> /Users/novocodev/.cargo/registry/src/github.com-1ecc6299db9ec823/ipfs-embed-0.23.0/src/net/mod.rs:132:80 132 Ok((config, opts)) => Dns::custom(quic_or_tcp, config, opts).await?.boxed(), ^^^^ expected struct libp2p::libp2p_dns::ResolverOpts, found struct trust_dns_resolver::config::ResolverOpts
= note: perhaps two different versions of crate `trust_dns_resolver` are being used?

For more information about this error, try rustc --explain E0308.

cryptoquick commented 2 years ago

Just ran into this also. You can solve this issue by adding this to your Cargo.toml:

libp2p-dns = "=0.32.0"

This of course can be removed once this issue is resolved.

cryptoquick commented 2 years ago

You're actually probably gonna need all of these for 0.23.0, just fyi:

ipfs-embed = "0.23.0"
libipld = "=0.12.0"
libp2p-dns = "=0.32.0"
multihash = "=0.14.0"
humnandy commented 2 years ago

@cryptoquick thanks that solved my build issues.