Error on contract compilation and optimization

when I run the following command to optimize my smart contract, it shows me the error given below.
But my rustc version is updated and it is 1.58.1
$docker run --rm -v “$(pwd)”:/contract --mount type=volume,source="$(basename “$(pwd)”)_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry enigmampc/secret-contract-optimizer
error: package uint v0.9.3 cannot be built because it requires rustc 1.56.1 or newer, while the currently active rustc version is 1.56.0

//Command to check rustc version:
$rustup --version
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active rustc version is rustc 1.58.1 (db9d1b20b 2022-01-20)

I had this issue recently too, ie: not compiling and saying I have an older version of rustc than I actually did. I installed clang and it worked, at least for me.

yeah, i faced this issue as well when tried to compile. After installing clang compilation worked fine.
but now the problem is in optimization which it will generate ‘contract.wasm’ file.

Hey if you are still facing the issue, I think the reason is because you are using the v1.0.5 optimizer (docker image), which I THINK is using Rust 1.56. Try using optimizer v1.0.6?


Yes, please use v1.0.6 of the optimizer, I’ve updated it to use rust 1.59.

1 Like

Yeah, thanks everybody. I have sorted out this by changing in script though.
But I appreciate your helps very much.

I’m running into the same error using the latest version of the contract optimizer. I’ve got rustc 1.64.0 as my active version, running on ubuntu 20.04.