Error when running optimizer on cw-template.
Matthiaas opened this issue · 2 comments
Hey,
I am trying to optimize my smart contact, but couldn't get behind some errors the rust-optimizer returns.
When I run rust-optimizer in the root folder of a clean copy of https://github.com/InterWasm/cw-template I get these errors:
$ docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/rust-optimizer:0.11.3
info: RUSTC_WRAPPER=sccache
Info: sccache stats before build
Compile requests 0
Compile requests executed 0
Cache hits 0
Cache misses 0
Cache timeouts 0
Cache read errors 0
Forced recaches 0
Cache write errors 0
Compilation failures 0
Cache errors 0
Non-cacheable compilations 0
Non-cacheable calls 0
Non-compilation calls 0
Unsupported compiler calls 0
Average cache write 0.000 s
Average cache read miss 0.000 s
Average cache read hit 0.000 s
Failed distributed compilations 0
Cache location Local disk: "/root/.cache/sccache"
Cache size 0 bytes
Max cache size 10 GiB
Building contract in /code ...
Compiling quote v1.0.9
Compiling uint v0.9.3
error: edition 2021 is unstable and only available with -Z unstable-options.
error: could not compile `uint`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: checking for self-updates
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.60.0 (7737e0b5c 2022-04-04)
nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.62.0-nightly (4dd8b420c 2022-05-01)
info: cleaning up downloads & tmp directories
I tried changing rustup default to stable and nightly, but neither worked.
Would be greate if someone knows how to fix this or has any hints.
Cheers,
Matthiaas.
This error comes from using the old compiler version, which is not supporting the 2021 Rust version. It is already updated in the newest rust-optimizer, but you are using the older 0.11.3
version, while the newest one is 0.12.6
(https://hub.docker.com/r/cosmwasm/rust-optimizer/tags). Switching to: $ docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/rust-optimizer:0.12.6
should help (I don't remember if anything changes in terms of arguments, but don't think so). It is also how it is stated in README.md. Please let me know if it helps so I can close the issue if so (unless you see some place when still old version is pointed out, then please let me know where it is to correct the docs).
Thank you so much!
Yes, this getting-started guide still point to the old version:
https://docs.cosmwasm.com/docs/0.14/getting-started/compile-contract/