Skip to content

Example on creating a proper wasm file #1

@koenvo

Description

@koenvo

Hi,

Thanks for this really interesting library. This is a great step for writing code that can run in the browser and in a python backend!

I was wondering if you can share an example of how to compile WebAssembly so it's loadable by python-ext-wasm. I know this issue might be unrelated to this library.

I tried this:

  1. install theassemblyscript npm package
  2. start a new assemblyscript project: npx asinit sometest
  3. build the index.ts file using npm run-script asbuild

When I try to load the file I keep getting:

Traceback (most recent call last):
  File "tests/wasm/test.py", line 7, in <module>
    wasm = Instance(code)
RuntimeError: Failed to instantiate the module:
    link error: Import not found, namespace: env, name: abort

It looks like it's related to "Support imports (needs #28)" but I'm confused by your example which doesn't do anything with imports.

from wasmer import Instance
wasm = Instance(open('yourscript.wasm', 'rb').read())

from wasmbind import Module
module = Module(wasm)

Could you share a some info on how to create a proper .wasm file?

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions