Skip to content

iOS Unity 6 crash in ec_tell_frac: IosLinkOrderDiagnostics does not handle libGameAssembly.a #359

Description

@DongYeongJeong

Summary

Our Unity iOS application crashes only on iOS when LiveKit audio is initialized or when a remote audio track is subscribed.

Android builds using the same LiveKit integration work normally.

The crash consistently stops in UnityFramework at the Opus/CELT symbol ec_tell_frac, suggesting a native codec object/symbol conflict.

Environment

  • LiveKit Unity SDK: 2.0.0
  • Unity: 6000.5.5f1
  • Scripting backend: IL2CPP
  • Architecture: arm64
  • Target: physical iOS device
  • iOS deployment target: 15.0
  • Installation: UPM Git URL (https://github.com/livekit/client-sdk-unity.git)

Symptoms

We observed crashes at multiple audio lifecycle points:

  1. Immediately after local microphone initialization:
LiveKit: Configured native audio source with sampleRate 48000 and channels 2
LiveKit.RtcAudioSource:ResolveDeviceFormat()
LiveKit.RtcAudioSource:.ctor(...)
LiveKit.MicrophoneSource:.ctor(...)

2. After remote audio subscription:
[LiveKitVoiceChatMgr] Remote audio subscribed (AudioStream playout): <participant>

3. The debugger then stops in:
UnityFramework`ec_tell_frac
In some attempts, the process instead crashes around:

libsystem_pthread.dylib`___chkstk_darwin
Android works with the same server, token flow, room configuration, and application code.

Relevant SDK behavior
LiveKit SDK 2.0.0 includes Editor/IosLinkOrderDiagnostics.cs.

This file documents that linking Unity's audio archive before liblivekit_ffi.a can crash Opus/CELT on iOS. It also strips conflicting CELT object files from:

Libraries/libiPhone-lib.a
However, Unity 6 exports libGameAssembly.a rather than libiPhone-lib.a.

Therefore, the current post-process logic does not appear to process the Unity 6 archive. In our build logs, we do not see the expected CELT stripping log, and the crash still occurs in ec_tell_frac.

Expected behavior
The SDK’s iOS post-process diagnostics/fix should also support Unity 6 exports using libGameAssembly.a, including:

Safe link ordering of liblivekit_ffi.a before the Unity-generated archive.
Detection and removal of conflicting CELT/Opus object files from the applicable Unity-generated archive.
Clear build-log output stating which archive was detected and modified.

Actual behavior
The current fix targets libiPhone-lib.a, which is absent or unused in Unity 6 exports. The resulting iOS application crashes in the CELT/Opus path while Android remains unaffected.

Question
Could the iOS link-order/CELT conflict mitigation be updated to support libGameAssembly.a for Unity 6 / IL2CPP exports? If there is a preferred integration path or a known fix for this configuration, please advise.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions