build: compile the shared libc headers, thread priority and three tests on macOS #10362

Closed
iamthehimansh wants to merge 0 commits from upstream-pr/10362 into main
iamthehimansh commented 2026-10-23 19:21:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by iamthehimansh on 2026-10-23T19:21:50Z.


What

Part 1 of splitting #8658 into topic PRs, as @adriadam10 asked: the shared-file build fixes that let main compile further on macOS. #4627 (@mugurc) has since landed the Formatting.cpp and ExportMacros.hpp parts, so this PR now carries only what is still missing on main.

Changes, all on macOS only:

  • FileStream.hpp: call feof_unlocked / ferror_unlocked unqualified. The macOS SDK defines them as macros, so ::feof_unlocked does not exist.
  • StandardExceptions.cpp: const_cast the error-category vtable slot before the function-pointer reinterpret_cast, which Apple clang rejects as casting away qualifiers. Without it libc/src/exception/Exports.cpp fails to build since std::system_category landed.
  • ThreadPriority.cpp: macOS has no rtkit or RLIMIT_RTTIME. high asks for the user-interactive QoS class, and rt for a Mach time-constraint policy (period 1 ms, computation 0.5 ms), documented in docs/dev/ENVIRONMENT.md.
  • GuestContentSearch.cpp and GuestNpWebApi2.cpp: include <initializer_list>.

On macOS, main still fails 13 objects with this PR. Each is in a file another open macOS PR changes:

File Open PR
libc/src/GuestAllocations.cpp fix/macos-guest-allocations-dyld, PR to be opened by @krishalivaibhav
libkernel/DirectMemory/DirectMemory.cpp #7631
libkernel/Pthread/src/Thread.cpp, System/src/Process.cpp #7804
libkernel/System/src/Exception.cpp, tests/GuestRaiseException.cpp #4630
libkernel/File/src/NativeStat.cpp, SharedMemory.cpp, Stdio.cpp, Module/src/DynamicLoader.cpp, ModuleInfo.cpp, System/src/Rtld.cpp #7201, and the libkernel split PRs of #8658

Why

Upstream CI does not build macOS, so shared headers and new code keep breaking the macOS build of every library. Landing these first keeps the topic PRs from #8658 small, so each can be checked on its own.

Testing

  • macOS 26 (Apple M2 Pro, x86_64 under Rosetta, Release, Ninja), on main at a23f8fc9f: the remaining failures are the 13 objects above.
  • Linux and Windows compile the same code: every changed file's view under unifdef -U__APPLE__ (with -D__linux__ and with -D_WIN32) equals main.
  • python3 tools/check_conventions.py --base origin/main: all checks passed.

Depends on: none. Tracking: #8658.

  • One topic
  • Conventional Commit title
  • No new comments in code
  • No GPU code changed

AI-assisted: yes (Cana)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4988104455 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10362). Originally posted by [iamthehimansh](https://github.com/iamthehimansh) on 2026-10-23T19:21:50Z. --- ### What Part 1 of splitting #8658 into topic PRs, as @adriadam10 asked: the shared-file build fixes that let `main` compile further on macOS. #4627 (@mugurc) has since landed the `Formatting.cpp` and `ExportMacros.hpp` parts, so this PR now carries only what is still missing on `main`. Changes, all on macOS only: - `FileStream.hpp`: call `feof_unlocked` / `ferror_unlocked` unqualified. The macOS SDK defines them as macros, so `::feof_unlocked` does not exist. - `StandardExceptions.cpp`: `const_cast` the error-category vtable slot before the function-pointer `reinterpret_cast`, which Apple clang rejects as casting away qualifiers. Without it `libc/src/exception/Exports.cpp` fails to build since `std::system_category` landed. - `ThreadPriority.cpp`: macOS has no rtkit or `RLIMIT_RTTIME`. `high` asks for the user-interactive QoS class, and `rt` for a Mach time-constraint policy (period 1 ms, computation 0.5 ms), documented in `docs/dev/ENVIRONMENT.md`. - `GuestContentSearch.cpp` and `GuestNpWebApi2.cpp`: include `<initializer_list>`. On macOS, `main` still fails 13 objects with this PR. Each is in a file another open macOS PR changes: | File | Open PR | | --- | --- | | `libc/src/GuestAllocations.cpp` | [`fix/macos-guest-allocations-dyld`](https://github.com/iamthehimansh/AnyPS5/tree/fix/macos-guest-allocations-dyld), PR to be opened by @krishalivaibhav | | `libkernel/DirectMemory/DirectMemory.cpp` | #7631 | | `libkernel/Pthread/src/Thread.cpp`, `System/src/Process.cpp` | #7804 | | `libkernel/System/src/Exception.cpp`, `tests/GuestRaiseException.cpp` | #4630 | | `libkernel/File/src/NativeStat.cpp`, `SharedMemory.cpp`, `Stdio.cpp`, `Module/src/DynamicLoader.cpp`, `ModuleInfo.cpp`, `System/src/Rtld.cpp` | #7201, and the libkernel split PRs of #8658 | ### Why Upstream CI does not build macOS, so shared headers and new code keep breaking the macOS build of every library. Landing these first keeps the topic PRs from #8658 small, so each can be checked on its own. ### Testing - macOS 26 (Apple M2 Pro, x86_64 under Rosetta, Release, Ninja), on `main` at `a23f8fc9f`: the remaining failures are the 13 objects above. - Linux and Windows compile the same code: every changed file's view under `unifdef -U__APPLE__` (with `-D__linux__` and with `-D_WIN32`) equals `main`. - `python3 tools/check_conventions.py --base origin/main`: all checks passed. Depends on: none. Tracking: #8658. - [x] One topic - [x] Conventional Commit title - [x] No new comments in code - [x] No GPU code changed AI-assisted: yes (Cana)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10362
No description provided.