tinygo
tinygo copied to clipboard
compiling to wasm with github.com/google/gopacket dependency hangs
I couldn't get any logs out of it, but a very simple application which instantiates a packet struct in the main hangs forever instead of getting compiled:
package main
import (
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
)
func main() {
// Decode a packet
_ = gopacket.NewPacket([]byte("my random data"), layers.LayerTypeEthernet, gopacket.Default)
}
tinygo build -target wasm main.go
Result: tinygo is using near 400% CPU, and compilation never finishes.
PS: I know that not all libraries are supported, just wanted to know what is the reason of this.
I have similar issue when upgrading.
An reproduction:
https://github.com/un-ts/sh-syntax/blob/775b7e74ee352bbd89233e97531ef9aa30e8ea19/package.json#L79
You can run tinygo build -o main.wasm -target wasm --no-debug, it will hang for a long time, and my test cases are all broken after compiled successfully.
I have similar issue with "github.com/sijms/go-ora/v2" this dependency.
when I run with --> env CGO_ENABLED=0 tinygo build -o main.wasm -target wasm command, it is hanging and not finished
but when I run with --> tinygo build -o main.wasm -target wasm, it is throwning this issues
# os/user
/usr/local/go/src/os/user/lookup.go:15:41: undeclared name: current
/usr/local/go/src/os/user/lookup.go:36:9: undeclared name: lookupUser
/usr/local/go/src/os/user/lookup.go:45:9: undeclared name: lookupUserId
/usr/local/go/src/os/user/lookup.go:51:9: undeclared name: lookupGroup
/usr/local/go/src/os/user/lookup.go:57:9: undeclared name: lookupGroupId
/usr/local/go/src/os/user/lookup.go:62:9: undeclared name: listGroups
Do you have any idea why is this happening ?
Try the building with -tags=osusergo. But my guess is that you'll hit the same hang (which I think is probably due to a bug in the interp pass, which there are already bugs filed about.)