kvcache-ai / kvcache-ai/Mooncake
[Bug] mooncake-store no longer builds on macOS: utils.h includes linux/memfd.h unconditionally since #3789
- Dominant language
- C++
- Stars
- 6.6k
- Forks
- 1.2k
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 312
Description
## What
`mooncake-store/include/utils.h:8-9` includes `` and `` unconditionally since #3789 (512MB hugepage support). On macOS neither header exists, so every TU that includes `utils.h` stops at configure-time-include resolution:
```
mooncake-store/include/utils.h:8:10: fatal error: 'linux/memfd.h' file not found
8 | #include
| ^
```
First failing target on a clean `cmake -DWITH_STORE=ON -DWITH_TE=OFF -DBUILD_UNIT_TESTS=ON` build: `mooncake_store_shared_objects.dir/mmap_arena.cpp.o` (also `utils.cpp.o`, `local_ssd/manager.cpp.o`, ...), macOS arm64, Apple Clang, SDK 15.x.
## Why it matters
The store still builds and ships a macOS wheel, and there is no macOS store-build lane in CI, so this slipped through silently. Local store development on Mac is broken on current main (`1caf8f8f9`).
## Suggested fix
Guard the Linux headers and the memfd flag path with `#ifdef __linux__` (the hugepage env query degrades to the default page size elsewhere; `utils.cpp`'s memfd use sites need the same guard). Happy to send that PR, it is small.
Found while building `master_service_test` locally for #3806; verified the failure reproduces on unmodified main.
Contributor guide
Research direction
Start with mooncake-store/include/utils.h:8-9 and the memfd use sites in utils.cpp, then reproduce the failure with the stated clean CMake configuration on macOS. Check the related mmap_arena.cpp.o, utils.cpp.o, and local_ssd/manager.cpp.o targets; done means the store builds without missing Linux headers while preserving the Linux path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100