paritytech/wasm-utils

Cannot build simple Parity Ethereum contract

Closed this issue · 0 comments

I’m using the most recent version 0.9 of wasm-build to build the following contract.

#![no_std]
use pwasm_std;

#[no_mangle]
pub fn call() {}

#[no_mangle]
pub fn deploy() {}

The build script is

export RUSTFLAGS="-C panic=abort -C lto=yes -C opt-level=z -C link-args=-zstack-size=65536"
cargo build --target wasm32-unknown-unknown
wasm-build --target=wasm32-unknown-unknown ./target my_contract

This results in the error

Build error: Packing failed due to module structure error: No exported `deploy` symbol. Sure used correct libraries for building contracts?

If I add the --skipt-optimization flag I get

./target/my_contract.wasm:0000089: error: redefinition of export "call"

This problem was also raised in openethereum/pwasm-tutorial#48