fix(libcurl): build the curl backend for the macOS target architecture #17425

Merged
Gonic0 merged 2 commits from upstream-pr/17425 into main 2026-12-04 02:00:15 +00:00
Gonic0 commented 2026-11-08 19:27:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Gonic0 on 2026-11-08T19:27:28Z.


What

libcurl does not link in the macOS build on main, for two reasons:

  • The curl backend is an ExternalProject that does not receive CMAKE_OSX_ARCHITECTURES. The top-level CMakeLists.txt sets it to x86_64 on macOS, but on Apple Silicon the backend is configured for the host and libcurl.a comes out arm64, so ld ignores every object in it. This now passes the architecture as core/Decoder/Jpeg/CMakeLists.txt already does for libjpeg-turbo.
  • curl calls SCDynamicStoreCopyProxies and CFRelease on macOS (lib/hostip.c, CURL_OSX_CALL_COPYPROXIES). curl's own CMake adds the frameworks to its own targets only, and CURL_ENABLE_EXPORT_TARGET is off here, so anyps5_curl_backend now links CoreFoundation and SystemConfiguration on Apple, next to the existing Windows and Linux system libraries.

When libcurl fails, the NID patch step for the whole libs target does not run either.

Both changes are under APPLE, so Linux and Windows build the same as before.

Tested

macOS 27.3, Apple M5 Pro, Apple clang, x86_64 Release under Rosetta 2. Tree: main 095ff72367 with #16591 and #17532, which macOS still needs to build libs.

  • Without the architecture line: ld: warning: ignoring file '.../libcurl.a(...)': found architecture 'arm64', required architecture 'x86_64' and undefined symbols such as _Curl_ccalloc.
  • Without the frameworks: Undefined symbols for architecture x86_64: "_CFRelease", "_SCDynamicStoreCopyProxies".
  • With this change: libcurl.a is x86_64 (lipo -info), libs and relinker build, and the 8 guest_curl* tests pass (ctest -R guest_curl).
  • 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

Summary by CodeRabbit

  • Build Improvements
    • Improved Apple build configuration to support specified architectures and link required system frameworks.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5214390503 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17425). Originally posted by [Gonic0](https://github.com/Gonic0) on 2026-11-08T19:27:28Z. --- ### What `libcurl` does not link in the macOS build on `main`, for two reasons: - The curl backend is an `ExternalProject` that does not receive `CMAKE_OSX_ARCHITECTURES`. The top-level `CMakeLists.txt` sets it to `x86_64` on macOS, but on Apple Silicon the backend is configured for the host and `libcurl.a` comes out arm64, so `ld` ignores every object in it. This now passes the architecture as `core/Decoder/Jpeg/CMakeLists.txt` already does for libjpeg-turbo. - curl calls `SCDynamicStoreCopyProxies` and `CFRelease` on macOS (`lib/hostip.c`, `CURL_OSX_CALL_COPYPROXIES`). curl's own CMake adds the frameworks to its own targets only, and `CURL_ENABLE_EXPORT_TARGET` is off here, so `anyps5_curl_backend` now links `CoreFoundation` and `SystemConfiguration` on Apple, next to the existing Windows and Linux system libraries. When `libcurl` fails, the NID patch step for the whole `libs` target does not run either. Both changes are under `APPLE`, so Linux and Windows build the same as before. ### Tested macOS 27.3, Apple M5 Pro, Apple clang, x86_64 Release under Rosetta 2. Tree: `main` `095ff72367` with #16591 and #17532, which macOS still needs to build `libs`. - Without the architecture line: `ld: warning: ignoring file '.../libcurl.a(...)': found architecture 'arm64', required architecture 'x86_64'` and undefined symbols such as `_Curl_ccalloc`. - Without the frameworks: `Undefined symbols for architecture x86_64: "_CFRelease", "_SCDynamicStoreCopyProxies"`. - With this change: `libcurl.a` is x86_64 (`lipo -info`), `libs` and `relinker` build, and the 8 `guest_curl*` tests pass (`ctest -R guest_curl`). - 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) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Build Improvements** * Improved Apple build configuration to support specified architectures and link required system frameworks. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
kurexw commented 2026-11-16 11:17:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-16T11:17:26Z.

Review: COMMENTED


Tested on macOS 27.2, Apple Silicon (M4), full build (x86-64 under Rosetta 2), merged onto main 04f7633c01 with git merge --no-ff.

  • Without this PR: core/libs/libs/unpatched/libcurl.prx fails to link because the curl backend is built as arm64. As a result, every target that depends on core/libs/libs is skipped, and its tests show as Not Run.
  • With this PR: ninja -k 0 -C build finishes with no failures, and lipo -archs libcurl.prx reports x86_64.
  • Tests: all 33 tests that main leaves Not Run here pass. That covers all 11 guest_curl* tests, the FreeType postscript, memory, module-property, stroker and legacy-metadata tests (both NID and non-NID variants), guest_libressl_protocol (both variants), guest_libressl3_ec_parameters, guest_libressl3_ecdsa_sig, guest_libressl3_rsa_getters, net_reuseport_patched, net_ipv6only_patched and patched_libraries.

Not tested: an Intel Mac, and a native arm64 build.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5919094308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17425#pullrequestreview-5919094308). Originally posted by [kurexw](https://github.com/kurexw) on 2026-11-16T11:17:26Z. **Review:** COMMENTED --- Tested on macOS 27.2, Apple Silicon (M4), full build (x86-64 under Rosetta 2), merged onto `main` 04f7633c01 with `git merge --no-ff`. - **Without this PR:** `core/libs/libs/unpatched/libcurl.prx` fails to link because the curl backend is built as arm64. As a result, every target that depends on `core/libs/libs` is skipped, and its tests show as Not Run. - **With this PR:** `ninja -k 0 -C build` finishes with no failures, and `lipo -archs libcurl.prx` reports `x86_64`. - **Tests:** all 33 tests that `main` leaves Not Run here pass. That covers all 11 `guest_curl*` tests, the FreeType postscript, memory, module-property, stroker and legacy-metadata tests (both NID and non-NID variants), `guest_libressl_protocol` (both variants), `guest_libressl3_ec_parameters`, `guest_libressl3_ecdsa_sig`, `guest_libressl3_rsa_getters`, `net_reuseport_patched`, `net_ipv6only_patched` and `patched_libraries`. Not tested: an Intel Mac, and a native arm64 build.
MarcZX10 commented 2026-11-20 07:55:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T07:55:50Z.

Review: APPROVED


Reviewed — looks good

The change passes the macOS target architecture to the external curl build and links the Apple frameworks used by curl; no blocking defect was found in the changed code.

What I ran

Read the prepared description, commit summary, manifest, and diff for head e039596d8e9ce68b505de99f784981e1ef941586. Read the complete changed file core/libs/prx/libcurl/CMakeLists.txt through repo_read.py and searched repository references to CMAKE_OSX_ARCHITECTURES and the curl external project. No build or tests were run.

Results

Check Result Note
Changed code review passed Architecture and framework wiring inspected
Build and tests not run Author reports macOS build and curl tests
Other platform builds not run Linux and Windows not built locally

Findings

Blocking

None.

Non-blocking

None.

Not verified

Builds and tests were not run independently. The author reports a macOS 27.3 Apple M5 Pro x86_64 Release build under Rosetta, successful libs and relinker builds, and eight guest_curl* tests passing. Linux and Windows behavior was not verified. The changed file was read in full; no other files were listed as changed in the manifest. files.json was not available in the prepared review folder.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5989263579 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17425#pullrequestreview-5989263579). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T07:55:50Z. **Review:** APPROVED --- # Reviewed — looks good The change passes the macOS target architecture to the external curl build and links the Apple frameworks used by curl; no blocking defect was found in the changed code. ## What I ran Read the prepared description, commit summary, manifest, and diff for head `e039596d8e9ce68b505de99f784981e1ef941586`. Read the complete changed file `core/libs/prx/libcurl/CMakeLists.txt` through `repo_read.py` and searched repository references to `CMAKE_OSX_ARCHITECTURES` and the curl external project. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | Architecture and framework wiring inspected | | Build and tests | not run | Author reports macOS build and curl tests | | Other platform builds | not run | Linux and Windows not built locally | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Builds and tests were not run independently. The author reports a macOS 27.3 Apple M5 Pro x86_64 Release build under Rosetta, successful `libs` and `relinker` builds, and eight `guest_curl*` tests passing. Linux and Windows behavior was not verified. The changed file was read in full; no other files were listed as changed in the manifest. `files.json` was not available in the prepared review folder. ## To get this to a good state Nothing is required.
Jazeupoi commented 2026-11-30 07:50:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-30T07:50:19Z.

Review: COMMENTED


Tested on an Apple M4 (macOS 27.0.1, Apple clang 21.0.0, x86_64 Release under Rosetta 2). Tree: main 6b74d9d67b plus #26739 and #27739, which macOS needs to build, and #27801; none of them touches libcurl.

  • Without this PR: libcurl.prx fails to link with undefined _CFRelease and _SCDynamicStoreCopyProxies (the break also listed in #27647).
  • With it: libs builds completely and the 11 guest_curl* tests pass 3 of 3 rounds.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6108488286 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17425#pullrequestreview-6108488286). Originally posted by [Jazeupoi](https://github.com/Jazeupoi) on 2026-11-30T07:50:19Z. **Review:** COMMENTED --- Tested on an Apple M4 (macOS 27.0.1, Apple clang 21.0.0, x86_64 Release under Rosetta 2). Tree: `main` `6b74d9d67b` plus #26739 and #27739, which macOS needs to build, and #27801; none of them touches libcurl. - Without this PR: `libcurl.prx` fails to link with undefined `_CFRelease` and `_SCDynamicStoreCopyProxies` (the break also listed in #27647). - With it: `libs` builds completely and the 11 `guest_curl*` tests pass 3 of 3 rounds. AI-assisted: yes (Claude Code)
ligmaSec commented 2026-12-03 16:15:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T16:15:24Z.

Review: COMMENTED


The architecture option splits into two CMake list entries for a universal build. I evaluated the added list(APPEND ...) with CMAKE_OSX_ARCHITECTURES=arm64;x86_64 and got -DCMAKE_OSX_ARCHITECTURES:STRING=arm64 followed by a bare x86_64. Please pass the multi-value setting to the child as a single cache argument.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6173697344 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17425#pullrequestreview-6173697344). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T16:15:24Z. **Review:** COMMENTED --- The architecture option splits into two CMake list entries for a universal build. I evaluated the added `list(APPEND ...)` with `CMAKE_OSX_ARCHITECTURES=arm64;x86_64` and got `-DCMAKE_OSX_ARCHITECTURES:STRING=arm64` followed by a bare `x86_64`. Please pass the multi-value setting to the child as a single cache argument. AI-assisted: yes.
MarcZX10 commented 2026-12-03 21:02:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T21:02:27Z.

Review: APPROVED


Reviewed — looks good

The reviewed CMake changes pass the macOS architecture list to the curl external build and add its required system framework link dependencies.

What I ran

Reviewed head 1c24bba754fb4f945067db44bde6b3022a76efa8. Read the prepared description, commits, diff, manifest, and the complete changed file using repo_read.py. No build environment or tests were run.

python3 repo_read.py cat core/libs/prx/libcurl/CMakeLists.txt 1 141

Results

Check Result Note
Changed-file review passed One changed file read in full
Tests and build not run No independent platform run
Negative control not run No non-compiling control available

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The author reports a successful macOS build and curl tests; these were not independently run. Linux and Windows builds were not run. files.json lists one reviewed file and no excluded files; the complete text of that changed file was read.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6178493609 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17425#pullrequestreview-6178493609). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-12-03T21:02:27Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed CMake changes pass the macOS architecture list to the curl external build and add its required system framework link dependencies. ## What I ran Reviewed head `1c24bba754fb4f945067db44bde6b3022a76efa8`. Read the prepared description, commits, diff, manifest, and the complete changed file using `repo_read.py`. No build environment or tests were run. ```text python3 repo_read.py cat core/libs/prx/libcurl/CMakeLists.txt 1 141 ``` ## Results | Check | Result | Note | |---|---|---| | Changed-file review | passed | One changed file read in full | | Tests and build | not run | No independent platform run | | Negative control | not run | No non-compiling control available | ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [macOS architecture forwarding and ExternalProject list separator](https://github.com/boykopovar/AnyPS5/blob/1c24bba754fb4f945067db44bde6b3022a76efa8/core/libs/prx/libcurl/CMakeLists.txt#L55-L68) - [Apple framework link dependencies](https://github.com/boykopovar/AnyPS5/blob/1c24bba754fb4f945067db44bde6b3022a76efa8/core/libs/prx/libcurl/CMakeLists.txt#L80-L85) ## Not verified The author reports a successful macOS build and curl tests; these were not independently run. Linux and Windows builds were not run. `files.json` lists one reviewed file and no excluded files; the complete text of that changed file was read. ## To get this to a good state Nothing is required.
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!17425
No description provided.