CardboardSDK conflict (duplicate symbol) in google protobuf library - ios

I've successfully integrated and configured my CardboardSDK project in a test project, now I want to integrate it in my main project which already uses GTL library for YouTube uploading and in this new project I'm getting 641 duplicate symbols for classes with strange names.
What I've tried:
I've addressed some conflicts with GoogleAdMob and GoogleConversion SDKs.
I've addressed conflicts for all the cases where I could find a relevant class name somewhere else in the project, like AFNetworking, OAuth etc.
But still there are 641 duplicate symbols.
duplicate symbol __ZN6google8protobuf8internal20InitLogSilencerCountEv in:
/Users/sabirali/Documents/4.2.1/libCardboardSDK.a(common.o)
duplicate symbol __ZN6google8protobuf8internal22DeleteLogSilencerCountEv in:
/Users/sabirali/Documents/4.2.1/libCardboardSDK.a(common.o)
...
...
duplicate symbol __ZN6google8protobuf2io18StringOutputStreamC1EPNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE in:
/Users/sabirali/Documents/4.2.1/libCardboardSDK.a(zero_copy_stream_impl_lite.o)
duplicate symbol __ZN6google8protobuf2io22LazyStringOutputStreamC2EPNS0_14ResultCallbackIPNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEE in:
/Users/sabirali/Documents/4.2.1/libCardboardSDK.a(zero_copy_stream_impl_lite.o)
duplicate symbol __ZN6google8protobuf2io22LazyStringOutputStreamC1EPNS0_14ResultCallbackIPNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEE in:
/Users/sabirali/Documents/4.2.1/libCardboardSDK.a(zero_copy_stream_impl_lite.o)
ld: 641 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Problem:
I'm unable to fully understand where these duplicate symbols are coming from, my calculated guess is its fro m GTL SDK by google but I do need that for YouTube uploading and can't remove it. e.g. Is this class name __ZN6google8protobuf8internal20InitLogSilencerCountEv randomly generated ?
How can I find out exactly which SDK / Framework in my project is indirectly using the same google library which Cardboard SDK is using ?
I would even like to explicitly silence the duplicate symbols, using some compiler flags, if possible ?
UPDATE:
I found out that the issue is not with the YouTube API, as Ive removed that API and all other google SDKs from my project and am still getting the conflict.
I've checked the object files inside the SDK and its not them, its protobuf library internally being used by some of the classed inside Cardboard SDK.
How can I find out which library is having protobuf as a dependancy ?

Related

Duplicate symbol _OBJC_CLASS_$_Base64

I am trying to add mobile.connect.framework to the existing project. Before adding the framework, The application is building and running properly. But, as soon as I am adding the framework, it is giving the Duplicate symbol OBJC_CLASS$_Base64 error. I went through numerous posts like Duplicate Symbol OBJC_CLASS$_LoginController
and How duplicate symbol problem arises. But was unable to find the solution.
Please help me how to resolve this one. It has already consumed my half a day.
Error :-
ld: warning: directory not found for option '-L/Users/shailendra.suriyal/Documents/MyProjects/..../UberNewUser/ExternalLib/CardIO' duplicate symbol _OBJC_CLASS_$_Base64 in: /Users/shailendra.suriyal/Library/Developer/Xcode/DerivedData/./Build/Intermediates/Muri.build/Debug-iphonesimulator/Muri.build/Objects-normal/x86_64/Base64.o /Users/shailendra.suriyal/Documents/MyProjects/..../UberNewUser/ExternalLib/FrameWork/mobile.connect.framework/mobile.connect duplicate symbol _OBJC_METACLASS_$_Base64 in: /Users/shailendra.suriyal/Library/Developer/Xcode/DerivedData/hadqxhhslzvmwfddwlthosrdljjy/Build/Intermediates/.../Debug-iphonesimulator/Muri.build/Objects-normal/x86_64/Base64.o /Users/shailendra.suriyal/Documents/MyProjects/.../UberNewUser/ExternalLib/FrameWork/mobile.connect.framework/mobile.connect ld: 2 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Finally, I got it. I just removed the Base64.h from the compiled resources under Build Phases.
You seem to be linking both the source and the library for the Base64 class.
This line...
/Users/shailendra.suriyal/Library/Developer/Xcode/DerivedData/Muri-hadqxhhslzvmwfddwlthosrdljjy/Build/Intermediates/Muri.build/Debug-iphonesimulator/Muri.build/Objects-normal/x86_64/Base64.o
...says you've compiled the class directly.
This one...
/Users/shailendra.suriyal/Documents/MyProjects/taxi_ios_client/UberNewUser/ExternalLib/FrameWork/mobile.connect.framework/mobile.connect
...says you're linking it from inside the mobile.connect.framework binary.
If you're using it from the library, you should remove the source from your project.
(If you've already removed the source and you're still getting this, delete the derived data and try again.)
DUPLICATE FILE CREATES OF "LoginController"

Google Services - Duplicate symbols on link

I'm getting the google services for ios integrated in my app. For reasons outside my control I can't use cocoapods, so I'm following the manual approach outlined here.
The problem is the Play Games C++ SDK Version 2.1 (gpg.framework). When I add it, (build phases, link binary with libraries, +) and build I get a lot of duplicate symbol errors:
duplicate symbol _AES_decrypt in:
../../../../../Monkey/modules/googleservices/native/gpg-cpp-sdk/ios/gpg.framework/gpg(libgpg.a-arm64-master.o)
../../../../../Monkey/modules/googleservices/native/gpg-cpp-sdk/ios/gpg.framework/gpg(aes.o)
. . .
duplicate symbol __ZTVN4buzz10XmlBuilderE in:
../../../../../Monkey/modules/googleservices/native/gpg-cpp-sdk/ios/gpg.framework/gpg(libgpg.a-arm64-master.o)
../../../../../Monkey/modules/googleservices/native/gpg-cpp-sdk/ios/gpg.framework/gpg(xmlbuilder.o)
ld: 7242 duplicate symbols for architecture arm64 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I've spent a day going over the common causes for duplicate symbols in stack overflow and nothing seems to work. Removed all google frameworks and re-added them, added the google frameworks in a different project (same issue), cleared out derived data, etc..
Any ideas on what might be causing it? Help much appreciated, thanks.
Specs:
Xcode 7.2.1
Deployment Target: 7.0
Play Games C++ SDK Version 2.1
This might not be the best solution, but I solved it by opening up the gpg file, and removing the offending .o files that contained duplicate symbols.
Followed the instructions here.
The files I removed are libgpg.a-* and example_mul.o
Can't guarantee it all works, but at least it's letting me do a google services sign-in at this point.

binding and ios library in monotouch, duplicate symbols error

I am trying to bind a native iOS library in my monotouch application but I keep getting this error:
duplicate symbol _timeoutReached3 in:
/var/folders/3j/zf4d4nbd5v33y_7pqtfm25mh0000gn/T/tmp168daf95.tmp/VCMF.a(VFIPrinter.o)
/var/folders/3j/zf4d4nbd5v33y_7pqtfm25mh0000gn/T/tmp168daf95.tmp/VCMF.a(VFIBTBridge.o)
ld: 1 duplicate symbol for architecture i386
I am all out of ideas, so of anyone has gone through something similar, I would appreciate some help.
Since it's referencing different files in your .a (VFIPrinter & VFIBTBridge), I'd guess you really do have duplicate symbols compiled in. Is this a library you wrote? Do you have timeoutReached3 in a header included by both of those files? Switch it to be an extern and stick it one of the c files.

RubyMotion - Duplicate symbols when linking?

I've added a 3rd party library (Tesseract) to a project. The library builds and runs with no errors when used in an XCode project. My RubyMotion project builds, but fails when linking:
duplicate symbol _main in:
vendor/Tesseract/build-iPhoneSimulator/libTesseract.a(svpaint.o)
./build/iPhoneSimulator-5.0-Development/objs/main.o
duplicate symbol _selCopy in:
vendor/Tesseract/build-iPhoneSimulator/libTesseract.a(sel1.o)
/Library/RubyMotion/data/5.0/iPhoneSimulator/libmacruby-static.a(id.o)
duplicate symbol _selWrite in:
vendor/Tesseract/build-iPhoneSimulator/libTesseract.a(sel1.o)
/Library/RubyMotion/data/5.0/iPhoneSimulator/libmacruby-static.a(id.o)
ld: 3 duplicate symbols for architecture i386
I've tried adding Tesseract two different ways, as a :static library and as an :xcode project. Same error both ways.
Given that I'm able to build and run a normal Xcode project which uses this library, I'm pretty sure I'm doing something wrong with RubyMotion.
I solved this issue by building Tesseract with the --disable-graphics option for configure, as mentioned in their FAQ.

Duplicate Symbol linker error

I have an existing app in which I added the json-framework. Now it won't compile due to a duplicate symbol linker error.
The error seems to be due to the installed Millenial Media ad network SDK which also links to the json-framework. It seems the json-framework must be already embedded in MMs .a static library file. If I dont add the SDK then I cant import the json-framework for use in my own code, but when I do the compiler raises this exception.
ld: duplicate symbol _OBJC_IVAR_$_SBJsonParser.maxDepth in /users/laptop/Developer/sandbox/testapp_sources_add_owntracking/testapp/AdNetworkLibs/MillenialMedia/libMMSDK.a(SBJsonParser.o) and /Users/laptop/Library/Developer/Xcode/DerivedData/testapp-bjxtaanqoewrondmjnucarxebkka/Build/Intermediates/testapp.build/Debug-iphonesimulator/testapp.build/Objects-normal/i386/SBJsonParser.o for architecture i386
collect2: ld returned 1 exit status
You can add the json framework header files without adding the json class implementation files. If these classes are in another library, then they will be linked with that library.
In your project, you have SBJsonParsor added twice.
This might have happend as some of the library (source) you are using (added to project) already have SBJsonParsor added without your active knowledge about the same.
You need to check your project hierarchy and remove one of the reference.

Resources