Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

build failed when running cargo build --release #5837

Closed
ilovelili opened this issue Apr 30, 2020 · 16 comments · Fixed by #5844
Closed

build failed when running cargo build --release #5837

ilovelili opened this issue Apr 30, 2020 · 16 comments · Fixed by #5844

Comments

@ilovelili
Copy link

ilovelili commented Apr 30, 2020

I got the following error on Ubuntu 20.04 by running cargo build --release

Compiling sp-arithmetic v2.0.0-dev (/home/min/Projects/substrate/substrate/primitives/arithmetic)

error: this operation will panic at runtime
   --> /home/min/Projects/substrate/substrate/primitives/arithmetic/src/fixed64.rs:171:32
    |
171 |             return Fixed64::from_parts( self.0 / zero);
    |                                         ^^^^^^^^^^^^^ attempt to divide by zero
    |
    = note: `#[deny(unconditional_panic)]` on by default

error: aborting due to previous error

error: could not compile `sp-arithmetic`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

warning: build failed, waiting for other jobs to finish...
error: build failed
@bkchr
Copy link
Member

bkchr commented Apr 30, 2020

In master?

@ilovelili
Copy link
Author

@bkchr yeah it's in master. But the same error happens even if I checkout other branches like v2.0.0-alpha.6.

$ git branch -v
* master c82a0f7b5 Remove background_tasks field in ServiceBuilder (#5830)

@bkchr
Copy link
Member

bkchr commented Apr 30, 2020

Which rust version are you using?

@ilovelili
Copy link
Author

ilovelili commented Apr 30, 2020

$ rustc --version
rustc 1.43.0 (4fb7144ed 2020-04-20)

I am going to get a substrate docker image in case there is something wrong with my local environment...

BTW I tried with another ubuntu 18.04 laptop and same error occurred.

@balqaasem
Copy link

I am having a similar error too.

error: failed to run custom build command for node-template-runtime v2.0.0 (/Users/mba/substrate-node-template/runtime)`

Caused by:
process didn't exit successfully: /Users/mba/substrate-node-template/target/release/build/node-template-runtime-cae9ad6029c9f681/build-script-build (exit code: 1)
--- stdout
Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/Users/mba/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"

--- stderr
Compiling wasm-build-runner-impl v1.0.0 (/Users/mba/substrate-node-template/target/release/wbuild-runner/node-template-runtime18348932773558219608)
Finished release [optimized] target(s) in 2.71s
Running /Users/mba/substrate-node-template/target/release/wbuild-runner/node-template-runtime18348932773558219608/target/x86_64-apple-darwin/release/wasm-build-runner-impl
Compiling sp-arithmetic v2.0.0
Compiling sp-core v2.0.0
error[E0282]: type annotations needed
--> /Users/mba/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1595 | / implement_fixed!(
1596 | | FixedI64,
1597 | | test_fixed_i64,
1598 | | i64,
... |
1601 | | "Fixed Point 64 bits signed, range = [-9223372036.854775808, 9223372036.854775807]",
1602 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
--> /Users/mba/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1604 | / implement_fixed!(
1605 | | FixedI128,
1606 | | test_fixed_i128,
1607 | | i128,
... |
1611 | | [-170141183460469231731.687303715884105728, 170141183460469231731.687303715884105727]_",
1612 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
--> /Users/mba/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1614 | / implement_fixed!(
1615 | | FixedU128,
1616 | | test_fixed_u128,
1617 | | u128,
... |
1621 | | [0.000000000000000000, 340282366920938463463.374607431768211455]_",
1622 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

For more information about this error, try rustc --explain E0282.
error: could not compile sp-arithmetic

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
warning: build failed, waiting for other jobs to finish...
error: build failed`

I am using rustc 1.47.0 (18bf6b4f0 2020-10-07)

@bkchr
Copy link
Member

bkchr commented Oct 9, 2020

This is an rustc error: rust-lang/rust#77638

@jianghaiyusheng
Copy link

I am having a similar error too.

error: failed to run custom build command for node-template-runtime v2.0.0 (/Users/mba/substrate-node-template/runtime)`

Caused by:
process didn't exit successfully: /Users/mba/substrate-node-template/target/release/build/node-template-runtime-cae9ad6029c9f681/build-script-build (exit code: 1)
--- stdout
Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/Users/mba/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"

--- stderr
Compiling wasm-build-runner-impl v1.0.0 (/Users/mba/substrate-node-template/target/release/wbuild-runner/node-template-runtime18348932773558219608)
Finished release [optimized] target(s) in 2.71s
Running /Users/mba/substrate-node-template/target/release/wbuild-runner/node-template-runtime18348932773558219608/target/x86_64-apple-darwin/release/wasm-build-runner-impl
Compiling sp-arithmetic v2.0.0
Compiling sp-core v2.0.0
error[E0282]: type annotations needed
--> /Users/mba/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1595 | / implement_fixed!(
1596 | | FixedI64,
1597 | | test_fixed_i64,
1598 | | i64,
... |
1601 | | "Fixed Point 64 bits signed, range = [-9223372036.854775808, 9223372036.854775807]",
1602 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
--> /Users/mba/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1604 | / implement_fixed!(
1605 | | FixedI128,
1606 | | test_fixed_i128,
1607 | | i128,
... |
1611 | | [-170141183460469231731.687303715884105728, 170141183460469231731.687303715884105727]_",
1612 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
--> /Users/mba/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1614 | / implement_fixed!(
1615 | | FixedU128,
1616 | | test_fixed_u128,
1617 | | u128,
... |
1621 | | [0.000000000000000000, 340282366920938463463.374607431768211455]_",
1622 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

For more information about this error, try rustc --explain E0282.
error: could not compile sp-arithmetic

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
warning: build failed, waiting for other jobs to finish...
error: build failed`

I am using rustc 1.47.0 (18bf6b4f0 2020-10-07)

Is the problem solved?I am having the same error too.

@hbulgarini
Copy link
Contributor

hbulgarini commented Nov 4, 2020

i had the same issue and i solved it using the nightly-2020-10-06 compiler version as the documentation says:

https://substrate.dev/docs/en/knowledgebase/getting-started/#webassembly-compilation

Then i run the command setting the env variable WASM_BUILD_TOOLCHAIN:

WASM_BUILD_TOOLCHAIN=nightly-2020-10-06 cargo build

@xmxanuel
Copy link

xmxanuel commented Nov 5, 2020

I had the same error

@hbulgarini suggestion fixed it 🎉

after I changed the wasm target as well

rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-06

@balqaasem
Copy link

This solves it @manuelpolzhofer
rustup toolchain install nightly-2020-08-23
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-08-23
Then compile your node with this:
cargo +nightly-2020-08-23 build --release

@TomaszWaszczyk
Copy link

TomaszWaszczyk commented Dec 21, 2020

@bkchr I try to build a kitchen node but got:

#7150 (comment)

There is any place where I can find versions of Rust and toolchains required to build the node?

twaszczyk@ktwtomwasnb:~/workspaces/recipes/nodes/kitchen-node$ git status 
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

@TeodorStamenov
Copy link

This solves it @manuelpolzhofer
rustup toolchain install nightly-2020-08-23
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-08-23
Then compile your node with this:
cargo +nightly-2020-08-23 build --release

thank you

@goiltpatpat
Copy link

This solves it @manuelpolzhofer
rustup toolchain install nightly-2020-08-23
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-08-23
Then compile your node with this:
cargo +nightly-2020-08-23 build --release

not work for me T_T

error[E0635]: unknown feature const_type_id
--> /home/patyagami/.cargo/registry/src/github.com-1ecc6299db9ec823/value-bag-1.0.0-alpha.6/src/lib.rs:7:54
|
7 | #![cfg_attr(value_bag_capture_const_type_id, feature(const_type_id))]
| ^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try rustc --explain E0635.
error: could not compile value-bag.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

@chrisckwong821
Copy link

This solves it @manuelpolzhofer
rustup toolchain install nightly-2020-08-23
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-08-23
Then compile your node with this:
cargo +nightly-2020-08-23 build --release

work in Debian 10; cargo 1.51.0 (43b129a20 2021-03-16);

@grepfr
Copy link

grepfr commented May 13, 2021

just to install curl helped with ubuntu

sudo apt install curl

@munnatamton
Copy link

This solves it @manuelpolzhofer rustup toolchain install nightly-2020-08-23 rustup target add wasm32-unknown-unknown --toolchain nightly-2020-08-23 Then compile your node with this: cargo +nightly-2020-08-23 build --release

Thank You!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.