microsoft / microsoft/mimalloc

mimalloc3 wasi target fails to compile

Open
#1,134 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
13.4k
Forks
1.2k
Avg merge
4d 45m
Merged PRs (30d)
13

Description

I get the compilation errors when I try to build `mimalloc3` using `wasi` target.

```
git clone --branch v3.1.5 https://github.com/microsoft/mimalloc.git
```

```
~/w/h/s/h/t/mimalloc ((v3.1.5)) [1]> ~/workspace/build/wasi-sdk-23.0-x86_64-linux/bin/clang src/static.c -I include/ -I src/ --sysroot ~/workspace/build/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/
In file included from src/static.c:38:
In file included from src/prim/prim.c:19:
src/prim/wasi/prim.c:92:33: error: call to undeclared function 'mi_align_up_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
92 | void* aligned_current = mi_align_up_ptr(current, try_alignment); // and align from there to minimize wasted space
| ^
src/prim/wasi/prim.c:92:33: note: did you mean '_mi_align_up_ptr'?
include/mimalloc/internal.h:441:24: note: '_mi_align_up_ptr' declared here
441 | static inline uint8_t* _mi_align_up_ptr(void* p, size_t alignment) {
| ^
In file included from src/static.c:38:
In file included from src/prim/prim.c:19:
src/prim/wasi/prim.c:92:15: error: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
92 | void* aligned_current = mi_align_up_ptr(current, try_alignment); // and align from there to minimize wasted space
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/prim/wasi/prim.c:101:11: error: call to undeclared function 'mi_align_up_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
101 | p = mi_align_up_ptr(base, try_alignment);
| ^
src/prim/wasi/prim.c:101:9: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
101 | p = mi_align_up_ptr(base, try_alignment);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
```

I'm able to get rid of those by `s/mi_align_up_ptr/_mi_align_up_ptr`. I'm happy to create PR if that's what needed to fix it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the WASI SDK command shown in the issue, then inspect src/prim/wasi/prim.c at lines 92 and 101 and the helper declarations in include/mimalloc/internal.h. Confirm the WASI target builds successfully and that the alignment calls use the declared helper.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, wasm
Domain
operating-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.