When building the runtime useing cargo build --release I'm running into this error:

error[E0432]: unresolved import `sp_core::to_substrate_wasm_fn_return_value`
    --> /home/christian/.cargo/git/checkouts/substrate-7e08433d4c370a21/22d40c7/primitives/api/src/lib.rs:80:9
  80 | pub use sp_core::to_substrate_wasm_fn_return_value;
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `to_substrate_wasm_fn_return_value` in the root

  For more information about this error, try `rustc --explain E0432`.
  error: could not compile `sp-api` due to previous error

I tried cargo update and rustup update

I looked at the .../primitives/core/src/lib.rs file and it does have pub fn to_substrate_wasm_fn_return_value implemented, so I don't know why it can't find it.

I'm new to rust so I don't fully know how to troubleshoot this. Any Ideas?

  • 1
    An unconstrained cargo update is usually not a good idea. cargo update -p sp-io is usually ok though.
    – Squirrel
    Apr 15, 2022 at 12:55
  • if you do a cargo build --release from the root that would build the pallets in wasm too. I would undo local changes and make sure that you have run rustup target add wasm32-unknown-unknown
    – Squirrel
    Apr 15, 2022 at 12:59
  • @bkchr, that helped but not directly. I broke out a separate crate for some shared logic between two pallets, and I had to add default-features = false and then add that crate to std. Apr 18, 2022 at 12:14


Browse other questions tagged or ask your own question.