Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instance type declaration size is out of bounds #1104

Open
MangoPeachGrape opened this issue Dec 13, 2024 · 2 comments
Open

instance type declaration size is out of bounds #1104

MangoPeachGrape opened this issue Dec 13, 2024 · 2 comments

Comments

@MangoPeachGrape
Copy link

Apologies if this isn't the correct place to report this.

I'm running into linking issues in rust after increasing the number of functions in the wit file.

I run wit-bindgen rust . to generate rust bindings from a wit file. That is then compiled in a static lib crate, which succeeds, but linking fails for a binary that is linked against the static library. Compiling the whole workspace with cargo b -r --target wasm32-wasip2.

error: linking with `wasm-component-ld` failed: exit code: 1
note: error: failed to parse core wasm for componentization
          Caused by:
              0: decoding custom section component-type:wit-bindgen:0.36.0:x:xx:xxx:encoded world
              1: instance type declaration size is out of bounds (at offset 0x8b)

The issue seems to start happening when there is around 45k functions. 44k functions worked fine, 45.5k didn't work, with everything else being the same.

Additional information that might matter:

  • The wit file currently has <20k types (resources, records, enums combined)
  • The produced .rs from wit-bindgen is ~60mb
  • The produced .rlib with the output of wit-bindgen is ~200mb
  • rustc 1.85.0-nightly (4d669fb34 2024-12-08)

Let me know if anything else is needed to identify the issue.
Thanks in advance!

@alexcrichton
Copy link
Member

Thanks for the report! Can you share a binary or two here perhaps? The limit here is hardcoded at this location and is pretty arbitrary and should be fine to increase.

@MangoPeachGrape
Copy link
Author

I cannot share the original wit file, but this test wit file seems to reproduce the same issue: testcase.txt (github doesn't allow .wit files?)

If anything else is needed for reproduction, please let me know.
Thanks for helping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants