I'm working on an Unity project where I'm using the Google VR SDK for Unity and the FirebaseMessaging.unitypackage
from the Firebase SDK for Unity.
This combination of Google SDK's throws a duplicate symbols
error when I try to build for iOS.
Requirements:
Steps:
GoogleVRForUnity.unitypackage
and import all except the Demos folder.FirebaseMessaging.unitypackage
and import all of it.The project build on Xcode will end with the following error:
25 duplicate symbols for architecture arm64
The architecture changes depending of the connected iOS device, but the error is the same.
This is a bug in the GVR sdk. The problem is that GVR was released including the transitive dependencies, some of which other SDKs at google (or elsewhere) depend on as well, such as firebase. Since Unity doesn't have any package management for this, we've rolled our own:
https://github.com/googlesamples/unity-jar-resolver
However GVR sdk isn't yet using this to include its transitive dependencies and so we get the conflicts.
I'm working on a fix that makes the IOSResolver above, detect this in GVR and strip the objects that should not be included.
In the meantime, here's a work-around you can use to strip the redundant objects yourself:
Create a shell script in the folder with the following contents:
set -ex
lipo libgvrunity.a -thin armv7 -output libgvrunity-armv7.a
lipo libgvrunity.a -thin arm64 -output libgvrunity-arm64.a
ar -t libgvrunity-armv7.a | grep 'GTMLogger\|GTMSession' | xargs ar -dv libgvrunity-armv7.a
ar -t libgvrunity-arm64.a | grep 'GTMLogger\|GTMSession' | xargs ar -dv libgvrunity-arm64.a
lipo libgvrunity.a -replace armv7 libgvrunity-armv7.a -replace arm64 libgvrunity-arm64.a -output libgvrunity-fat.a
rm libgvrunity-armv7.a libgvrunity-arm64.a
mkdir -p backup
mv libgvrunity.a backup
mv libgvrunity-fat.a libgvrunity.a
Build and run from Unity again.