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

syscall: EBADFD not defined for the wasip1 target #60998

Open
flavio opened this issue Jun 26, 2023 · 7 comments · May be fixed by #60999
Open

syscall: EBADFD not defined for the wasip1 target #60998

flavio opened this issue Jun 26, 2023 · 7 comments · May be fixed by #60999
Labels
arch-wasm WebAssembly issues compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@flavio
Copy link

flavio commented Jun 26, 2023

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

go version go1.21rc2 linux/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

What did you do?

I tried to compile some code using the spf13/afero library to the wasip1 target

A simple reproducer can be found here:

https://go.dev/play/p/3KyfMD2DTUd

What did you expect to see?

I expected the compilation to be successful

What did you see instead?

The compilation failed with this error:

GOOS=wasip1 GOARCH=wasm go build -o main.wasm
# github.com/spf13/afero
../go/pkg/mod/github.com/spf13/afero@v1.9.5/const_win_unix.go:22:23: undefined: syscall.EBADFD
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jun 26, 2023
flavio added a commit to flavio/go that referenced this issue Jun 26, 2023
@flavio flavio linked a pull request Jun 26, 2023 that will close this issue
@flavio
Copy link
Author

flavio commented Jun 26, 2023

CC @johanbrandhorst: sorry about the direct mention. I'm pinging you since you are in charge of the WASI port, and I think this might be relevant for you

@gopherbot
Copy link

Change https://go.dev/cl/506175 mentions this issue: syscall: define EBADFD for wasip1 target

@dmitshur dmitshur added the arch-wasm WebAssembly issues label Jun 26, 2023
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 26, 2023
@cagedmantis cagedmantis added this to the Go1.21 milestone Jun 26, 2023
@cagedmantis
Copy link
Contributor

/cc @golang/wasm

@ianlancetaylor
Copy link
Contributor

There are lots of systems that don't define EBADFD. Currently it seems to be defined only on Linux, Solaris, and Windows. Is it needed for wasip1? The package github.com/spf13/afero is already set up to use build tags for portability; perhaps we should instead adjust those build tags.

@flavio
Copy link
Author

flavio commented Jun 27, 2023

I can totally patch github.com/spf13/afero to make it work with wasip1.

I noticed EBADFD is defined inside of wasi-libc, which is then used by wasi-sdk. However I don't know if this is a strong enough motivation to have Go define this error 🤷‍♀️

@ianlancetaylor
Copy link
Contributor

I don't know much about wasi, but if the wasi C library does define and use EBADFD, then I'm OK with defining it in Go's syscall package. Thanks.

@mknyszek mknyszek added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 5, 2023
@gopherbot gopherbot modified the milestones: Go1.21, Go1.22 Aug 8, 2023
@anshuman-mor
Copy link

Facing same for

go1.21.5 aix/ppc64

@gopherbot gopherbot modified the milestones: Go1.22, Go1.23 Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly issues compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
Development

Successfully merging a pull request may close this issue.

7 participants