wasix-org/cargo-wasix

cargo wasix test error: Compilation error: Code for function is too large

Opened this issue · 3 comments

While my code successfully compiles under ordinary targets (package: citadel_pqcrypto), running cargo wasix test --package citadel_pqcrypto fails with: error: Unable to compile "/Users/nologik/avarok/Citadel-Protocol/target/wasm32-wasmer-wasi/debug/deps/primary-0e896da8cb2e0eac.wasm" ╰─▶ 1: Compilation error: Code for function is too large

I thought that maybe running wasmer run --enable-all /Users/nologik/avarok/Citadel-Protocol/target/wasm32-wasmer-wasi/debug/deps/primary-0e896da8cb2e0eac.wasm would solve the problem by enabling larger memory, however, it did not (I get the same error as above). How can I work around this?

Which optimisation level did you compile your code with?

The default. I didn't fiddle with the optimization level

I had to create a custom build profile:

[profile.wasix]
opt-level = 3
inherits = "dev"

cargo wasix test --package=citadel_pqcrypto --profile=wasix

Looks like you're right, I had to set the opt-level to the highest. Thanks @theduke, been awhile since we last chatted.