build(audio): link one SDL copy on macOS #11049
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11049"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-25T15:11:21Z.
What
This is mugurc's
63db337cd8from his macOS series (ci/macos-series-2, listed on #1). mugurc is co-author of the commit. It sits on #10669, whose--exclude-libslines it moves into the non-Apple branch.On macOS the Objective-C runtime registers SDL's classes from every copy in the process.
libSceAgcDriver,libSceVideoOut,libSceAudioInandlibSceAudioOuteach link SDL2 statically, so a relinked game prints, for each of 14 SDL classes and each extra copy,Class SDL_... is implemented in both ... One of the duplicates must be removed or renamed, and the runtime warns this "may cause spurious casting failures and mysterious crashes".On Apple,
libSceAudioInandlibSceAudioOutnow linklibSceAgcDriver, which holds the process's SDL, instead of their own copy. Linux and Windows are unchanged.Tested
Apple M4 Pro, macOS 27.0.1, Apple clang 21, x86-64 Release under Rosetta 2 (
-DCMAKE_OSX_ARCHITECTURES=x86_64, Ninja,BUILD_TESTING=ON).mainalone doesn't build the libraries on macOS, so the tree ismain61fc572ceewith #10423, the open macOS build PRs (#10366, #10419, #10552, #7631, #7804, #4630, #10540, #10659, #10660, #10669, #10676), #10889, #10898 and the parts of mugurc's series that #7201 also carries. Planet of Lana (PPSA19450) is relinked with that tree's relinker (--macos --to-rosetta).libSceAudioIn,libSceAudioOutandlibSceVideoOutagainstlibSceAgcDriver.libSceVideoOut, which still links its own copy. Moving it the same way is a follow-up. The Lana runs in #11047 and #11048 were made with this change.ctest -R audio(51 tests) passes without and with it.Linux and Windows: not built; the change only adds an
if(APPLE)branch.check_conventions.py --base upstream/mainpasses.pr_overlap.pyreports no conflict; it couldn't compare #7201 and #5021 on the two CMake files, because both conflict withmain.#7201 (the whole macOS port) and #5021 (the native ARM64 AOT draft) carry their own versions of these functions. #7201's head (
6687cbac29, 2026-10-16) conflicts withmain, needs a rebase anyway, and is being split into smaller PRs such as #10552 and #10419. #5021 is a draft of more than 43,000 lines that conflicts withmainand says no merge intomainis implied. If either lands first with these functions, this PR is not needed and I will close it.Checklist
main; no other open PR implements the same functions (except #7201 and #5021, see the end of Tested)NotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T15:15:16Z.
Review: APPROVED
Reviewed exact head
afdd82c67b3372af27242bbfcec44374010fbf31. The Apple-only link changes make AudioIn and AudioOut depend on the existing AgcDriver shared target, whose own link line owns SDL2-static; their non-Apple SDL links remain unchanged. #10669 is still open and is correctly named as the dependency. The author reports the macOS duplicate-class warnings dropping from 42 to 14, with the remaining 14 coming from VideoOut, plus 51 audio tests passing. Hosted conventions/intake/eligibility checks pass; platform build jobs are skipped by path policy. I reviewed the CMake dependency and overlap context; I could not run the Apple build here.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T15:33:22Z.
Review: APPROVED
Reviewed exact head
afdd82c67b3372af27242bbfcec44374010fbf31. On Apple, AudioIn and AudioOut now depend on the existinglibSceAgcDrivershared target, which ownsSDL2-static; the non-Apple SDL links remain unchanged. The PR declares its dependency on #10669. The author reports 42 duplicate Objective-C SDL class warnings before and 14 after (the remaining 14 are from VideoOut, outside this PR), and 51 audio tests passing on macOS x86-64 under Rosetta. Hosted conventions, eligibility, intake, labels and report checks pass; platform build jobs are skipped by path policy. I could not independently rerun the Apple build or audio tests on this Linux host.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T19:17:18Z.
Review: COMMENTED
Reviewed
afdd82c67b3372af27242bbfcec44374010fbf31. Pending review.CMake linkage branches are verified; native macOS SDL behavior remains unverified in this review.
Validation: Executed the submitted AudioIn/AudioOut CMake on head and base across Darwin/Linux/Windows branches. Darwin uses libSceAgcDriver and drops the extra SDL2-static/exclude-libs linkage; the Linux/Windows link commands retain their old behavior.
Scope / next step: This does not prove Mach-O symbol resolution or Objective-C class identity. The author describes a combined macOS-series run; I did not independently execute or certify that integration. Native Apple evidence remains the limit on approval.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T10:04:00Z.
Review: COMMENTED
Reviewed — comments
The diff directs the two audio libraries to link
libSceAgcDriveron Apple and adds that dependency to the timing test; I could not verify the reported builds or runtime behavior.What I ran
Reviewed head
978f05f4427bb05cc914c12756c62c0d2ab688d0. No build or tests were run. I read the prepared description, commits, manifest, diff, both changed CMake files, the root CMake configuration, and the AgcDriver target definition usingrepo_read.py.Results
Findings
Blocking
None.
Non-blocking
libSceAgcDriver, which itself linksSDL2-static(per its CMake target definition). This appears to centralize SDL on Apple as described. The reported macOS build and runtime checks were not independently reproduced.Not verified
Linux and Windows builds, the reported macOS build and
ctest -R audiorun, and the game relink/runtime warning counts were not independently verified.files.jsonwas not available through the reader; the manifest lists both changed files as included, and both were read. No other excluded changed files were listed in the manifest.To get this to a good state
Nothing is required. Optional: retain macOS build and runtime evidence for the integration that supplies this target dependency.
Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-11-23T02:41:58Z.
Review: CHANGES_REQUESTED
@imellag I confirmed the Nov. 20 blocker against current head
978f05f4427bb05cc914c12756c62c0d2ab688d0. On Apple this PR makes libSceAudioIn and libSceAudioOut share the SDL copy from libSceAgcDriver, but AudioIn still callsSDL_InitSubSystem(SDL_INIT_AUDIO)under its owng_mutex, while AudioOut callsInitializeSdlAudio_nid_no_patch()under a different static initialization mutex. That leaves concurrent AudioIn/AudioOut opens able to enter SDL audio initialization independently on the same SDL instance. Romannachwievor reproduced failures/crashes with concurrent real-CoreAudio starts and 0 failures after routing Apple AudioIn throughInitializeSdlAudio_nid_no_patch(). Please fold that serialization into this PR (the proposed Apple-only AudioIn -> libSceAudioOut link has no reverse dependency) and retain the existing audio-target build/test coverage. This is also a prerequisite blocker for #24341. AI-assisted: yesImported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:43:26Z.
Review: COMMENTED
The Linux integration build passed the three selected audio CTests covering default input, resampling, and AudioOut2 timing. The Apple-specific link path remains outside this run.
AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.