Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[UNSOLVED] XCode Error with Google Cardboard

Discussion in 'iOS and tvOS' started by VortexGamer, Nov 18, 2015.

  1. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    Code (CSharp):
    1. Undefined symbols for architecture armv7:
    2.   "gvr::CreateMainApp__EXPECTED_EXACTLY_ONE_VR_MAIN_APP_STATEMENT__(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)", referenced from:
    3.       l001 in libvrunity.a(vr_ios.o)
    4. ld: symbol(s) not found for architecture armv7
    5. clang: error: linker command failed with exit code 1 (use -v to see invocation)
    I just have no idea what to do because this is XCode

    Any help is appreciated
     
    Last edited: Nov 18, 2015
  2. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    Forgot to add that I'm using Xcode 7.2 and unity 5.2.1
     
  3. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
  4. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    Do you have the -ObjC flag turned on in the Xcode project? If so, try removing it.
     
  5. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    I have tried, Same Error
     
  6. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
  7. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    Bump?????
     
  8. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    Ok, so the problem is that something is pulling in vr_ios.o during the Xcode project's link phase. That's where this undefined symbol (CreateMainApp__EXPECTED_EXACTLY_ONE_VR_MAIN_APP_STATEMENT__) lives -- it's not used in Cardboard but is in other programs that use this library. The most common reason vr_ios gets pulled in is if somehow the -ObjC flag is added to the linker flags, because there is some ObjectiveC "category" in this file. Some other Unity plugins turn this flag on, so if you are using any other plugins, can you mention them? If none of those are the case, then I'm really not sure what is causing this link dependency. It's already on the internal Google bug list so that a "true" fix can be found.
     
  9. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    Not using any plugins except for cardboard itself... I disabled the -ObjC flag, enabled it. Bitcode and what not also... I hope someone here can find a fix or they update google cardboard itself soon D:
     
  10. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
  11. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    @dolims
    Anyone else?
    Unity Staff?
    Bump.
     
  12. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    Yeah, stumped so far. Any way you can share a cut-down project that exhibits the issue?
     
  13. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    It's a flight sim game. There are no plugins only c# scripts
     
  14. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
  15. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    Bump......
    Can any unity support help me?
     
  16. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    Doubt they can help. This symbol is specific to the Cardboard SDK implementation internals. Just for sanity, do you get this error when building the SDK's demo project?
     
  17. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    'Scuse me, Anyone find a fix yet?
     
  18. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
  19. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    Bump, bump, bump!!!!!!!!!!!
     
  20. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    You should make sure you are using latest Cardboard SDK. If problem still remains, then please contact Google dev support for issues caused by their library.
     
  21. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    Yes, the official page for issues with the Cardboard plugin is https://github.com/googlesamples/cardboard-unity

    Although, I'm the primary person who manages that page anyway...

    All I can say is 1) the underlying issue is being tracked as a bug for an upcoming release, and 2) I have no idea how you are triggering it with your current project. Do you have a small (cut down) version of the project which has this build error that you would be willing to share?
     
  22. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    @dolims
    I'll zip the entire project folder to you
     
  23. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
  24. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    Got it. OK, I found that there's another flag in Xcode that does similar things as -ObjC: -all_load
    That one is also in the linker flags of your Xcode project. Removing both -ObjC and -all_load, I was able to build and run your app.
    Now, for some reason, each time I build from Unity, those flags are reappearing in the Xcode project. Maybe it's an Xcode 7+ thing. Anyway, once this "undefined symbol" bug in the actual Cardboard library is fixed, you won't have to worry about these flags anymore. So for now, just remove them.

    As you'll see though, once you get past this error you will run into another one. For some reason the eyes are black, but the surrounding vignette shows the view. I've seen this error before and I was able to fix it in your project. Just do this: Delete the Cardboard object and replace the Main Camera with a CardboardMain prefab. That seems to fix the issue in this project.
     
    theolagendijk likes this.
  25. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49
    @dolims
    Thank you so so much, I got it to work!
    If I have any issues later I'll PM you.
     
  26. Coks

    Coks

    Joined:
    Jul 23, 2012
    Posts:
    28
    I get the same error. But I want to use other the plugin which required -ObjC flag. Anybody know how linking Cardboard with -ObjC flag?
     
  27. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    At the moment, there is no easy workaround. It will be fixed in an upcoming release.
     
  28. Coks

    Coks

    Joined:
    Jul 23, 2012
    Posts:
    28
    dolims, thx for advice. But know you how soon will release with fixed this issue?
     
  29. Coks

    Coks

    Joined:
    Jul 23, 2012
    Posts:
    28
    Here is a solution until they fix it in new release.
    Including this code in a C++ file:
    Code (CSharp):
    1. #include <vector>
    2. namespace gvr {
    3. class VrApp;
    4. VrApp* CreateMainApp__EXPECTED_EXACTLY_ONE_VR_MAIN_APP_STATEMENT__(const std::vector<std::string>&) { return nullptr; }
    5. }
    Issue on github: https://github.com/googlesamples/cardboard-unity/issues/130
     
  30. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    This is fixed in v0.6 of the Cardboard SDK.
     
  31. VortexGamer

    VortexGamer

    Joined:
    Apr 27, 2015
    Posts:
    49