Ic-cdk-optimizer fails

running the command ic-cdk-optimizer wasm_files/contract.wasm throws an error

Original:          4.61 MiB
Stripping Unused Data Segments...
thread 'main' panicked at 'Pass failed:: Error(Deserialize("0082d15: error: unexpected opcode: 0xc1\n"))', /Users/pramitgaha/.cargo/registry/src/github.com-1ecc6299db9ec823/ic-cdk-optimizer-0.3.5/src/main.rs:44:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

and deploying also show the error

ailed to install wasm.
The Replica returned an error: code 5, message: "Wasm module of canister rrkah-fqaaa-aaaaa-aaaaq-cai is not valid: Failed to deserialize wasm module with Unknown opcode 193"

It looks like it thinks your wasm is not valid. How do you create it?

here is the toml file for it

[package]
name = "database"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["cdylib"]

[dependencies]
candid = "0.8.4"
csv = "1.1.6"
ic-cdk = "0.8.1"
ic-cdk-macros = "0.6.10"
ic-sqlite = "0.1.0"
ic-stable-memory = "0.4.4"
serde = "1.0.163"

and the build command that I used:

cargo build --target wasm32-unknown-unknown --release --package database --locked
mv target/wasm32-unknown-unknown/release/database.wasm wasm_files/
ic-cdk-optimizer wasm_files/database.wasm
gzip wasm_files/database.wasm

Hmm… looks like the wasm parser from ic-cdk-optimizer is a bit outdated. Op code 0xc1 has been standardised quite some time ago. Is there a specific reason you’re not using ic-wasm instead? the optimizer has been deprecated in favour of ic-wasm half(?) a year ago

oops, I didn’t knew about that one. I’ll try that…