Repository navigation
fix(kernel): build the param.json parser with libc++ before macOS 26 - #5041
Merged
oneandonlydean merged 1 commit intoOct 14, 2026
Merged
Conversation
Apple's libc++ marks floating-point std::from_chars unavailable below a macOS 26 deployment target, so the relinker-only build fails on macOS 15 since the JSON number conversion switched to it. Use from_chars where the standard library defines __cpp_lib_to_chars and otherwise convert through a stream imbued with the classic locale, which keeps the conversion independent of the host locale and keeps the full-consumption and range checks.
9 tasks done
11 tasks done
Contributor
|
Tested with a newer toolchain than the one above: macOS 27.0.1, Apple silicon, Apple clang 21 with the macOS 27 SDK (libc++ 22.1), CMake 4.4, Ninja, relinker-only Release. This PR (
AI-assisted: yes (Claude Code). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Since #4558 the relinker-only build no longer compiles on macOS 15.
ParamJsonParser.cppconverts JSON numbers with floating-pointstd::from_chars, which Apple's libc++ marks unavailable below a macOS 26 deployment target:Both
relinkerandparam_json_utf8_testsinclude that file, so the build stops there. CI does not see it because themacos-latestrelinker job now runs on macOS 26.6, where the deployment target already satisfies the annotation.The conversion moves into
parseJsonNumberValue:__cpp_lib_to_charsit usesstd::from_charsexactly as onmain. libstdc++ defines the macro and gates its own floatingfrom_charsdeclarations on it, so the Linux and Windows builds keep the current code.std::istringstreamimbued withstd::locale::classic(). libc++ does not define__cpp_lib_to_chars(it is commented out in libc++ 20's<version>), so this is the macOS path. libc++ converts withstrtod_land the C locale, so the result does not depend onLC_NUMERICor the global C++ locale. libc++ already defines__cpp_lib_formatand__cpp_lib_printonly when floating-pointto_charsis available for the deployment target, so a later version that defines__cpp_lib_to_charscan be expected to gate it the same way.number outside supported range in param.jsonwhen it does not convert to adouble, as before.A stream is not used everywhere because libstdc++'s generic locale model, which MinGW-w64 uses, switches the process-wide C locale to
"C"around each stream conversion, andparseParamJsonis reached fromensureTitleLoadedwhile guest threads run.from_charsstays where it is available.This follows the same feature-test pattern as
AtomicSharedPtrin #4629.Tested
macOS 15.8 (24H23), Apple M4 Max, Apple clang 17.0.0 with the Xcode 26 SDK (libc++ 20.1), CMake 4.4.3, Unix Makefiles, Release,
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON. No title or PS5 hardware needed.main(c13dc7e): the build fails with the error above forrelinkerandparam_json_utf8_tests.ctestpasses 134 of 134.param_json_utf8:fr_FR.UTF-8is available on this host, soCheckNumericLocaleruns the comma-decimal regression from fix(kernel): parse JSON numbers independently of host locale #4558 instead of printing the skip message, and it passes. As a negative control, the same test built against a copy of the parser that usesstd::stodfails withJSON number depends on host locale: 1.25e3.from_charsbranch was syntax-checked with clang against a macOS 26 target. It was not built with GCC locally; it is the codemainalready builds on Linux and Windows.python3 tools/check_conventions.py --base origin/mainpasses.ParamJsonParser.cpp; both merge cleanly with this branch.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)