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

Add emulated features from wasi-libc (like mmap) #3091

Closed
GregoryConrad opened this issue Jan 26, 2023 · 2 comments
Closed

Add emulated features from wasi-libc (like mmap) #3091

GregoryConrad opened this issue Jan 26, 2023 · 2 comments
Labels
C-API-request Category: API request

Comments

@GregoryConrad
Copy link

GregoryConrad commented Jan 26, 2023

When compiling to wasm32-wasi, libc does not include some emulated wasi-libc functions like mmap. When using wasi-libc directly, you can set some extra parameters to enable these emulated functions like:

-D_WASI_EMULATED_MMAN   # for clang
-lwasi-emulated-mman    # for lld

What would be the appropriate fix for this? I was hoping a cargo feature or something similar could solve the problem. I am a bit new here, so if I could get some guidance I would be happy to PR to supply these additions. (I see that changes would be needed for https://github.com/rust-lang/libc/blob/master/src/wasi.rs, but I am not sure what would need to change in build.rs or elsewhere to accommodate this.)

@GregoryConrad GregoryConrad added the C-API-request Category: API request label Jan 26, 2023
@GregoryConrad GregoryConrad changed the title Add optional features from wasi-libc (like mmap) Add emulated features from wasi-libc (like mmap) Jan 26, 2023
@GregoryConrad
Copy link
Author

I think I got a bit confused; I thought this libc was bundling the target libc implementation itself but it looks as though it isn't. It just handles the ffi bindings (please do correct me if I am wrong).

I'll make a PR with a cargo feature for wasi-emulated-mman (or something else if someone has a better suggestion) with the associated bindings, so that people building with their own wasi-libc sysroot can turn on the cargo feature and use mman.h.

@GregoryConrad
Copy link
Author

See #3093 for why this is getting closed.

@GregoryConrad GregoryConrad closed this as not planned Won't fix, can't repro, duplicate, stale Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API-request Category: API request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant