We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go 1.23.0.linux/amd64
go env
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'
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
Greet
greet.wasm
greet2.wasm
The greet2.wasm was run successfully, but the greet.wasm was run failed, and display a error: lookup function failed
The iwasm tool of wasm-micro-runtime can run the function from wasm which compiled by go
The text was updated successfully, but these errors were encountered:
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Sorry, something went wrong.
GOOS=wasip1 GOARCH=wasm only supported after go 1.21.0.linux/amd64 and not GOOS=js
GOOS=wasip1 GOARCH=wasm
go 1.21.0.linux/amd64
GOOS=js
see #65199
No branches or pull requests
Go version
go 1.23.0.linux/amd64
Output of
go env
in your module/workspace:What did you do?
I have a go file and want to compile it into a wasm file.
First, I compile it into a greet.wasm using the go command :
And then, using tinygo to compile into greet2.wasm
Run the function
Greet
ofgreet.wasm
andgreet2.wasm
using the iwasm tool provided by wasm-micro-runtimeWhat did you see happen?
The
greet2.wasm
was run successfully, but thegreet.wasm
was run failed, and display a error: lookup function failedWhat did you expect to see?
The iwasm tool of wasm-micro-runtime can run the function from wasm which compiled by go
The text was updated successfully, but these errors were encountered: