googlevr / gvr-ios-sdk

Google VR SDK for iOS
http://developers.google.com/vr/ios/
Other
645 stars 191 forks source link

Unity 5.6 builds fail on Xcode - linker command failed with exit code 1 #236

Closed jrobalino closed 6 years ago

jrobalino commented 7 years ago

Overview

I cannot build Cardboard projects in Unity 5.6.0f3 and then deploy them to my iPhone.

The Unity build completes successfully, but Xcode either deploys a non-Vr, non-interactive application to the phone, or fails to complete the build at all (scenarios detailed below). Method 1 used to work in Unity 5.5. I'm not sure if this is a Unity issue or a GoogleVR issue given the warning about Unity 5.6 beta in the GoogleVR docs, but Unity 5.6.0f3 is no longer a beta release so I thought I'd bring up the issue.

Method 1: Xcode Deploys Non-VR, Non-Interactive Application to Phone

The project builds in Xcode and can be run on the phone. However, the app does not run in VR mode and headset movement is not tracked. This method used to result in successful deployments.

Method 2: Xcode Fails to Build Project

  1. Complete these steps, same as in the last section, but with the noted modifications: https://developers.google.com/vr/unity/get-started-ios
  2. Before creating the Unity build, open the Player Settings and enable Virtual Reality Supported and add the Cardboard SDK.
  3. Open a terminal in the resulting Xcode folder after the Unity build completes and run pod install.
  4. Open the workspace version of the Xcode project and build and run it.

The project fails to build and returns a clang linker command error with duplicate symbols. This issue is the probably the same as Issue 234.

image

Method 3: What DOES Work

If I bypass Unity and build the iOS Get Started project as described in the following tutorial, I get a working application: https://developers.google.com/vr/ios/get-started

jrobalino commented 7 years ago

A friend found a temporary workaround, but note that it bypasses the pods:

  1. Copy the GVROverlayView.h file from Pods/Headers/Public/GVRSDK folder to the top-level Classes folder.

  2. Open the main .xcodeproj file.

  3. Delete the libPods-Unity-iPhone.a file from the left pane.

  4. Under Build Settings, double-click the first line in Other Linker Flags.

  5. Delete the $(inherited) line.

    screen shot 2017-04-07 at 8 44 47 pm
  6. Build the project.

    1. Profit.
nguy1948 commented 7 years ago

Im having the same issues. I tried the temporary fix but it does not work. Still getting the error. Do you know of any other solutions?

veerb4h commented 7 years ago

I am having same issue and not able to build my Unity code for ios build

VRoxygen commented 7 years ago

I have the same issue with linker command failing. Tried to do the Method 3, but I don't have these (may be because of the new SDK version?): GVROverlayView.h file from Pods/Headers/Public/GVRSDK As well as when I delete $(inherited), I get not just this 1 error, but 50+! Did anyone figure out how to fix it? Seems like I've tried everything, but still getting an error... Please share if you know how to fix it. Thank you!

RGGuinness commented 7 years ago

I had the same issue. I updated the Podfile in the app folder which was generated in my project. The default has a mismatch on the required version for GVR. I think the search paths allowed find the correct version. The file looks like this now:

platform :ios, '9.0' target 'Unity-iPhone' do _inherit! :searchpaths pod 'GVRSDK','~> 1.20' end

after changing that and running pod update, the files were installed. If you run the Podfile as generated, you will probably see that 1.20 is below the min version. The update brought it to 1.70.0 which is the minimum. I also did upgrade CocoaPods to the preview as well.

VRoxygen commented 7 years ago

Thank you very much for your answer! Yes, tried pods, but actually, in my case turned out I had some problems with "trusted developer" which I solved (similar to enabling Android developer). That made it all work.

smarcosanderson commented 7 years ago

Hey guys, I had this problems before as well, Try to open the xcworkspace, instead the xcodeproj. It worked fine.

Following the link: https://forum.unity.com/threads/unity-5-6-0f3-google-cardboard-ios-xcode-linker-errors.464719/#post-3036269

Juanfry88 commented 6 years ago

I think that unity is not here, this thread is only to native iOS, there are other thread: android, unity...

fredsa commented 6 years ago

@jrobalino

Method 1: Xcode Deploys Non-VR, Non-Interactive Application to Phone

Enabling Virtual Reality Supported in player settings is definitely required.

Method 2: Xcode Fails to Build Project

Your Xcode build failures look like you're opening the *.xcodeproj project instead of the *.xcworkspace workspace. See also issue #229 and gvr-unity-sdk issue 539.

Method 3: What DOES Work

Good to hear.

fredsa commented 6 years ago

To confirm: I just tried building the GVRDemo scene for iOS, from the Google VR SDK for Unity version 1.100.1, using Unity 5.6.0f3. I set the bundle identifier to a custom value, set the target minimum iOS version to 8.0, enabled Virtual Reality supported, added 'Cardboard' VR SDK, and was able to open the built Xcode *.xcworkspace, and run it on an iPhone 6s with iOS 11.0.2.

fredsa commented 6 years ago

I'll make sure we update the Get Started with Unity for iOS (https://developers.google.com/vr/unity/get-started-ios) documentation to clarify the need to enable VR support, add Cardboard SDK, as well as emphasize the need to open the *.xcworkspace.

fredsa commented 6 years ago

If you run into any other issues with the Google VR SDK Unity, please use the gvr-unity-sdk issue tracker: https://github.com/googlevr/gvr-unity-sdk/issues