use-ink / ink-playground

Browser Based Playground for editing, sharing & compiling ink! Smart Contracts
https://ink-playground.substrate.io
Apache License 2.0
26 stars 17 forks source link

`make generate` fails #727

Closed JoshOrndorff closed 1 year ago

JoshOrndorff commented 1 year ago

The make generate command in the readme fails to complete with the following output. I use this Ubuntu 22.04 system for daily Substrate work, but this is my first endeavor into ink!.

$ make generate
wasm-pack build crates/rust_analyzer_wasm/ --out-dir ../../packages/ink-editor/pkg --target web
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
info: syncing channel updates for 'nightly-2022-05-24-x86_64-unknown-linux-gnu'
info: latest update on 2022-05-24, rust version 1.63.0-nightly (ee160f2f5 2022-05-23)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
  Downloaded ra_ap_tt v0.0.120
  Downloaded ra_ap_test_utils v0.0.120
  Downloaded ra_ap_vfs v0.0.120
  Downloaded ra_ap_ide_db v0.0.120
  Downloaded wasm-bindgen-rayon v1.0.3
  Downloaded chalk-ir v0.83.0
  Downloaded chalk-recursive v0.83.0
  Downloaded anymap v1.0.0-beta.2
  Downloaded chalk-solve v0.83.0
  Downloaded dashmap v5.3.4
  Downloaded perf-event v0.4.8
  Downloaded ra_ap_cfg v0.0.120
  Downloaded ra_ap_hir v0.0.120
  Downloaded ra_ap_base_db v0.0.120
  Downloaded pulldown-cmark v0.9.2
  Downloaded perf-event-open-sys v4.0.0
  Downloaded ra_ap_hir_def v0.0.120
  Downloaded ra_ap_hir_expand v0.0.120
  Downloaded ra_ap_hir_ty v0.0.120
  Downloaded ra_ap_ide_ssr v0.0.120
  Downloaded ra_ap_paths v0.0.120
  Downloaded ra_ap_ide_completion v0.0.120
  Downloaded ra_ap_stdx v0.0.120
  Downloaded stacker v0.1.15
  Downloaded serde-wasm-bindgen v0.5.0
  Downloaded unicode-segmentation v1.10.1
  Downloaded serde_repr v0.1.12
  Downloaded rowan v0.15.11
  Downloaded ra_ap_text_edit v0.0.120
  Downloaded ra_ap_syntax v0.0.120
  Downloaded ra_ap_profile v0.0.120
  Downloaded ra_ap_parser v0.0.120
  Downloaded typed-arena v2.0.2
  Downloaded tracing v0.1.38
  Downloaded spmc v0.3.0
  Downloaded lsp-types v0.94.0
  Downloaded libc v0.2.141
  Downloaded chalk-derive v0.83.0
  Downloaded salsa v0.17.0-pre.2
  Downloaded ra_ap_toolchain v0.0.120
  Downloaded ra_ap_ide_assists v0.0.120
  Downloaded console_error_panic_hook v0.1.7
  Downloaded ra_ap_mbe v0.0.120
  Downloaded ra_ap_limit v0.0.120
  Downloaded ra_ap_la-arena v0.0.120
  Downloaded ra_ap_ide_diagnostics v0.0.120
  Downloaded ra_ap_ide v0.0.120
  Downloaded pulldown-cmark-to-cmark v10.0.4
  Downloaded ena v0.14.2
  Downloaded countme v3.0.1
  Downloaded 50 crates (3.9 MB) in 0.59s
error: "/home/joshy/.rustup/toolchains/nightly-2022-05-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try:
        rustup component add rust-src --toolchain nightly-2022-05-24-x86_64-unknown-linux-gnu
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit code: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
make: *** [Makefile:48: generate-rust-analyzer] Error 1

Running the suggested rustup component add rust-src --toolchain nightly-2022-05-24-x86_64-unknown-linux-gnu and trying again gets past this problem, but still I guess the make script should get this right.

achimcc commented 1 year ago

Looking into this, but let me say that the CI always ensures that the project builds on latest ubuntu.

See: https://github.com/paritytech/ink-playground/blob/main/.github/workflows/rust.yml

and: https://github.com/paritytech/ink-playground/actions/runs/5123640814/jobs/9214439679

achimcc commented 1 year ago

Just checked, we indeed execute not the full set of Docker commands directly in the CI, but we handle this in the Dockerfile:

https://github.com/paritytech/ink-playground/blob/main/Dockerfile

which ich build as part of the CI:

https://github.com/paritytech/ink-playground/blob/main/.github/workflows/docker.yml

See the last successfull CI run here:

https://github.com/paritytech/ink-playground/actions/runs/5123640812/jobs/9214439915

achimcc commented 1 year ago

@JoshOrndorff can you please try the following command:

make clean
rustup toolchain install nightly-2022-05-24
rustup component add rust-src --toolchain nightly-2022-05-24-x86_64-unknown-linux-gnu
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

And afterwards again:

make install
make generate
make backend-run
JoshOrndorff commented 1 year ago

make generate succeeds when I run these you suggested commands. Indeed I had already worked around this by installing the right toolchain as I reported at the end of the original issue. I just reported this so that you could improve the script so others don't hit this bump.

However, make backend-run still fails as I reported in #728

achimcc commented 1 year ago

Was a machine setup problem which is now solved by adding conditional wasm-pack installation to the Makefile by https://github.com/paritytech/ink-playground/pull/735.