Skip to content

wasm-shrink doesn't work as described? #2051

Open
@osa1

Description

@osa1

I'm trying to run wasm-shrink on a 17M .wasm file.

Issues:

  • The interestingness script path works if I pass ./script.sh or absolute path to the script, but script.sh fails with error: Failed to run predicate script 'test.sh'.

  • It seems to ignore -o, it always dumps the shrunk program to stdout, with or without -o.

  • The output is as .wat instead of .wasm, and contains a header like blah.shrunken.wasm :: 17840554 bytes (0.00% smaller).

  • It doesn't seem to shrink: see 0.00% above. I haven't compared the actual output because it's in wat format and my input is .wasm, but it seems like it's generating .wasm as well as .wat, as 0.00% smaller would be the shown amount in .wasm, not in .wat.

    When I enable trace logs I see lines like:

    [2025-02-13T11:23:45Z TRACE] Attempt #423: mutation failed (Error { kind: Parse(BinaryReaderError { inner: BinaryReaderErrorInner { message: "gc proposal not supported", kind: Custom, offset: 15, needed_hint: None } }) })
    

    So that should be the reason why it doesn't shrink.

    But it would be helpful to the user if it failed with this error in a visible way.

I tried with the latest released version of wasm-tools.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions