Skip to content

unknown ptrSize for $GOARCH "wasm" #40543

Closed
@Taoja

Description

@Taoja

What version of Go are you using (go version)?

$ go version
go version go1.14.6 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/huangwutao/Library/Caches/go-build"
GOENV="/Users/huangwutao/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/huangwutao/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y4/5jgjdbn12rg03j1__vf0mg340000gn/T/go-build891741688=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

i trying build a wasm file:

$ GOOS=js GOARCH=wasm go build -o lib.wasm test.go

and test.go source code is :

package main

import "C"

import (
	"syscall/js"
)

func main() {
	var window = js.Global()
	var cb = js.FuncOf(func(this js.Value, args []js.Value) interface{} {
		return args[0].Int() + args[1].Int()
	})
	window.Set("test", cb)
	select {}
}

What did you expect to see?

got a wasm file

What did you see instead?

# runtime/cgo
unknown ptrSize for $GOARCH "wasm"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions