duplicate symbol of _main in Tesseract libtesseract_all.a(svpaint.o) - ios

I've clone the project of "iPhone-OCR-Tesseract-and-OpenCV" from Github, installed its pod, compiled files and it works great.
However, I try to merge the pod file with my existing one and compile it, I have an issue that shows
duplicate symbol _main in:
/Users/ivanlin/Library/Developer/Xcode/DerivedData/MailTracker-duddjrlaosmnafgcbrqibnzstqws/Build/Intermediates/MailTracker.build/Debug-iphoneos/MailTracker.build/Objects-normal/armv7/main.o
/Users/ivanlin/Documents/Projects/MailTracker/Pods/Tesseract/lib/libtesseract_all.a(svpaint.o) ld: 1 duplicate symbol for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems that there is another main function in the Tesseract library.
I am wondering why this issue does not show up in the original project.
I try to compare possible compile and link options between the original project and mine and there is no clue.
If anyone have experience to address this issue, please help a bit. I will very appreciate.
Many thanks.

To answer my own question.
I've found the root cause and it is not relevant to re-including a main file.
After comparing "iPhone-OCR-Tesseract-and-OpenCV" and my own project, I found that my project has an additional linker option which is "load_all".
After removing out this "load_all" option, the issue is gone.
I am not sure why it cases the issue, but it is a solution in my case.

Related

Cocoapods : ld: library not found for -lBolts

I am using cocoapods in one of my projects and after I cleaned the derived data for my project I have started seeing this error
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/Bolts'
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/DownPicker'
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/MBProgressHUD'
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/Parse'
ld: warning: directory not found for option '-L/Users/vishal/Library/Developer/Xcode/DerivedData/SensorLab-ctzyiyrpdclyjybpujriezgkckkn/Build/Products/Debug-iphoneos/SCLAlertView-Objective-C'
ld: library not found for -lBolts
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I open up the Debug-iphoneos from Window > Projects I do not see any folders in there now. Since this problem started cropping up after cleaning derived data I do not really know what did I do which stopped generating those folders.
This is how it looks :
This is kind of how it should look, I imagine (From a different project)
I have tried what was suggested here
Cocoapods ld: library not found for -lPods-Projectname
Cocoapods ld: library not found for -lPods-ObjectiveSugar
And a couple more things which I have tried but to no avail, I have faced my fair share of cocoapod niggles. This seems beyond me.
EDIT: I have been doing some more tests with this, I realized that my pods are not even building ! When I clear derived data for any other project, it goes ahead and builds the Pods next time I try to build the project, but not in this project. What setting can wrong ?
This is how the project looks right now :
Any help will be appreciated.
Clean up cocoa pods and install them again.
You can also use tool - https://github.com/CocoaPods/cocoapods-deintegrate
Somehow the option of Find Implicit Dependencies got turned off in the build scheme. SMH.
Hope this can help someone in the future.

Apple Mach-O Linker Error when Facebook installed using pods in the project

I have just installed the Facebook using pods and now my project is not working and says. Please help someone.
Apple Mach-O Linker Error
ld: 87 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
duplicate symbols for architecture means your files are doubled, Please check if you have added facebook framework manually before using pods
you can also check files duplicating by seeing whole description of error
Solution 1
You need to do this:
Click on your project (targets) Click on Build Settings Under Library Search Paths, delete the paths May be this will help you.
Solution 2
You have duplicate symbol method which means there are duplicate file in project
In your Target's Build Phase, under "Compile Sources" check if there are duplicate file and delete one if you have duplication.
Hope this will help you.

SMCalloutView duplicate symbol linking error iOS

Im using mapbox and I need to customise annotation for it. For that I found that we can use SMCalloutView.
But when I integrated SMCalloutView into xcode project, then it started giving linking duplicate symbol errors.
/Users/xxx/Library/Developer/Xcode/DerivedData/mapboxDemoWithCustomAnnotation-ebmsoyqrqzxuouckyxxwhjbcakwf/Build/Intermediates/mapboxDemoWithCustomAnnotation.build/Debug-iphonesimulator/mapboxDemoWithCustomAnnotation.build/Objects-normal/x86_64/SMCalloutView.o
/Users/xxx/Desktop/mapboxDemoWithCustomAnnotation/Pods/Mapbox-iOS-SDK/Mapbox.framework/Mapbox(SMCalloutView.o)
ld: 38 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone help me on this?
The problem you have is that somewhere you are including the SMCalloutView file twice which is being compiled twice.
Its a drawback for objective-c as you cannot have the same name of an object twice.
I would first, check in your project if you have included the smcalloutview file in your project.
Start by looking your project(like mine, the Movei project) this should NOT include smcalloutview class.
SMCalloutView should only exist in the Pods project.

Getting Error on compiling project with Parse

I have followed all the steps specified https://www.parse.com/apps/quickstart#parse_push/ios/native/existing and also tried to add Parse Framework from cocoPods but still getting these following duplicate symbol errors, the IOS min version is 7.0 and objective c is used.
The errors are:
duplicate symbol _BFTaskMultipleExceptionsException in:
/Users/sabaanwar/Library/Developer/Xcode/DerivedData/Project1-bybalqattilbrydhswfphyvovcre/Build/Intermediates/Project1.build/Debug-iphoneos/Project1.build/Objects-normal/arm64/FLAnimatedImageView.o
/Users/sabaanwar/Library/Developer/Xcode/DerivedData/Project1-bybalqattilbrydhswfphyvovcre/Build/Intermediates/Project1.build/Debug-iphoneos/Project1.build/Objects-normal/arm64/BaseNetworkModel.o
duplicate symbol _BFTaskMultipleExceptionsException in:
/Users/sabaanwar/Library/Developer/Xcode/DerivedData/Project1-bybalqattilbrydhswfphyvovcre/Build/Intermediates/Project1.build/Debug-iphoneos/Project1.build/Objects-normal/arm64/FLAnimatedImageView.o
.
.
.
ld: 161 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It appears that you are trying to compile the same code twice. This is throwing you an error and may have been caused by you installing the library and also the cocoaPods file. Another possible reason would be that you have same class implementation into two different files. However, I wouldn't expect that with a third party library.
In order to fix that, the easiest way would probably to just delete the project ans start with a clean one. If that isn't possible, delete the cocoaPod, delete the framework and any files that you installed, clean the cache and build the project. It should compile without any problem. Then just install the SDK once.
Hope that helps, Julian
Found the solution over here: https://stackoverflow.com/a/29724276/4841900
The reason was Bolts and FacebookSDK were conflicting each other so i was getting duplicate symbol errors.

Xcode + AWS Integration Apple Mach-O Linker Error

I have a very simple Xcode project that I started and am now trying to integrate the Amazon Web Service (AWS) SDK into my project. I followed the instructions posted on their instruction page and everything looks good EXCEPT that I've got the following output...
duplicate symbol _OBJC_CLASS_$_XMLDictionaryParser in:
/Volumes/Macintosh HD/Users/ryanmord/Library/Developer/Xcode/DerivedData/FocalApplication-brblhwteebzxgycscfnynvdcptjx/Build/Products/Debug-iphonesimulator/libPods-XMLDictionary.a(XMLDictionary.o)
/Volumes/Macintosh HD/Users/ryanmord/Downloads/aws-ios-sdk-2.1.2/third-party/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_METACLASS_$_XMLDictionaryParser in:
/Volumes/Macintosh HD/Users/ryanmord/Library/Developer/Xcode/DerivedData/FocalApplication-brblhwteebzxgycscfnynvdcptjx/Build/Products/Debug-iphonesimulator/libPods-XMLDictionary.a(XMLDictionary.o)
/Volumes/Macintosh HD/Users/ryanmord/Downloads/aws-ios-sdk-2.1.2/third-party/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
ld: 5771 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is the very end of the output, but as the 2nd to last line says, I've got 5771 other duplicate symbols worth of output as well. Im not sure if this is related to the "clang error" that Im getting, but regardless this is a roadblock for me that I can't figure out. I've seen recommendations from duplicate libraries, to changing the valid architectures in my project, but I'm not sure what will break my app and what won't. Any help would be greatly appreciated!!
Cheers
Are you importing the AWS Mobile SDK for iOS using both the frameworks and CocoaPods? You cannot import the SDK twice, and that is why you are getting duplicate symbols errors. You need to pick one of them and remove the other one to remove the errors.

Resources