Skip to content
New issue

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

WASI problem #3834

Closed
Rui-Gan opened this issue Jul 14, 2023 · 10 comments
Closed

WASI problem #3834

Rui-Gan opened this issue Jul 14, 2023 · 10 comments
Labels
wasm WebAssembly

Comments

@Rui-Gan
Copy link

Rui-Gan commented Jul 14, 2023

I am trying to compile the eKuiper project(https://github.com/lf-edge/ekuiper) to Wasi and then use wasmedge to run the compiled binary file. I used TinyGo to compile eKuiper to Wasi, but encountered issues.

When I ran the command below to compile eKuiper to Wasi:

tinygo build -o kuperd.wasm -target wasi cmd/kuiperd/main.go

I received the following error message:

# golang.org/x/sys/unix
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:1901:64: undefined: syscall.Rlimit
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:1906:50: undefined: syscall.Rlimit
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:1906:79: undefined: syscall.Rlimit
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:595:17: undefined: syscall.Setrlimit
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:595:47: undefined: syscall.Rlimit

I am not sure what causes this error and would appreciate any help. I would like to know why this issue occurs and how to resolve it.

@deadprogram deadprogram added the wasm WebAssembly label Jul 16, 2023
@HarikrishnanBalagopal
Copy link

HarikrishnanBalagopal commented Jul 19, 2023

@aykevl
Copy link
Member

aykevl commented Jul 19, 2023

This error message means that you are (directly or indirectly) importing golang.org/x/sys, which as you see isn't currently supported. Hopefully it will be once we switch to GOOS=wasip1 support (we currently use linux/arm for lack of real WASI support in the Go standard library).

@Rui-Gan
Copy link
Author

Rui-Gan commented Jul 20, 2023

Thanks for your reply,

@Rui-Gan Rui-Gan closed this as completed Jul 20, 2023
@aykevl
Copy link
Member

aykevl commented Aug 11, 2023

Also see: #3861

@maggie44
Copy link

Did you find a way to track down the package that was causing the issue? I am not building WASI, just the standard tinygo build but the same issue:

vendor/golang.org/x/sys/unix/syscall_unix.go:603:17: undefined: syscall.Setrlimit
vendor/golang.org/x/sys/unix/syscall_unix.go:603:47: undefined: syscall.Rlimit

Can't track which package is trying to call it though.

Copy link
Member

aykevl commented Aug 12, 2023

You can try tinygo list -deps -json -target wasi and inspect the output.

@inliquid
Copy link

Also encountered this issue with some gRPC (proto definitions) dependencies.

@aykevl
Copy link
Member

aykevl commented Sep 29, 2023

You can try GOOS=wasip1 GOARCH=wasm tinygo ... instead of tinygo -target=wasi. This means we use the standard library WASI support instead of our custom variant, which might get more code to compile.

@inliquid
Copy link

Thank you, will this approach become a standard way of compiling to WASI at some point?

@aykevl
Copy link
Member

aykevl commented Oct 1, 2023

Yes. It only works in Go 1.21+ and right now we support Go versions down to Go 1.18 so I think we should wait a bit before changing the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasm WebAssembly
Projects
None yet
Development

No branches or pull requests

6 participants