You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It solves the same problems but with a different tool. For more details visit the linked issue.
Instead of invoking Cargo in order to build ink! smart contracts we should instead build them using Xargo (https://crates.io/crates/xargo).
This requires another Xargo.toml in the contract's root directory with the following contents:
Also we have to remove the contents of the .cargo/config file to not override Xargo settings: (We demonstrate this here by simply commenting the line out.)
Another obstacle is that currently Cargo (or rustc) overrides profile settings given in Cargo.toml when rlib is specified as in:
[lib]
name = "erc20"
crate-type = [
# Used for normal contract Wasm blobs.
"cdylib",
# Used for ABI generation.
"rlib",
]
Unfortunately in ink! we use rlib for generating ink! metadata.
For automating this process we have to somehow get rid of this rlib field during compilation in order to NOT to override the following profile section in Cargo.toml:
So simply exchange cargo with xargo.
Also this still requires a pass by wasm-opt afterwards so this pass should be run before applying wasm-opt for final optimizations.
The text was updated successfully, but these errors were encountered:
Note that I haven't even tried to solve the issue with rustflags. I think it might be possible to workaround it by providing multiple -Clink-arg or somehow play with quotes.
@ascjones Good find! Didn't know that Xargo is in maintenance mode and I expected that this should be eventually be handled by cargo itself, especially in light of this announcment. However, the fact that the issue was created 20 Jan 2018 a bit discouraging... I hope for the best though!
This is a contender issue for: #22
It solves the same problems but with a different tool. For more details visit the linked issue.
Instead of invoking Cargo in order to build ink! smart contracts we should instead build them using Xargo (https://crates.io/crates/xargo).
This requires another
Xargo.toml
in the contract's root directory with the following contents:Also we have to remove the contents of the
.cargo/config
file to not override Xargo settings: (We demonstrate this here by simply commenting the line out.)Another obstacle is that currently Cargo (or
rustc
) overridesprofile
settings given inCargo.toml
whenrlib
is specified as in:Unfortunately in ink! we use
rlib
for generating ink! metadata.For automating this process we have to somehow get rid of this
rlib
field during compilation in order to NOT to override the followingprofile
section inCargo.toml
:All these settings are very important to get all the important optimizations in the final Wasm binary.
After taking all these steps building a highly optimized ink! Wasm smart contract is just:
So simply exchange
cargo
withxargo
.Also this still requires a pass by
wasm-opt
afterwards so this pass should be run before applyingwasm-opt
for final optimizations.The text was updated successfully, but these errors were encountered: