EmbarkStudios / EmbarkStudios/rpmalloc-rs

rpmalloc-sys fails to build for wasm target on Windows: fatal error: 'unistd.h' file not found

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
160
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Not sure if this allocator is intended to also work for wasm, but in my frontend I need speed more than size (it's a UI for a desktop application), so I thought I'd try it..
But it fails to build for wasm:
```
error: failed to run custom build command for `rpmalloc-sys v0.1.3`

--- stdout
TARGET = Some("wasm32-unknown-unknown")
HOST = Some("x86_64-pc-windows-msvc")
CC_wasm32-unknown-unknown = None
CC_wasm32_unknown_unknown = None
TARGET_CC = None
CC = None
CFLAGS_wasm32-unknown-unknown = None
CFLAGS_wasm32_unknown_unknown = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
running: "clang" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-DENABLE_PRELOAD=1" "-o" "D:\\project\\target\\wasm32-unknown-unknown\\debug\\build\\rpmalloc-sys-21068dcc5b7ecde5\\out\\rpmalloc.o" "-c" "C:\\Users\\me\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\rpmalloc-sys-0.1.3\\rpmalloc\\rpmalloc\\rpmalloc.c"
cargo:warning=C:\Users\me\.cargo\registry\src\github.com-1ecc6299db9ec823\rpmalloc-sys-0.1.3\rpmalloc\rpmalloc\rpmalloc.c:122:12: fatal error: 'unistd.h' file not found
cargo:warning=# include
cargo:warning= ^~~~~~~~~~
cargo:warning=1 error generated.
exit code: 1

--- stderr

error occurred: Command "clang" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-DENABLE_PRELOAD=1" "-o" "D:\\project\\target\\wasm32-unknown-unknown\\debug\\build\\rpmalloc-sys-21068dcc5b7ecde5\\out\\rpmalloc.o" "-c" "C:\\Users\\me\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\rpmalloc-sys-0.1.3\\rpmalloc\\rpmalloc\\rpmalloc.c" with args "clang" did not execute successfully (status code exit code: 1).
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by building rpmalloc-sys v0.1.3 for wasm32-unknown-unknown on Windows, then inspect rpmalloc/rpmalloc/rpmalloc.c around line 122 where unistd.h is included. Determine whether wasm is supported and verify the chosen fix by rerunning the same Cargo build successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.