fix(libSceLibcInternal): clamp the string count as size_t on macOS #17532

Merged
Gonic0 merged 1 commit from upstream-pr/17532 into main 2026-11-12 03:53:41 +00:00
Gonic0 commented 2026-11-08 20:37:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Gonic0 on 2026-11-08T20:37:07Z.


What

libSceLibcInternal does not compile on macOS on main:

BasicString.cpp:45:12: error: no matching function for call to 'min'

Clamp passes count (std::size_t) and source->size - position to std::min. GuestLocale::String::size is std::uint64_t, so the second argument is std::uint64_t. On macOS std::size_t is unsigned long and std::uint64_t is unsigned long long, so std::min cannot deduce one type. This names the type as std::min<std::size_t>, as other files do.

Both types are 64-bit unsigned on every target, so the value does not change. On Linux and Windows they are already the same type.

Tested

macOS 27.3, Apple M5 Pro, Apple clang, x86_64 Release under Rosetta 2. Tree: main 095ff72367 with #16591 and #17425, which macOS still needs to build libs. Nothing under libSceLibcInternal or GuestLocale.hpp changed between that commit and main 0bae53facd.

  • Without this change: ninja -k 0 libs fails on BasicString.cpp:45 with the error above.
  • With this change: libs (407 libraries, NID patching included) and relinker build.
  • guest_libc_internal_basic_string is registered only on Linux and MinGW. Enabled locally on macOS, it does not build, because GuestSceV2Exceptions.S uses ELF section directives. So it was not run.
  • Linux and Windows: not built locally.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5214909164 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17532). Originally posted by [Gonic0](https://github.com/Gonic0) on 2026-11-08T20:37:07Z. --- ### What `libSceLibcInternal` does not compile on macOS on `main`: ``` BasicString.cpp:45:12: error: no matching function for call to 'min' ``` `Clamp` passes `count` (`std::size_t`) and `source->size - position` to `std::min`. `GuestLocale::String::size` is `std::uint64_t`, so the second argument is `std::uint64_t`. On macOS `std::size_t` is `unsigned long` and `std::uint64_t` is `unsigned long long`, so `std::min` cannot deduce one type. This names the type as `std::min<std::size_t>`, as other files do. Both types are 64-bit unsigned on every target, so the value does not change. On Linux and Windows they are already the same type. ### Tested macOS 27.3, Apple M5 Pro, Apple clang, x86_64 Release under Rosetta 2. Tree: `main` `095ff72367` with #16591 and #17425, which macOS still needs to build `libs`. Nothing under `libSceLibcInternal` or `GuestLocale.hpp` changed between that commit and `main` `0bae53facd`. - Without this change: `ninja -k 0 libs` fails on `BasicString.cpp:45` with the error above. - With this change: `libs` (407 libraries, NID patching included) and `relinker` build. - `guest_libc_internal_basic_string` is registered only on Linux and MinGW. Enabled locally on macOS, it does not build, because `GuestSceV2Exceptions.S` uses ELF section directives. So it was not run. - Linux and Windows: not built locally. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!17532
No description provided.