scrtlabs / discovery-docker-network

Docker Network for the Discovery release of the Enigma Protocol
https://enigma.co
GNU Affero General Public License v3.0
21 stars 2 forks source link

Got error “linking with rust-lld failed: exit code: 1” when compiling contracts in examples #29

Closed thaodt closed 4 years ago

thaodt commented 5 years ago

Hi team, I got some troubles when compiling the contract simple_calculator. The others also got the same error. The error is described below:

Compiling contract v0.1.0 (/root/enigma-core/examples/eng_wasm_contracts/simple_calculator)
Running rustc --crate-name contract src/lib.rs --color always --crate-type cdylib --emit=dep-info,link -C opt-level=z -C panic=abort -C lto -C metadata=f6a228717b0787e8 --out-dir /root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/wasm32-unknown-unknown/release/deps -L dependency=/root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/release/deps --extern eng_wasm=/root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/wasm32-unknown-unknown/release/deps/libeng_wasm-fb7623dfcc30efa8.rlib --extern eng_wasm_derive=/root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/release/deps/libeng_wasm_derive-e470bc3e92339e2c.so -C linker=rust-lld
error: linking with rust-lld failed: exit code: 1
|
= note: “rust-lld” “-flavor” “wasm” “–no-threads” “-z” “stack-size=1048576” “–stack-first” “–allow-undefined” “–fatal-warnings” “–no-demangle” “–export-dynamic” “–no-entry” “-L” “/root/.rustup/toolchains/nightly-2019-05-20-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib” “/root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/wasm32-unknown-unknown/release/deps/contract.contract.2yh5mw4u-cgu.1.rcgu.o” “-o” “/root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/wasm32-unknown-unknown/release/deps/contract.wasm” “–export” “function_name” “–export” “deploy” “–export” “call” “–export” “args” “–export” “print” “–gc-sections” “-O2” “-L” “/root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/wasm32-unknown-unknown/release/deps” “-L” “/root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/release/deps” “-L” “/root/.rustup/toolchains/nightly-2019-05-20-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib” “/root/.rustup/toolchains/nightly-2019-05-20-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libcompiler_builtins-c2f76c4d0d77f31b.rlib” “–no-entry”
= note: rust-lld: error: failed to open /root/enigma-core/examples/eng_wasm_contracts/simple_calculator/target/wasm32-unknown-unknown/release/deps/contract.wasm: Invalid argument

I also google the error and this is the command which I tried to run:

RUSTFLAGS='-C linker=rust-lld' cargo build --release --target wasm32-unknown-unknown --verbose

And by the way, I also hope the compiled output file should be under

/target/wasm32-unknown-unknown/release/contract.wasm

But the error log pointed to the deeper tree: deps. Does it matter?

Can you guys please kindly help ?

thaodt commented 5 years ago

it's relating to Vagrant vm & rust wasm. Its working on pure Linux OS (Ubuntu 16.04 / 18.04 - tested). Already post the link refs here.

lacabra commented 4 years ago

@thaodt are you still experiencing this issue? We have released two newer versions since this issue, and I would like to confirm whether this is still active, or it can be closed?

thaodt commented 4 years ago

@thaodt are you still experiencing this issue? We have released two newer versions since this issue, and I would like to confirm whether this is still active, or it can be closed?

hi @lacabra I won't face this issue if I use a Linux distro. It only occurs when I install on Vagrant vm.

You maybe close this issue now.