Skip to content

The wasm compiled by go cannot be run using the iwasm tool provided by wasm-micro-runtime #68868

Closed as not planned
@littetimo567

Description

@littetimo567

Go version

go 1.23.0.linux/amd64

Output of go env in your module/workspace:

O111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/ema/.cache/go-build'
GOENV='/home/ema/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/ema/golang/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ema/golang/'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/ema/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/ema/core/local/emawamr/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2475111588=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I have a go file and want to compile it into a wasm file.

package main
import (
	"fmt"
)

func main() {}

//export Greet
func Greet() {
	fmt.Println("this is greet test")
}

First, I compile it into a greet.wasm using the go command :

GOOS=wasip1 GOARCH=wasm go build -o greet.wasm greet.go

And then, using tinygo to compile into greet2.wasm

tinygo build -target wasi -o greet2.wasm greet.go

Run the function Greet of greet.wasm and greet2.wasm using the iwasm tool provided by wasm-micro-runtime

What did you see happen?

The greet2.wasm was run successfully, but the greet.wasm was run failed, and display a error: lookup function failed

What did you expect to see?

The iwasm tool of wasm-micro-runtime can run the function from wasm which compiled by go

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