spacemeshos / svm

SVM - Spacemesh Virtual Machine
https://spacemesh.io
MIT License
85 stars 14 forks source link

Error in building the SVM project crates #499

Closed joyosive closed 2 years ago

joyosive commented 2 years ago

Overview / Motivation

Trying to build svm project on local ubuntu 22.04

The Task

  1. Rust nightly setup done from following link - https://doc.rust-lang.org/1.2.0/book/nightly-rust.html

  2. Cloned [svm] - git clone https://github.com/spacemeshos/svm.git

  3. Executed build command - cargo build

  4. Error Output for cargo build -

error: couldn't read crates/host/genesis-config/src/../../../../simple-coin-transfer-template/simple_coin_transfer_template.wasm: No such file or directory (os error 2)

--> crates/host/genesis-config/src/lib.rs:40:9 40 / include_bytes!( 41 "../../../../simple-coin-transfer-template/simple_coin_transfer_template.wasm" 42 ) _____^

= note: this error originates in the macro include_bytes

  1. Seeking guidance to build the svm repo successfully

Implementation Notes

Followed the project's readme

WilfredTA commented 2 years ago

First must execute the build script in the simple_coin_transfer directory, which will generate the wasm file in question: https://github.com/spacemeshos/svm/blob/master/simple-coin-transfer-template/build.sh

I will caution that this repository will be undergoing very large changes in the coming months, so please do not regard its current design & implementation as stable or indicative of its future direction :)

Please let me know if this resolves your problem.

joyosive commented 2 years ago

@WilfredTA thanks I acknowledge that this repository will undergo changes.

I executed the build script in the simple_coin_transfer directory, then executed cargo build it was successful with a warning. The cargo test fails with following error

error: couldn't read crates/host/runtime/tests/wasm/runtime_calldata.wasm: No such file or directory (os error 2) --> crates/host/runtime/tests/runtime_tests.rs:133:26 133 WasmFile::Binary(include_bytes!("wasm/runtime_calldata.wasm")), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
WilfredTA commented 2 years ago

In general, if this error appears anywhere, locate the parent directory of the missing file. There will likely be a build.sh script that needs to be executed.

This should certainly be refactored so that a single command (e.g., a make recipe) can be used to build all of the relevant script dependencies. Apologies for this friction when attempting to experiment with the svm.

Anyway, this is the build.sh file that should be run to address the latest error you've reported https://github.com/spacemeshos/svm/blob/master/crates/host/runtime/tests/wasm/calldata/build.sh

joyosive commented 2 years ago

@WilfredTA Okay got it, make recipe will be great!

Thank you for helping out