Skip to content

Failed to load pyodide wasm binary #2408

@lachie

Description

@lachie

Describe the bug
Trying to load pyodide wasm binary fails:
import[538] 0x4[env.__c_longjmp]: invalid byte: invalid byte for importdesc: 0x4
Wazero doesn't support tag ExternType

The actual symbol seems to be related to
https://github.com/WebAssembly/tool-conventions/blob/main/SetjmpLongjmp.md

pyodide uses emscripten

To Reproduce
Get pyodide release from https://github.com/pyodide/pyodide/releases/tag/0.28.0

package main

import (
	"context"
	"os"

	"github.com/tetratelabs/wazero"
	"github.com/tetratelabs/wazero/api"
	"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
)

func main() {
	ctx := context.Background()

	cfg := wazero.NewRuntimeConfig()
	cfg = cfg.WithCoreFeatures(api.CoreFeaturesV1).WithDebugInfoEnabled(true)

	runtime := wazero.NewRuntimeWithConfig(ctx, cfg)
	wasi_snapshot_preview1.MustInstantiate(ctx, runtime)

	bin, err := os.ReadFile("pyodide.asm.wasm")
	if err != nil {
		panic(err)
	}

	_, err = runtime.CompileModule(ctx, bin)
	if err != nil {
		panic(err)
	}
}

Expected behavior
The wasm binary is loaded into the interpreter, or compiled.

Environment (please complete the relevant information):

  • Go version: 1.24.4
  • wazero Version: v1.9.0
  • Host architecture: amd64
  • Runtime mode: interpreter or compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions