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

Cannot build with js environment #24

Closed
arranlomas opened this issue Jun 18, 2019 · 4 comments
Closed

Cannot build with js environment #24

arranlomas opened this issue Jun 18, 2019 · 4 comments

Comments

@arranlomas
Copy link

I am trying to build for WebAssembly using go web assembly (more info: https://github.com/golang/go/wiki/WebAssembly)

Running: GOOS=js GOARCH=wasm go build -o main.wasm
Error:

# github.com/edsrzf/mmap-go
./mmap.go:77:9: undefined: mmap
./mmap.go:92:10: m.lock undefined (type MMap has no field or method lock, but does have Lock)
./mmap.go:99:10: m.unlock undefined (type MMap has no field or method unlock, but does have Unlock)
./mmap.go:104:10: m.flush undefined (type MMap has no field or method flush, but does have Flush)
./mmap.go:114:10: m.unmap undefined (type *MMap has no field or method unmap, but does have Unmap)
@RELAXccc
Copy link

RELAXccc commented Oct 4, 2019

same here, did you find the problem?

# github.com/edsrzf/mmap-go ../github.com/edsrzf/mmap-go/mmap.go:77:9: undefined: mmap ../github.com/edsrzf/mmap-go/mmap.go:92:10: m.lock undefined (type MMap has no field or method lock, but does have Lock) ../github.com/edsrzf/mmap-go/mmap.go:99:10: m.unlock undefined (type MMap has no field or method unlock, but does have Unlock) ../github.com/edsrzf/mmap-go/mmap.go:104:10: m.flush undefined (type MMap has no field or method flush, but does have Flush) ../github.com/edsrzf/mmap-go/mmap.go:114:10: m.unmap undefined (type *MMap has no field or method unmap, but does have Unmap)

@edsrzf
Copy link
Owner

edsrzf commented Oct 4, 2019

The problem is that there is no mmap system call available in a WebAssembly environment. I think we'd need something like this to make it work: https://github.com/WebAssembly/design/blob/master/FutureFeatures.md#finer-grained-control-over-memory

@edsrzf
Copy link
Owner

edsrzf commented Dec 17, 2021

We could make it so that this package at least compiles in a JS environment, similar to what #25 does on Plan 9. I'm not sure of the appropriate error to return in that case, but I'm open to suggestions or pull requests.

@ajalab ajalab mentioned this issue Oct 8, 2024
@ajalab
Copy link
Contributor

ajalab commented Oct 8, 2024

Hi, I made a PR to fix this issue. #35

@edsrzf edsrzf closed this as completed Oct 9, 2024
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

4 participants