Skip to content

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

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
Gonic0:fix/libcurl-macos-build
Dec 4, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
Gonic0:fix/libcurl-macos-build

Conversation

@Gonic0

@Gonic0 Gonic0 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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.

@gabichuuuuu

Copy link
Copy Markdown
Contributor

Read faf53f065e against main f57c971559. Correctness. On Apple the curl backend sub-build now receives CMAKE_OSX_ARCHITECTURES and links CoreFoundation and SystemConfiguration, which curl needs on macOS; the Windows and Linux branches are unchanged. I cannot build the macOS target here. Not run here; this is from reading the code. AI-assisted: yes.

@011010

011010 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Independent confirmation on a second machine, and the backend comes out x86_64 now.

Apple M4 (Mac mini), macOS 27.0.1 (26A434), Apple clang 21.0.0, x86-64 Release under Rosetta 2, main e136ade21d.

  • On main, the failure is the one you describe: ld: warning: ignoring file '.../backend/lib/libcurl.a(wolfssh.c.o)': found architecture 'arm64', required architecture 'x86_64', repeated for every object, and unpatched/libcurl.prx does not link.
  • With this PR, lipo -info on backend/lib/libcurl.a reports architecture: x86_64, unpatched/libcurl.prx links (1,279,056 bytes), and the NID patch step runs: OK: .../core/libs/libs/libcurl.prx, same size.

To reach the patch step I needed #18905 too, because libc does not build on macOS without it, so that part is measured on main plus both PRs. The architecture and link half is measured with this PR alone.

The frameworks you add are exercised by that link, not by a run: no title or proxy path was tested.

Pass CMAKE_OSX_ARCHITECTURES to the curl ExternalProject, as the
libjpeg-turbo build already does, and link CoreFoundation and
SystemConfiguration, which curl's proxy lookup on macOS needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 2, 2026

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

A universal CMAKE_OSX_ARCHITECTURES such as arm64;x86_64 split into two
ExternalProject arguments, so the curl backend saw only arm64. Join the
list with | and set LIST_SEPARATOR so the child gets the whole list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gonic0

Gonic0 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Agreed, done in 1c24bba754. The architectures are joined with | and ExternalProject_Add gets LIST_SEPARATOR |, so the child receives the whole list. In a minimal ExternalProject project, arm64;x86_64 reached the child as arm64 before this change and as arm64;x86_64 (two entries) after it; x86_64 alone is unchanged.

Merged into main, the full macOS build (default x86_64) builds the curl backend and libcurl.prx.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Apple libcurl build and linking

Layer / File(s) Summary
Apple build configuration and linking
core/libs/prx/libcurl/CMakeLists.txt
The ExternalProject receives Apple architecture settings and uses `

Possibly related issues

  • boykopovar/AnyPS5\#24117: Reports that main does not link libcurl.prx on macOS. This change adds Apple framework links to the curl backend.
  • boykopovar/AnyPS5\#27647: Reports undefined _CFRelease and _SCDynamicStoreCopyProxies symbols in an Intel macOS build. This change adds the frameworks that provide those symbols.

Suggested reviewers: alvaroelpob

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 1c24b

This fixes macOS link failures for the curl backend by building it for the target architecture and linking the frameworks it needs. Other platforms are unaffected, and no merge-blocking risk was identified.

Architecture risk: Low · up to 1c24b

The Apple libcurl integration now passes target architectures into the external build and links the platform frameworks required by its imported backend.

On Apple builds, the libcurl integration passes the selected CMAKE_OSX_ARCHITECTURES to the ExternalProject so its backend can target those architectures, and the imported backend links CoreFoundation and SystemConfiguration.

Changed areas: core

Review details

Systems and components

  • observed — 1 changed file mapped to core.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4cf27a24-4a0f-4b16-95de-09bf75593e14
Commits

Reviewing files that changed from the base of the PR and between 3ffcba6 and 1c24bba.

Files selected for processing: 1

  • core/libs/prx/libcurl/CMakeLists.txt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 27841 core/libs/prx/libcurl/CMakeLists.txt

@oneandonlydean
oneandonlydean merged commit 9a2e222 into boykopovar:main Dec 4, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.