简体   繁体   中英

Linker error - CreateMainApp __EXPECTED_EXACTLY_ONE_VR_MAIN_APP_STATEMENT__ with Cardboard SDK

I am developing a Google Cardboard app and build fine in iOS. But adding Soomla to the project causes linker error:

Ld /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore normal armv7
cd /Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS
export IPHONEOS_DEPLOYMENT_TARGET=6.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -L/Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Products/Release-iphoneos -L/Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS -L/Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS/Libraries -L/Applications/Unity/Unity.app/Contents/PlaybackEngines/iOSSupport/Trampoline/Libraries -L/Users/foundway/GitHub/RealiteerCore/Assets/Plugins/iOS -F/Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Products/Release-iphoneos -filelist /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore.LinkFileList -Xlinker -map -Xlinker /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/RealiteerCore-LinkMap-normal-armv7.txt -dead_strip -lc++ -weak_framework CoreMotion -weak-lSystem -ObjC -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework Security -framework CoreText -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework OpenAL -liconv.2 -framework AudioToolbox -framework CFNetwork -framework MediaPlayer -framework CoreLocation -framework SystemConfiguration -weak_framework iAd -framework CoreMedia -framework CoreVideo -weak_framework AVFoundation -framework CoreGraphics -weak_framework CoreMotion -liPhone-lib-il2cpp -liontext -lVuforia -lcardboard -lionimagecompression -lionimage -lremote_assets -lport -levent_internal -lQuantumCore -lbase -lNimbusCore -lrecorder -liongfx -lprotos_lib -lsoftware -lionwebp -lcardboard_protos -lionportgfx -lionstblib -lGoogleKitHUD -lionmath -lionlodepnglib -liongfxutils -lsensors -ltype -lapi -lprotobuf -lionfreetype2 -lionremote -lNimbusAttributedLabel -llogging -lProtocolBuffers -lUnityiOSProfile -lplatform -lSoomlaIOSCore -lvr -lionport -lcomposite -ldatatypes -ldevice -lNimbusModels -levent -lionanalytics -lgflags -lQCARUnityPlayer -lionbase -lionjsoncpp -lionzlib -ldevice_internal -lionmongoose -lGoogleKitCore -lionopenctm -lvrunity -lSoomlaiOSProfile -lUnitySoomlaiOSCore -llogging_protos -lionprofile -lsqlite3.0 -Xlinker -dependency_info -Xlinker /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore_dependency_info.dat -o /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore

Undefined symbols for architecture armv7:
  "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:
      l001 in libplatform.a(vr_ios.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I just added Soomla to my Cardboard app but looks like Soomla and Google Cardboard are fighting for main app (libplatform.a is from Google Cardboard). I think Google Cardboard need to be the main app.

So, I wonder if there are ways that I can make other plugins don't fight for main app?

It can be something else too... Above just my theory.

This is happening because of the Xcode build flag -ObjC, which changes how the .a files are linked. There's some code in the Cardboard .a files which is not needed (or wanted) by the Cardboard SDK itself (CreateMainApp, for example).

You can fix this by removing the -ObjC flag from the link flags in Xcode. Note: this may cause Soomla to not link, but hopefully they only included it "just in case". So try this first, and if it still fails, please comment here.

I am encountering the same exact problem with Soomla and cardboard SDKs, I believe that your theory is correct, Soomla wants to be the main app, but why does it need to be? Is there a work around? Help us Soomla!!!

I have tried stripping down the project one SDK at a time, It is definitely soomla related or maybe FB sdk(since soomla controls that functionality as well)

symbols for architecture arm64: "gvr::CreateMainApp__EXPECTED_EXACTLY_ONE_VR_MAIN_APP_STATEMENT__(std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&)", referenced from:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM