Troubleshooting
Troubleshooting Cargo build issues
This project has a large set of dependencies and they are all bundled together in a root Cargo.lock file. This means that sometimes, when upgrading some of our dependencies, Cargo will do something unexpected which causes build errors which can be very time consuming to figure out.
Example: failed to select a version for xyz
xyz
If you get this error, then it means that Rust could not find a version of the xyz
crate which fulfills the requirements of the package and other packages that depend on it. To debug this, look what dependencies of xyz
package are, and check if they need to be updated.
This error can happen for example when upgrading to a new major/minor FVM versions without upgrading also other dependencies like frc_dispatch
which requires fvm as well. In that case we must upgrade the frc_dispatch
package to use the same FVM version as we are using.
Unexplained transitive dependencies in wasm32 target after upgrading FVM version
When upgrading FVM dependency (from 4.0 to 4.1) it resulted in our fendermint/actors/build.rs
script to fail due Cargo including multiple new dependencies in the wasm32
target which did not occur before and caused build errors since these new dependencies did not support Wasm target.
By running cargo tree
we saw that these dependencies were pulled in from the filecoin-proofs-api
required by fvm_shared
. This dependency is pulled in when requiring fvm_shared
with the crypto
feature. Looking at our different Cargo.toml files, we noticed that contracts/binding/Cargo.toml
file was the only one setting that feature. We needed to remove the crypto
feature, compile, and then add it back in for the wasm build (and tests) to succeed.
Troubleshooting Misc Cargo related issues
Unexplained behaviour due to local changes in ~/.cargo/registry
If you are seeing weird unexplained behaviour that you kind of can't wrap your head around, then you may want to delete your ~/.cargo/registry
and run cargo build
. Here is why, you might have accidentally changed some of the crates's source files that cargo is using in your project. There is no way to know if you had made any local changes to any of these crates as `Cargo`` does not maintain hash of these dependencies and there is no git repo available to compare against.
Last updated