Skip to content

tinygo cgo compile error #3044

Open
Open
@halfrost

Description

@halfrost

hen I use tinygo to compile wasm plugin:

$ tinygo build -o main.wasm -scheduler=none -target=wasi main.go

compile error. The error log is:

# os/user
../../../../opt/Cellar/go/1.17.2/libexec/src/os/user/cgo_lookup_unix.go:21:6: not implemented: build constraints in #cgo line
../../../../opt/Cellar/go/1.17.2/libexec/src/os/user/cgo_lookup_unix.go:24:10: fatal: 'pwd.h' file not found
../../../../opt/Cellar/go/1.17.2/libexec/src/os/user/getgrouplist_unix.go:15:10: fatal: 'grp.h' file not found

Once I disabled the cgo compile parameters,

$ CGO_ENABLED=0 tinygo build -o main.wasm -scheduler=none -target=wasi main.go

The error log is:

# github.com/cespare/xxhash/v2
../../pkg/mod/github.com/cespare/xxhash/[email protected]/xxhash_unsafe.go:32:11: cannot use len(s) (value of type int) as uintptr value in assignment
../../pkg/mod/github.com/cespare/xxhash/[email protected]/xxhash_unsafe.go:33:11: cannot use len(s) (value of type int) as uintptr value in assignment
../../pkg/mod/github.com/cespare/xxhash/[email protected]/xxhash_unsafe.go:43:11: cannot use len(s) (value of type int) as uintptr value in assignment
../../pkg/mod/github.com/cespare/xxhash/[email protected]/xxhash_unsafe.go:44:11: cannot use len(s) (value of type int) as uintptr value in assignment

My dependencies include prometheus and etcd. Both of their dependencies include xxhash. Is there any good idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existsenhancementNew feature or requestreflectionNeeds further work on reflection

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions