Skip to content

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

Closed
iamthehimansh wants to merge 1 commit into
boykopovar:mainfrom
iamthehimansh:split/macos-build
Closed

iamthehimansh wants to merge 1 commit into
boykopovar:mainfrom
iamthehimansh:split/macos-build

Conversation

@iamthehimansh

@iamthehimansh iamthehimansh commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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)

…ts on macOS

A macOS build of main failed 49 objects. Most included
libc/include/FileStream.hpp, whose global-namespace ::feof_unlocked and
::ferror_unlocked do not exist there (they are macros in the macOS SDK).
On macOS:

- FileStream.hpp calls feof_unlocked and ferror_unlocked unqualified.
- ExportMacros.hpp adds the leading underscore Mach-O gives C symbols to
  both names in APS5_EXPORT, so the .set alias resolves.
- ThreadPriority.cpp 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 ENVIRONMENT.md.
- Formatting.cpp maps the SysV va_list builtins to va_list, and
  GuestContentSearch.cpp and GuestNpWebApi2.cpp include
  <initializer_list>.

With these, 16 objects still fail on macOS; each is in a file changed by
an open macOS PR. Linux and Windows compile the same code as before.
@github-actions github-actions Bot added the open PR limit Closed over the open PR limit: 1 without merged PRs, 20 with at least 1, none from 20 label Oct 23, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Authors with no pull requests merged into main can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open PR limit Closed over the open PR limit: 1 without merged PRs, 20 with at least 1, none from 20

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant