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

Be able to compile to webassembly wasm #207

Closed
rgl opened this issue Jan 1, 2024 · 3 comments · Fixed by #208
Closed

Be able to compile to webassembly wasm #207

rgl opened this issue Jan 1, 2024 · 3 comments · Fixed by #208

Comments

@rgl
Copy link
Contributor

rgl commented Jan 1, 2024

It would be pretty nice to be able to target wasm.

Currently with with go 1.21.5 and go-diskfs 1.4.0. a simple program that creates a FAT32 disk image, is failing as:

GOOS=wasip1 GOARCH=wasm go build -o amt-setupbin-img.wasm
# gopkg.in/djherbis/times.v1
../../../../go/pkg/mod/gopkg.in/djherbis/[email protected]/times.go:11:9: undefined: getTimespec
../../../../go/pkg/mod/gopkg.in/djherbis/[email protected]/times.go:21:9: undefined: getTimespec
# github.com/sirupsen/logrus
../../../../go/pkg/mod/github.com/sirupsen/[email protected]/terminal_check_notappengine.go:13:10: undefined: isTerminal
# github.com/diskfs/go-diskfs/filesystem/squashfs
../../../../go/pkg/mod/github.com/diskfs/[email protected]/filesystem/squashfs/finalize.go:463:22: undefined: getFileProperties
../../../../go/pkg/mod/github.com/diskfs/[email protected]/filesystem/squashfs/finalize.go:1177:25: undefined: getDeviceNumbers
../../../../go/pkg/mod/github.com/diskfs/[email protected]/filesystem/squashfs/finalize.go:1202:25: undefined: getDeviceNumbers
@deitch
Copy link
Collaborator

deitch commented Jan 2, 2024

It would be nice, indeed, to have a wasm target for it (it also would be nice if this didn't auto-correct "wasm" to "warm" 😁 ).

Of the issues you raised:

  • getFileProperties and getDeviceNumbers: these have platform-specific functions, defined in finalize_unix.go and finalize_windows.go. I do not know what the equivalent implementations for wasm would be; if you know, and want to add a finalize_wasm.go, I definitely would take that.
  • getTimespec (from gopkg.in/djherbis/times.v1) - this one actually has some wasm support in v1.6.0, see times_wasip1.go. We can bump the dependency here to v1.6.0, which should solve it. Check it locally, and if that issue goes away, open the PR on this.
  • isTerminal (from github.com/sirupsen/logrus) is called here, and is defined on each platform: solaris, unix and windows. We have the latest semver, which does not have wasm support, but it looks like master branch does here. Go ahead and open a PR to bump this to latest. FYI, someone had a compilation issue, documented here.

@rgl
Copy link
Contributor Author

rgl commented Jan 2, 2024

Thank you! I will look into your suggestions and will report back!

@rgl
Copy link
Contributor Author

rgl commented Jan 3, 2024

@deitch got it working at #208 :-)

please take a look.

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

Successfully merging a pull request may close this issue.

2 participants