We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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 version
$ go version go version go1.14.6 darwin/amd64
yes
go env
$ 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"
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 {} }
got a wasm file
# runtime/cgo unknown ptrSize for $GOARCH "wasm"
The text was updated successfully, but these errors were encountered:
cgo is not supported for wasm. The error could be clearer, though. Remove the import "C". You're not using it, and that should fix the problem.
import "C"
Sorry, something went wrong.
is cgo will support for wasm in future?
very unlikely as you would need a C to wasm compiler for you C dependencies.
I'm going to close this question as answered based on the answer from @randall77 above.
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
i trying build a wasm file:
and test.go source code is :
What did you expect to see?
got a wasm file
What did you see instead?
The text was updated successfully, but these errors were encountered: