darkrenaissance/darkfi

Failed to build 0.4.0: `error: could not compile `subtle` due to 19 previous errors`

marek22k opened this issue · 1 comments

Steps:

sudo apt install git make jq gcc pkg-config libmpg123-dev
git clone https://github.com/darkrenaissance/darkfi
cd darkfi && git checkout v0.4.0
make -j4

Actual behavior:

$make -j4
make -C contrib/token all
make[1]: Entering directory '/home/bandura/darkfi/contrib/token'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/bandura/darkfi/contrib/token'
RUSTFLAGS="" cargo build --all-features --release --package zkas
    Updating git repository `https://github.com/ertosns/dashu`
    Updating crates.io index
    Updating git repository `https://github.com/Dastan-glitch/rust-term-grid.git`
  Downloaded quote v1.0.23
  Downloaded os_str_bytes v6.4.1
  Downloaded strsim v0.10.0
  Downloaded bitflags v1.3.2
  Downloaded syn v1.0.107
  Downloaded is-terminal v0.4.2
  Downloaded io-lifetimes v1.0.4
  Downloaded rustix v0.36.7
  Downloaded thiserror v1.0.38
  Downloaded heck v0.4.1
  Downloaded hashbrown v0.12.3
  Downloaded proc-macro-error-attr v1.0.4
  Downloaded log v0.4.17
  Downloaded proc-macro-crate v1.3.0
  Downloaded itertools v0.10.5
  Downloaded toml_datetime v0.5.1
  Downloaded proc-macro-error v1.0.4
  Downloaded once_cell v1.17.0
  Downloaded version_check v0.9.4
  Downloaded unicode-ident v1.0.6
  Downloaded thiserror-impl v1.0.38
  Downloaded toml_edit v0.18.1
  Downloaded nom8 v0.2.0
  Downloaded linux-raw-sys v0.1.4
  Downloaded libc v0.2.139
  Downloaded autocfg v1.1.0
  Downloaded termcolor v1.1.3
  Downloaded indexmap v1.9.2
  Downloaded proc-macro2 v1.0.50
  Downloaded memchr v2.5.0
  Downloaded clap_derive v4.1.0
  Downloaded either v1.8.1
  Downloaded clap_lex v0.3.1
  Downloaded clap v4.1.4
  Downloaded cfg-if v1.0.0
  Downloaded 35 crates (3.3 MB) in 1.14s
   Compiling proc-macro2 v1.0.50
   Compiling quote v1.0.23
   Compiling unicode-ident v1.0.6
   Compiling syn v1.0.107
   Compiling autocfg v1.1.0
   Compiling version_check v0.9.4
   Compiling memchr v2.5.0
   Compiling indexmap v1.9.2
   Compiling libc v0.2.139
   Compiling hashbrown v0.12.3
   Compiling nom8 v0.2.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling toml_datetime v0.5.1
   Compiling io-lifetimes v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling once_cell v1.17.0
   Compiling toml_edit v0.18.1
   Compiling rustix v0.36.7
   Compiling darkfi-derive-internal v0.4.0 (/home/bandura/darkfi/src/serial/derive-internal)
   Compiling log v0.4.17
   Compiling thiserror v1.0.38
   Compiling linux-raw-sys v0.1.4
   Compiling proc-macro-crate v1.3.0
   Compiling bitflags v1.3.2
   Compiling thiserror-impl v1.0.38
   Compiling heck v0.4.1
   Compiling darkfi-derive v0.4.0 (/home/bandura/darkfi/src/serial/derive)
   Compiling cfg-if v1.0.0
   Compiling either v1.8.1
   Compiling os_str_bytes v6.4.1
   Compiling clap_lex v0.3.1
   Compiling darkfi-serial v0.4.0 (/home/bandura/darkfi/src/serial)
   Compiling itertools v0.10.5
   Compiling clap_derive v4.1.0
   Compiling is-terminal v0.4.2
   Compiling strsim v0.10.0
   Compiling termcolor v1.1.3
   Compiling darkfi v0.4.0 (/home/bandura/darkfi)
   Compiling clap v4.1.4
   Compiling zkas v0.4.0 (/home/bandura/darkfi/bin/zkas)
    Finished release [optimized] target(s) in 1m 28s
cp -f target/release/zkas zkas
make -C src/contract/money
./zkas proof/arithmetic.zk -o proof/arithmetic.zk.bin
./zkas proof/burn.zk -o proof/burn.zk.bin
./zkas proof/deploy_contract.zk -o proof/deploy_contract.zk.bin
make[1]: Entering directory '/home/bandura/darkfi/src/contract/money'
Parser warning: constant section is empty.


Wrote output to proof/arithmetic.zk.bin
./zkas proof/encrypt.zk -o proof/encrypt.zk.bin
Wrote output to proof/deploy_contract.zk.bin
Wrote output to proof/burn.zk.bin
./zkas proof/inclusion_proof.zk -o proof/inclusion_proof.zk.bin
./zkas proof/lead.zk -o proof/lead.zk.bin
Parser warning: constant section is empty.


Wrote output to proof/encrypt.zk.bin
Parser warning: constant section is empty.


Wrote output to proof/inclusion_proof.zk.bin
./zkas proof/mint.zk -o proof/mint.zk.bin
./zkas proof/opcodes.zk -o proof/opcodes.zk.bin
Wrote output to proof/mint.zk.bin
Wrote output to proof/lead.zk.bin
./zkas proof/tx.zk -o proof/tx.zk.bin
./zkas proof/voting.zk -o proof/voting.zk.bin
Wrote output to proof/opcodes.zk.bin
./zkas example/simple.zk -o example/simple.zk.bin
Wrote output to proof/voting.zk.bin
Wrote output to proof/tx.zk.bin
Wrote output to example/simple.zk.bin
../../../zkas proof/burn_v1.zk -o proof/burn_v1.zk.bin
../../../zkas proof/lead_burn_v1.zk -o proof/lead_burn_v1.zk.bin
../../../zkas proof/lead_mint_v1.zk -o proof/lead_mint_v1.zk.bin
../../../zkas proof/mint_v1.zk -o proof/mint_v1.zk.bin
Wrote output to proof/burn_v1.zk.bin
../../../zkas proof/token_mint_v1.zk -o proof/token_mint_v1.zk.bin
Wrote output to proof/lead_burn_v1.zk.bin
Wrote output to proof/mint_v1.zk.bin
Wrote output to proof/lead_mint_v1.zk.bin
Wrote output to proof/token_mint_v1.zk.bin
cargo build --release --package darkfi-money-contract --target wasm32-unknown-unknown
  Downloaded parking v2.0.0
  Downloaded num_cpus v1.15.0
  Downloaded radium v0.7.0
  Downloaded pin-project-lite v0.2.9
  Downloaded ppv-lite86 v0.2.17
  Downloaded rand_chacha v0.3.1
  Downloaded scopeguard v1.1.0
  Downloaded subtle v2.4.1
  Downloaded sha2 v0.10.6
  Downloaded waker-fn v1.1.0
  Downloaded percent-encoding v2.2.0
  Downloaded tinyvec v1.6.0
  Downloaded tap v1.0.1
  Downloaded rand v0.8.5
  Downloaded typenum v1.16.0
  Downloaded serde_derive v1.0.152
  Downloaded ahash v0.7.6
  Downloaded tracing-core v0.1.30
  Downloaded tracing v0.1.37
  Downloaded serde v1.0.152
  Downloaded url v2.3.1
  Downloaded rand_core v0.6.4
  Downloaded rayon v1.6.1
  Downloaded unicode-normalization v0.1.22
  Downloaded wyz v0.5.1
  Downloaded unicode-bidi v0.3.10
  Downloaded uint v0.9.5
  Downloaded bs58 v0.4.0
  Downloaded blake2b_simd v1.0.0
  Downloaded arrayref v0.3.6
  Downloaded cpufeatures v0.2.5
  Downloaded constant_time_eq v0.1.5
  Downloaded cc v1.0.79
  Downloaded halo2_proofs v0.2.0
  Downloaded incrementalmerkletree v0.3.0
  Downloaded crunchy v0.2.2
  Downloaded crossbeam-deque v0.8.2
  Downloaded crossbeam-utils v0.8.14
  Downloaded futures-core v0.3.26
  Downloaded funty v2.0.0
  Downloaded ff v0.12.1
  Downloaded instant v0.1.12
  Downloaded memoffset v0.7.1
  Downloaded tinyvec_macros v0.1.0
  Downloaded lazy_static v1.4.0
  Downloaded hex v0.4.3
  Downloaded num-traits v0.2.15
  Downloaded rayon-core v1.10.2
  Downloaded pasta_curves v0.4.1
  Downloaded crossbeam-epoch v0.9.13
  Downloaded futures-lite v1.12.0
  Downloaded num-integer v0.1.45
  Downloaded tracing-attributes v0.1.23
  Downloaded halo2_gadgets v0.2.0
  Downloaded idna v0.3.0
  Downloaded group v0.12.1
  Downloaded num-bigint v0.4.3
  Downloaded digest v0.10.6
  Downloaded getrandom v0.2.8
  Downloaded futures-io v0.3.26
  Downloaded generic-array v0.14.6
  Downloaded bitvec v1.0.1
  Downloaded crypto-common v0.1.6
  Downloaded form_urlencoded v1.1.0
  Downloaded fastrand v1.8.0
  Downloaded blake3 v1.3.3
  Downloaded constant_time_eq v0.2.4
  Downloaded crossbeam-channel v0.5.6
  Downloaded byteorder v1.4.3
  Downloaded block-buffer v0.10.3
  Downloaded arrayvec v0.7.2
  Downloaded static_assertions v1.1.0
  Downloaded 72 crates (3.2 MB) in 0.71s
   Compiling cfg-if v1.0.0
   Compiling syn v1.0.107
   Compiling radium v0.7.0
   Compiling subtle v2.4.1
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error[E0463]: can't find crate for `compiler_builtins`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
  --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:88:1
   |
88 | extern crate std;
   | ^^^^^^^^^^^^^^^^^ can't find crate
   |
   = note: the `wasm32-unknown-unknown` target may not be installed
   = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error: cannot find attribute `derive` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:110:3
    |
110 | #[derive(Copy, Clone, Debug)]
    |   ^^^^^^

error: cannot find macro `debug_assert` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:145:9
    |
145 |         debug_assert!((source.0 == 0u8) | (source.0 == 1u8));
    |         ^^^^^^^^^^^^

error: cannot find macro `debug_assert` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:215:5
    |
215 |     debug_assert!((input == 0u8) | (input == 1u8));
    |     ^^^^^^^^^^^^

error: cannot find attribute `derive` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:569:3
    |
569 | #[derive(Clone, Copy, Debug)]
    |   ^^^^^^

error: cannot find macro `assert_eq` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:612:9
    |
612 |         assert_eq!(self.is_some.unwrap_u8(), 1);
    |         ^^^^^^^^^

error[E0405]: cannot find trait `From` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:129:6
    |
129 | impl From<Choice> for bool {
    |      ^^^^ not found in this scope

error[E0405]: cannot find trait `From` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:230:6
    |
230 | impl From<u8> for Choice {
    |      ^^^^ not found in this scope

error[E0405]: cannot find trait `Copy` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:357:36
    |
357 | pub trait ConditionallySelectable: Copy {
    |                                    ^^^^ not found in this scope

error[E0405]: cannot find trait `From` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:575:9
    |
575 | impl<T> From<CtOption<T>> for Option<T> {
    |         ^^^^ not found in this scope

error[E0425]: cannot find value `None` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:589:13
    |
589 |             None
    |             ^^^^ not found in this scope

error[E0405]: cannot find trait `FnOnce` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:633:12
    |
633 |         F: FnOnce() -> T,
    |            ^^^^^^ not found in this scope

error[E0405]: cannot find trait `Default` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:661:12
    |
661 |         T: Default + ConditionallySelectable,
    |            ^^^^^^^ not found in this scope

error[E0405]: cannot find trait `FnOnce` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:662:12
    |
662 |         F: FnOnce(T) -> U,
    |            ^^^^^^ not found in this scope

error[E0405]: cannot find trait `Default` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:684:12
    |
684 |         T: Default + ConditionallySelectable,
    |            ^^^^^^^ not found in this scope

error[E0405]: cannot find trait `FnOnce` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:685:12
    |
685 |         F: FnOnce(T) -> CtOption<U>,
    |            ^^^^^^ not found in this scope

error[E0405]: cannot find trait `FnOnce` in this scope
   --> /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:703:12
    |
703 |         F: FnOnce() -> CtOption<T>,
    |            ^^^^^^ not found in this scope

Some errors have detailed explanations: E0405, E0425, E0463.
For more information about an error, try `rustc --explain E0405`.
error: could not compile `subtle` due to 19 previous errors
make[1]: *** [Makefile:25: money_contract.wasm] Error 101
make[1]: Leaving directory '/home/bandura/darkfi/src/contract/money'
make: *** [Makefile:45: contracts] Error 2

Failed with error: could not compile subtle due to 19 previous errors

Expected behavior: Compile successful

Additional information:

$rustc --version
rustc 1.67.1 (d5a82bbd2 2023-02-07)
$rustup --version
rustup 1.25.2 (17db695f1 2023-02-01)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.67.1 (d5a82bbd2 2023-02-07)`
$lsb_release -a
No LSB modules are available.
Distributor ID:	Parrot
Description:	Parrot OS 5.2 (Electro Ara)
Release:	5.2
Codename:	ara
$git -v
git version 2.39.1

Solved with:

$rustup target add wasm32-unknown-unknown
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
 18.6 MiB /  18.6 MiB (100 %)  11.4 MiB/s in  1s ETA:  0s

Sorry for opening the issue.
I took from the readme that wasm32-unknown-unknown is built automatically when running make. This was probably a misunderstanding on my part.