build(macos): configure the full build for x86-64 under Rosetta #4626

Merged
mugurc merged 1 commit from upstream-pr/4626 into main 2026-10-14 07:16:54 +00:00
mugurc commented 2026-10-12 17:03:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-12T17:03:03Z.


What

Configures the full build on macOS for x86-64. The libraries are x86-64 code that Rosetta 2 runs on Apple silicon, so the full build selects the architecture itself instead of asking the user for flags:

  • CMAKE_OSX_ARCHITECTURES and CMAKE_APPLE_SILICON_PROCESSOR default to x86_64 (cache entries, an explicit value wins). Configuring the full build for another architecture fails with an error.
  • libjpeg-turbo, which is configured by its own CMake run, gets the same two values.
  • -fexperimental-library: Apple clang's libc++ needs it for C++20 library features the sources use.
  • The prx libraries find each other through their run path. dyld does not expand $ORIGIN, so on macOS it is @loader_path; the other platforms keep $ORIGIN.

The relinker-only build is unchanged. This is the first pull request of the macOS series announced on #1 (https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6124344298); the build does not complete until the following ones are in.

Tested

  • macOS 26.5.1, Apple M5 Max, Apple clang 21, CMake 4.4, Ninja: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON with no architecture flag configures for x86_64 (CMAKE_OSX_ARCHITECTURES=x86_64 in the cache, -fexperimental-library in the generated build.ninja, -DCMAKE_OSX_ARCHITECTURES=x86_64 in the libjpeg-turbo configure command, @loader_path in the link flags of the prx libraries). -DCMAKE_OSX_ARCHITECTURES=arm64 fails with the new error. -DANYPS5_RELINKER_ONLY=ON leaves the cache entries empty and adds no flag.
  • The relinker jobs of this pull request (the relinker-only build and its tests on macOS, Ubuntu and Windows) pass in the same run
  • Linux and Windows: the full build and tests of this pull request merged with the other macOS pull requests of the series (seventeen of them, on main 33ae282e4), run on my fork: 960 tests on Linux and 966 on Windows pass (https://github.com/mugurc/AnyPS5/actions/runs/38256280627). Every addition is inside APPLE / CMAKE_HOST_APPLE; the Linux and Windows value of the run path is still $ORIGIN.

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 in TechnicalDebt
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4832573778 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4626). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-12T17:03:03Z. --- ### What Configures the full build on macOS for x86-64. The libraries are x86-64 code that Rosetta 2 runs on Apple silicon, so the full build selects the architecture itself instead of asking the user for flags: - `CMAKE_OSX_ARCHITECTURES` and `CMAKE_APPLE_SILICON_PROCESSOR` default to `x86_64` (cache entries, an explicit value wins). Configuring the full build for another architecture fails with an error. - libjpeg-turbo, which is configured by its own CMake run, gets the same two values. - `-fexperimental-library`: Apple clang's libc++ needs it for C++20 library features the sources use. - The prx libraries find each other through their run path. dyld does not expand `$ORIGIN`, so on macOS it is `@loader_path`; the other platforms keep `$ORIGIN`. The relinker-only build is unchanged. This is the first pull request of the macOS series announced on #1 (https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6124344298); the build does not complete until the following ones are in. ### Tested - macOS 26.5.1, Apple M5 Max, Apple clang 21, CMake 4.4, Ninja: `cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON` with no architecture flag configures for x86_64 (`CMAKE_OSX_ARCHITECTURES=x86_64` in the cache, `-fexperimental-library` in the generated `build.ninja`, `-DCMAKE_OSX_ARCHITECTURES=x86_64` in the libjpeg-turbo configure command, `@loader_path` in the link flags of the prx libraries). `-DCMAKE_OSX_ARCHITECTURES=arm64` fails with the new error. `-DANYPS5_RELINKER_ONLY=ON` leaves the cache entries empty and adds no flag. - The relinker jobs of this pull request (the relinker-only build and its tests on macOS, Ubuntu and Windows) pass in the same run - Linux and Windows: the full build and tests of this pull request merged with the other macOS pull requests of the series (seventeen of them, on `main` 33ae282e4), run on my fork: 960 tests on Linux and 966 on Windows pass (https://github.com/mugurc/AnyPS5/actions/runs/38256280627). Every addition is inside `APPLE` / `CMAKE_HOST_APPLE`; the Linux and Windows value of the run path is still `$ORIGIN`. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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 (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] AI-assisted: yes
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!4626
No description provided.