Skip to content

Conversation

SRombautsU
Copy link
Contributor

@SRombautsU SRombautsU commented Sep 19, 2025

Purpose of this PR

Add support for macOS ARM64 architecture (Apple Silicon, e.g. M1)
Don't touch other OSes, since we don't have the bandwidth to update the libraries and then validate the binaries for Windows and Linux.

This is a follow-up of Update to 24.1, openssl 3, windows x64 binaries and building macOS arm64 #29


Testing status

Manual Tests: What did you do?
Note: for now on Windows 11 x64 only

  • Verified that plugins work in the Editor
  • Ran local tests on your machine
  • All Tests pass on all platforms in CI

Yamato: (Select your branch):
https://unity-ci.cds.internal.unity3d.com/project/421/branch/update-p4api-24.1-macos-arm64

@SRombautsU SRombautsU self-assigned this Sep 19, 2025
@SRombautsU SRombautsU marked this pull request as ready for review September 19, 2025 11:24
@u-pr-agent
Copy link

u-pr-agent bot commented Sep 19, 2025

PR Reviewer Guide 🔍

(Review updated until commit 5450320)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

29 - Partially compliant

Compliant requirements:

  • Add build support for macOS arm64 (by updating its p4api version).

Non-compliant requirements:

  • The PR explicitly defers updating p4api for Windows, which contradicts the ticket's goal of providing updated Windows x64 binaries.

Requires further human verification:

  • Verification that the openssl 3 update is included, as it's not visible in the provided code diff.
  • Confirmation that deferring the Windows/Linux update is an acceptable deviation from the original ticket's scope.
  • The PR's main goal is to support macOS ARM64, but testing was only performed on Windows. The changes must be validated on the target platform.
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪

The PR is large due to vendoring an entire set of headers for an older library version, and the modifications to the new version's headers involve complex, platform-specific preprocessor logic requiring careful review.
🏅 Score: 75

The PR implements a sound strategy for a complex dependency upgrade, but the score is reduced due to the lack of testing on the primary target platform (macOS ARM64) and a deviation from the original ticket's scope.
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Target Platform Testing

The primary goal is to add macOS ARM64 support, but the PR notes indicate testing was only performed on Windows. The changes, especially those related to platform-specific headers and endianness, must be validated on an Apple Silicon machine.

# if defined( OS_LINUX ) || defined(OS_MACOSX) || defined(OS_DARWIN)
#  if defined( __BYTE_ORDER) && defined(__LITTLE_ENDIAN)
#   if __BYTE_ORDER == __LITTLE_ENDIAN
#     define P4_LITTLE_ENDIAN 1
#   endif
#   if __BYTE_ORDER == __BIG_ENDIAN
#     define P4_BIG_ENDIAN 1
#   endif
#  else
// If there are no defines to tell us, then guess.
#     define P4_LITTLE_ENDIAN 1
#  endif
# endif

# if defined( OS_NT )

#   define P4_LITTLE_ENDIAN 1

# endif

# if !defined( P4_LITTLE_ENDIAN ) && !defined( P4_BIG_ENDIAN )
// Endian defines not working on builds (php) that
// do not define OS type. Disable this guard until fixed.
//#   error "Unable to determine the endianess of the platform"
# endif
Potentially Unreliable Endianness Detection

The new endianness detection logic includes a commented-out #error directive for when endianness cannot be determined. It's important to confirm that the fallback logic is reliable across all target build environments, especially for the new ARM64 platform.

# if !defined( P4_LITTLE_ENDIAN ) && !defined( P4_BIG_ENDIAN )
// Endian defines not working on builds (php) that
// do not define OS type. Disable this guard until fixed.
//#   error "Unable to determine the endianess of the platform"
# endif

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

@SRombautsU
Copy link
Contributor Author

Note that the Zip failed to capture the MacOS builds

@SRombautsU SRombautsU marked this pull request as draft September 19, 2025 11:36
@SRombautsU SRombautsU force-pushed the update-p4api-24.1-macos-arm64 branch from 756f37f to b9f25ab Compare September 19, 2025 13:22
- build with Visual Studio 2022 and Windows 10 SDK for long path names
- add support for macOS arm64 using P4 API 2024.1 (for macOS only)
@SRombautsU SRombautsU marked this pull request as ready for review September 19, 2025 13:52
@u-pr-agent
Copy link

u-pr-agent bot commented Sep 19, 2025

Persistent review updated to latest commit 5450320

Makefile.osx Outdated
LDFLAGS = -L./P4Plugin/Source/p4api/lib/osx64 -L./P4Plugin/Source/openssl/lib/osx64 -arch x86_64 -lstdc++ -mmacosx-version-min=10.11
else
PLATFORM = OSXarm64
CXXFLAGS = -O2 -arch arm64 -mmacosx-version-min=12.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just want to check on one thing, we may have raised the min spec for the editor in 6.3+ to macOS 13.0. If that is true then we should change the arg to all the -mmacosx-version-min flags to 13.0. I'm checking and I'll get back to you here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But please note that we have always backported the plugin to all active Unity streams until now.
Even if in this case I would gladly discard 2021.3 xLTS and 2022.3 xLTS, it would be really important to backport this down to Unity 6.0 LTS

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh sorry, just saw this comment now. In that case keep the min spec as is, except for the ones I changed to 12.0, I added suggestions to put that back to 11.0.

Copy link
Collaborator

@davidrogers-unity davidrogers-unity left a comment

Choose a reason for hiding this comment

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

Looks good! Just update the min spec to 13.0 and then we're good to go

Note that we use -mmacosx-version-min=10.11 for x86_64Update Makefile.osx

Co-authored-by: David Rogers <[email protected]>
@SRombautsU
Copy link
Contributor Author

I found this warning in the logs of the MacOS build https://unity-ci.cds.internal.unity3d.com/job/56476098/logs

[16:55:33.811 Information] ld: warning: object file (./P4Plugin/Source/openssl/lib/osx64/libssl.a(libssl-lib-bio_ssl.o)) was built for newer macOS version (15.0) than being linked (10.11)

For reference, Unity 6.0 supports macOS Big Sur 11 or newer (https://docs.unity3d.com/6000.0/Documentation/Manual/system-requirements.html)

@davidrogers-unity
Copy link
Collaborator

I found this warning in the logs of the MacOS build https://unity-ci.cds.internal.unity3d.com/job/56476098/logs

[16:55:33.811 Information] ld: warning: object file (./P4Plugin/Source/openssl/lib/osx64/libssl.a(libssl-lib-bio_ssl.o)) was built for newer macOS version (15.0) than being linked (10.11)

For reference, Unity 6.0 supports macOS Big Sur 11 or newer (https://docs.unity3d.com/6000.0/Documentation/Manual/system-requirements.html)

This is a common warning that should not have any negative effects. We even have those in the main editor build.
https://unity-ci.cds.internal.unity3d.com/job/56571434/logs/execution?line=12494&q=was%20built%20for%20newer%20macOS%20version

However it is probably possible to configure home-brew to build the libs to target the older version. But that is very likely more work than it's worth.

@SRombautsU SRombautsU force-pushed the update-p4api-24.1-macos-arm64 branch from 0487b17 to 4d2d5ab Compare September 29, 2025 14:25
@SRombautsU SRombautsU force-pushed the update-p4api-24.1-macos-arm64 branch from 46c94ab to 42de831 Compare September 30, 2025 16:27
@SRombautsU SRombautsU force-pushed the update-p4api-24.1-macos-arm64 branch from 42de831 to c786e22 Compare October 1, 2025 06:37
@SRombautsU SRombautsU merged commit d3ff841 into master Oct 1, 2025
8 checks passed
@SRombautsU SRombautsU deleted the update-p4api-24.1-macos-arm64 branch October 1, 2025 12:31
@SRombautsU
Copy link
Contributor Author

For the record, this is now part of the latest release https://github.com/Unity-Technologies/NativeVersionControlPlugins/releases/tag/1.4.0 that is going to be merged to unity trunk and published later down the line in Unity 6.4 (and be port back down to other branches)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants