Fix iOS build on Unity 6.5#360
Conversation
…s link fix is skipped
…ork export Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
xianshijing-lk
left a comment
There was a problem hiding this comment.
lgtm in general, one question
| Debug.LogWarning( | ||
| $"{Prefix}: iOS link-order diagnostic found a risky order in UnityFramework -> Frameworks and Libraries. " + | ||
| "libiPhone-lib.a appears before liblivekit_ffi.a. This repo documents that this can crash Opus/CELT on iOS. " + | ||
| $"{engineName} appears before liblivekit_ffi.a. This repo documents that this can crash Opus/CELT on iOS. " + |
There was a problem hiding this comment.
Don't we have script to auto fix the problem and make sure we load liblivekit_ffi.a before libiPhone-lib.a ?
There was a problem hiding this comment.
Yes, the script works until Unity 6.4, but in 6.5 Unity apparently changed their lib composition and naming.
A customer reported the crash: #359
They also already confirmed the fix works for them as well. I will now test if it still works in Unity 2022 or Unity 6.3, but that behaviour should still be intact.
There was a problem hiding this comment.
Confirmed the old way of building is not touched in lower Unity versions.
xianshijing-lk
left a comment
There was a problem hiding this comment.
lgtm, I just missed the BuildPostProcessor.cs. Please ignore my previous comment
Background
This fixes #359
Unity 6000.5 re-architected the iOS export: the engine library is no longer
Libraries/libiPhone-lib.abut a staticFrameworks/UnityRuntime.framework(which still bundles the old CELT/libvpx objects that conflict with the opus/vpx
inside
liblivekit_ffi.a). Our iOS post-build protection was hardwired tolibiPhone-lib.a, so on 6000.5 it silently no-oped and apps crashed at runtimein
ec_tell_frac(confirmed on device with the Meet sample).On top of that, the Meet and Agents samples' own
BuildPostProcessorpassed thenow-null file GUID for
libiPhone-lib.aintoRemoveFileFromBuild, failing everyiOS build on 6000.5 with an
ArgumentNullException.The exported frameworks build phase is also no longer labeled
/* UnityFramework */;build logs show that marker didn't even match on 6000.3, so the link-order rewrite
was already a no-op there and only the CELT strip was protecting older builds.
Changes
IosLinkOrderDiagnosticsnow resolves the engine library per export layout:Libraries/libiPhone-lib.a(up to 6000.4) orFrameworks/UnityRuntime.framework(6000.5+). Reorder, CELT strip, and the diagnostic all operate on the resolved
library; behavior on the old layout is unchanged.
liblivekit_ffi.a) instead of the/* UnityFramework */label, which alsorepairs the reorder/diagnostic on pre-6.5 exports.
libiPhone-lib.aremove/re-add so iOS buildsno longer fail on 6000.5.
Verified on Unity 6000.5.5f1 (device): export logs show the link-order fix applied,
18 conflicting CELT objects stripped from
UnityRuntime, diagnostic OK, and theMeet app no longer crashes.