Can’t build smart contract - error compiling elrond-wasm with erdpy build contract - elrond

When I try to build the ping-pong smart contract from here using:
erdpy build contract
I don't get the following expected output:
INFO:projects.core:WASM file generated: output/ping-pong.wasm
because of the following errors that appear in the sc_results.rs file:
Compiling elrond-codec v0.5.3
Compiling elrond-wasm v0.18.2
error[E0432]: unresolved import `core::ops::FromResidual`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:7:30
...
error[E0437]: type Output is not a member of trait `Try`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:62:5
...
error[E0437]: type Residual is not a member of trait `Try`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:63:5
...
error[E0407]: method branch is not a member of trait `Try`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:65:5
...
error[E0407]: method from_output is not a member of trait `Try`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:71:5
...
error aborting due to 5 previous errors
...
CRITICAL:cli:Build error: error code = 101, see output.
Environment:
elrond-wasm - v0.18.2
erdpy - v1.0.19
How to solve this build issue?

The problem was that Rust had a non-backwards-compatible change earlier this year.
So, there was an incompatibility with old versions, but it worked fine with newer versions.
Updating Rust using:
rustup update
solved the problem.
Now:
rustc --version | grep -o '^[^(]*'
prints
rustc 1.57.0-nightly

Related

Error while adding Nick Pallet to substrate

I have just started exploring substrate and I am following this tutorial, (https://docs.substrate.io/tutorials/v3/add-a-pallet/).
Under step Implement the Nicks pallet Config trait -> Add Nicks to the construct_runtime! macro., I added Nicks pallet to my runtime, as shown in the screenshot.
Now, when I run cargo check -p node-template-runtime, I get a lot of errors;
asad#asad-Z440:~/Dev/Blockchain/polkadot/substrate-node-template$ cargo check -p node-template-runtime
warning: /home/asad/Dev/Blockchain/polkadot/substrate-node-template/node/Cargo.toml: version requirement `3.0.0-monthly-2021-09+1` for dependency `node-template-runtime` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
warning: /home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime/Cargo.toml: version requirement `3.0.0-monthly-2021-09+1` for dependency `pallet-template` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
Updating git repository `https://github.com/paritytech/substrate.git`
Updating crates.io index
Updating git repository `https://github.com/paritytech/substrate.git`
Compiling node-template-runtime v3.0.0-monthly-2021-09+1 (/home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime)
error: failed to run custom build command for `node-template-runtime v3.0.0-monthly-2021-09+1 (/home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime)`
Caused by:
process didn't exit successfully: `/home/asad/Dev/Blockchain/polkadot/substrate-node-template/target/debug/build/node-template-runtime-c9c48352bd7ed47e/build-script-build` (exit status: 1)
--- stdout
Information that should be included in a bug report.
Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/home/asad/Dev/Blockchain/polkadot/substrate-node-template/target/debug/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"
Using rustc version: rustc 1.57.0-nightly (aa7aca3b9 2021-09-30)
--- stderr
warning: /home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime/Cargo.toml: version requirement `3.0.0-monthly-2021-09+1` for dependency `pallet-template` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
Updating git repository `https://github.com/paritytech/substrate.git`
Compiling node-template-runtime v3.0.0-monthly-2021-09+1 (/home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime)
warning: unused doc comment
--> /home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime/src/lib.rs:253:1
|
253 | /// Nicks Config:
| ^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations
|
= note: `#[warn(unused_doc_comments)]` on by default
= help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion
error: duplicate lang item in crate `sp_io` (which `frame_support` depends on): `panic_impl`.
.........
310 | / construct_runtime!(
311 | | pub enum Runtime where
312 | | Block = Block,
313 | | NodeBlock = opaque::Block,
... |
327 | | }
328 | | );
| |__^
note: required by a bound in `sp_runtime::generic::UncheckedExtrinsic`
--> /home/asad/.cargo/git/checkouts/substrate-7e08433d4c370a21/20a9bbb/primitives/runtime/src/generic/unchecked_extrinsic.rs:39:40
|
39 | pub struct UncheckedExtrinsic<Address, Call, Signature, Extra>
| ^^^^ required by this bound in `sp_runtime::generic::UncheckedExtrinsic`
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
warning: `node-template-runtime` (lib) generated 1 warning
error: could not compile `node-template-runtime` due to 112 previous errors; 1 warning emitted
Things I have tried:
Removing Cargo.lock file and then running cargo check -p node-template-runtime.
PS: I am just starting with rust and substrate, so spare me if i am asking something obvious here.

add pallet_assets error: ^^^ Config not found in 'pallet_assets'

I get this error when trying to compile and I seem to be unable to solve it...:
In terminal, after running 'cargo check' I get:
Compiling node-template-runtime v2.0.1 (/runtime)
error[E0405]: cannot find trait `Config` in crate `pallet_assets`
--> /runtime/src/lib.rs:360:21
|
360 | impl pallet_assets::Config for Runtime {
| ^^^^^^ not found in `pallet_assets`
error: aborting due to previous error...
I tried with 'Trait' instead of Config, but throws even more errors...?
A hint would be much appreciated. Thanks
The Config trait was introduced in version 3.0.0 of substrate. As you pointed out, it was previously Trait. It is only expected for any substrate project to be compile-able if you use all of the same major version (2.x or 3.x) for building. I highly recommend using v3+ from now on, v2 is not expected to be supported moving forward.

errorE0282# type annotations needed & could not compile `sp-arithmetic`

I am following tutorial [Implementing the Contract Trait]. Added code snip to [parameter_types!] and to [imp trait runtime].
When I run [cargo check -p node-template-runtime] receive error:
error[E0282]: type annotations needed
error: could not compile sp-arithmetic
note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
I've had this error previously and it was due to nightly?
I am using windows not mac..
Just to Add to #dundro answer. Go to the link he suggested:
https://github.com/substrate-developer-hub/substrate-node-template/commit/5769470053ba48f364100ff106e32f1beea43127
and download the "rust-toolchain" file. Then place it in the "substrate-node-template" folder. Then try to build again using the command "cargo build --release".
In my case, it solved the E0282 error and gave me a new one E0463. Searching for a fix now
I got the exactly same error, but then I just checked out master ( there is now a toolchain file since https://github.com/substrate-developer-hub/substrate-node-template/commit/5769470053ba48f364100ff106e32f1beea43127)
and with nightly-2020-10-06 the build was successful.
Good luck
Solved: I forgot to add nightly [cargo +nightly-2020-10-06 check -p node-template-runtime]..

Weird Haskell 'stack' error: "can't load .so/.DLL" "not a writable segment"

I am trying to install ghc-mod so that I can use ide-haskell in Atom.
The instructions say to use stack build ghc-mod. It seems that GHC 8.2+ is not supported by ghc-mod, so I set my resolver to lts-9.21.
When running stack build ghc-mod, I keep getting this error (emphasis mine; not using code formatting because line wrap helps readability):
aeson > : can't load .so/.DLL for: /Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib (dlopen(/Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib, 5): REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 2 which is not a writable segment (__LINKEDIT) in /Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib)
... (later)
-- While building package aeson-1.1.2.0 using:
/Users/timoffex/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 build --ghc-options ""
Process exited with code: ExitFailure 1
Progress 1/4
Here's a snippet from the above that looks weird to me:
REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 2 which is not a writable segment
I am running macOS Catalina 10.15.3.
I can't find any mention of this online except for this open GitHub issue: https://github.com/facebook/duckling/issues/446
I also tried lts-7.24. I get the exact same error, except it happens while building profunctors.
What could be the problem? Where can I file a bug?
I had the same error in a project using resolver: lts-9.17.
What fixed it for me is to update stack.yaml and use this line:
resolver: lts-10.9

I recently create a project of OPNET 14.5 and i have been unable to run the simulation. the error is about Pipeline stage model (dpt_ecc_pon)

I installed OPNET modeler 14.5 at my laptop (OS: Windows 8).
I slightly modified a process model, and ran simulation. But I see the following errors.
<<< Recoverable Error >>>
Pipeline stage model (dpt_ecc_pon) compilation failed
Source code was unavailable to the compiler
----
<<< Recoverable Error >>>
Object repository construction failed
Pipeline stage (dpt_ecc_pon) compilation failed, no source code found.
T (0), EV (-), MOD (NONE)
----
<<< Program Abort >>>
Error encountered rebuilding repository -- unable to proceed
T (0), EV (-), MOD (NONE)
How can i overcome this?
If you create dpt_ecc_pon pipeline stage source, there are some rules to define them. Based on your error message, the dpt_ecc_pon.ps.c/cpp is not included in the model_dirs.
All source code should be included in model_dirs. Press Ctrl+Alt+P. In preference dialog, search 'model_dirs' and make sure the directory where your codes are included in the 'model_dirs'.

Resources