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.Umask not defined when compiling to wasi with tinygo #108

Open
mJehanno opened this issue Jan 25, 2025 · 6 comments
Open

syscall.Umask not defined when compiling to wasi with tinygo #108

mJehanno opened this issue Jan 25, 2025 · 6 comments

Comments

@mJehanno
Copy link

Hello,

I'm using [go-git/go-git] in my side-project. This project is supposed to be a plugin running in [extism] and therefore need to be cmpiled to wasi.

The problem is that when targeting wasi with tinygo I end up with the following error :

../../../go/pkg/mod/github.com/go-git/go-billy/[email protected]/osfs/os_wasip1.go:30:17: undefined: syscall.Umask
../../../go/pkg/mod/github.com/go-git/go-billy/[email protected]/osfs/os_wasip1.go:32:11: undefined: syscall.Umask

The way I understand it is that syscall.Umask does not exist in tinygo. I've been told (but could'nt find any matching sources) that tinygo expose an os.Umask instead.

I don't know if this would be the solution to fix compiling to wasi ?

@pjbgf
Copy link
Member

pjbgf commented Jan 25, 2025

@mJehanno that code is only used during tests, so we have more options here.

Do you know if TinyGo has any built-in tags it uses during compilation? If so a new os_wasip1.go could be created that targeted only wasip1 + TinyGo, making that no-op like we do for Windows for example.

@mJehanno
Copy link
Author

mJehanno commented Jan 25, 2025

I checked their doc, especially the ref pages with commands, subcommands and flags (https://tinygo.org/docs/reference/usage/) and found nothing that match go build tags :/

The closest behaviour might be ldflags.

Edit : Confused by this though https://github.com/tinygo-org/tinygo/blob/v0.25.0/targets/wasi.json

@pjbgf
Copy link
Member

pjbgf commented Jan 26, 2025

From that json, it looks like tinygo.wasm might be it. The new os_tinygo_wasip1.go would need //go:build wasip1 && tinygo.wasm and the existing would need the opposite //go:build wasip1 && !tinygo.wasm.

@mJehanno
Copy link
Author

Ok, i can try this in local if you want to be sure that it fixes the problem.

@mJehanno
Copy link
Author

mJehanno commented Jan 26, 2025

It seems like it worked even though wasip1 does not seems to be required in os_tinygo_wasip1 (neither in the name nor in the build tags`

The os.Umask does not exist though, I switched to empty func like the one for plan9.

DO you want me to create the PR ?

@pjbgf
Copy link
Member

pjbgf commented Feb 16, 2025

@mJehanno if you could that would be great. The umask is only being used for tests, so if that is a no-op in tinygo we probably can do the same we do for Windows.

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

No branches or pull requests

2 participants