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

error: module does not export a function named cabi_realloc #127

Closed
jakehemmerle opened this issue Aug 30, 2023 · 3 comments
Closed

error: module does not export a function named cabi_realloc #127

jakehemmerle opened this issue Aug 30, 2023 · 3 comments

Comments

@jakehemmerle
Copy link

I recently updated cargo component and while trying to compile a component, I got the following error while running cargo component build -p template-barebones --target wasm32-unknown-unknown --release

...
   Compiling wit-bindgen v0.7.0
   Compiling ec-core v0.1.0 (/Users/jake/codebases/entropy/constraints/core)
   Compiling template-barebones v0.1.0 (/Users/jake/codebases/entropy/constraints/examples/barebones)
    Finished release [optimized] target(s) in 9.19s
    Creating component /Users/jake/codebases/entropy/constraints/target/wasm32-unknown-unknown/release/template_barebones.wasm
error: module does not export a function named `cabi_realloc`

That said, the generated .wasm file still appears to be somewhat of a valid component, as executing wasm-tools component wit on it shows a wit (although with root for the package and world name, but that might be an unrelated issue).

With this error, the generated bytecode does not run in the wasmtime instance like it used to. Note, I'm not using WASI

I tried doing a bit of research into cabi_realloc (such as this issue) but haven't quite grasped what I did to cause this to start popping up.

Any thoughts on how to get cabi_realloc to generate? Possibly related, I'm using wit-bindgen v0.7.0, although I'm the process of updating it to v0.11.0 (I see lots of macro parameters have changed).

@peterhuene
Copy link
Member

Hi @jakehemmerle!

What version of cargo-component are you using?

Do you have a small repro project I could look at?

From the version of wit-bindgen in the output, it looks like things might still be out-of-date.

@jakehemmerle
Copy link
Author

Hi @jakehemmerle!

What version of cargo-component are you using?

Do you have a small repro project I could look at?

From the version of wit-bindgen in the output, it looks like things might still be out-of-date.

Hey Peter!

cargo component version was todays master build.

I can open a repo project tomorrow if you wouldn't mind taking a peek.

I was thinking that might be related, since it seems like wit-bindgen would generate and export that function. Let me see if I can update that as well.

@bytecodealliance bytecodealliance deleted a comment from jakehemmerle Aug 30, 2023
@jakehemmerle
Copy link
Author

@peterhuene it appears that it was my end withwit-bindgen. I've gotten into the habit of disabling features by default, and the "realloc" feature was disabled, which exports the cabi_realloc() function.

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