firebase / firebase/firebase-unity-sdk

[FR]: iOS: the simulator slice of the Unity C++ libraries is x86_64-only — please add arm64-simulator

Open
#1,519 4 comments 3 reactions 0 assignees View on GitHub
api: core type: feature request
Dominant language
C#
Stars
320
Forks
60
Avg merge
11h 15m
Merged PRs (30d)
11

Description

### Description

Hello dear Firebase team,

the iOS C++ libraries shipped with the Unity SDK (libFirebaseCppApp.a, libFirebaseCppAnalytics.a, libFirebaseCppCrashlytics.a, libFirebaseCppMessaging.a) do contain a simulator slice — but only for x86_64. There is no arm64-simulator code, so a Unity project using Firebase cannot be built for the iOS Simulator on Apple Silicon.

Verified against Firebase Unity SDK 13.16.0 (latest at time of writing):

```
$ lipo -info libFirebaseCppApp.a
Architectures in the fat file: ... are: x86_64 arm64
```

```
$ otool -arch arm64 -l libFirebaseCppApp.a | grep -A4 LC_BUILD_VERSION
33 platform 2 minos 12.0 sdk 26.2 # PLATFORM_IOS — device
```

```
$ otool -arch x86_64 -l libFirebaseCppApp.a | grep -A4 LC_BUILD_VERSION
33 platform 7 minos 12.0 sdk 26.2 # PLATFORM_IOSSIMULATOR
```

So the build intentionally produces a device slice and a simulator slice; the simulator one is just still x86_64, which was sufficient before Apple Silicon.

Result when building for an arm64 simulator (Xcode 27.0, target arm64-apple-ios17.0-simulator):

```
ld: building for 'iOS-simulator', but linking in object file
(libFirebaseCppApp.a[arm64][2](log.cc.o)) built for 'iOS'
```

Note this cannot be fixed within the current packaging: a fat archive is keyed by CPU type, so it cannot hold both an arm64-device and an arm64-simulator slice. Shipping arm64-simulator requires an XCFramework (or parallel device/simulator library sets).

The C++ SDK already builds exactly what is needed — [firebase-cpp-sdk/build_scripts/ios/build.sh](https://github.com/firebase/firebase-cpp-sdk/blob/main/build_scripts/ios/build.sh):

```
readonly SUPPORTED_PLATFORMS=(device simulator)
readonly SIMULATOR_ARCHITECTURES=(arm64 x86_64)
...
sysroot_arg="-DCMAKE_OSX_SYSROOT=iphonesimulator"
```

and packages the output as XCFrameworks. The Unity wrapper libraries do not go through that path; [cmake/unity_ios.cmake](https://github.com/firebase/firebase-unity-sdk/blob/main/cmake/unity_ios.cmake) (v13.16.0) defaults CMAKE_OSX_SYSROOT to "iphoneos" with CMAKE_OSX_ARCHITECTURES "arm64;x86_64", and cmake/ios_pack.cmake merges the result into a single fat .a with `libtool -static`.

Precedent: [firebase-ios-sdk#6520](https://github.com/firebase/firebase-ios-sdk/issues/6520) ("ARM64 Simulator support") was the same gap one layer down and was fixed for the Apple SDK. Every Firebase pod in my project today ships ios-arm64_x86_64-simulator — it is only the Unity C++ layer that is still x86_64-only for the simulator.

Why this matters more than it used to: the workaround usually cited for this error (EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64, then build x86_64 under Rosetta) needs an x86_64 simulator runtime. Current runtimes no longer ship one — on my machine iOS 26.4 and 27.0 are arm64-only, and only iOS 18.3 still carries x86_64. With Xcode 26/27 there is no supported way to run a Unity + Firebase build in the Simulator at all.

**Proposal on how to fix it:**
**Option A (preferred):** add arm64 to the simulator build pass (-DCMAKE_OSX_SYSROOT=iphonesimulator, CMAKE_OSX_ARCHITECTURES "arm64;x86_64") and ship the libraries as an .xcframework containing ios-arm64 and ios-arm64_x86_64-simulator. Unity supports .xcframework iOS plugins and copies them into the generated Xcode project — I have another vendor's Unity package in the same project shipping Plugins/iOS/.xcframework, and it links for both device and simulator with no manual project edits. firebase-cpp-sdk's build.sh already produces this shape.

**Option B:** keep .a files, but ship parallel device/simulator sets (for example Plugins/iOS/Firebase/iphoneos/ and Plugins/iOS/Firebase/iphonesimulator/) and select the right set in the existing editor build code. This is what other Unity middleware does today.

Thank you so much for your time! :)
Tim

Environment:
- Firebase Unity SDK 13.16.0
- Unity 6000.3.13f1 (Unity has supported arm64 simulator since Unity 6)
- Xcode 27.0 (27A5252f), macOS 26, Apple Silicon
- Simulator runtimes installed: iOS 18.3 (x86_64 + arm64), iOS 26.4 (arm64), iOS 27.0 (arm64)

### API Proposal

No API change — this is a build/packaging change, confined to the iOS build step.

### Firebase Product(s)

Analytics, Crashlytics, Messaging

### Targeted Platform(s)

Apple Platforms

Contributor guide

Open the contributing guide

Research direction

Start with cmake/unity_ios.cmake and cmake/ios_pack.cmake to trace the Unity iOS build and packaging steps, then compare them with firebase-cpp-sdk/build_scripts/ios/build.sh. Verify the resulting Unity plugin packaging includes an arm64 simulator slice alongside the device slice and builds successfully for an Apple Silicon iOS Simulator.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, ios, unity
Domain
build-system, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.