cocoapods duplicate symbol _OBJ_METACLASS_$PodsDummy_Pods_xxx - ios

recently I have update to xCode 6. In my project where I am using cocoapods, after update my pods, I am dealing with an error I can`t resolve and need help. Similar questions in the forums don't resolve my problem and I need other point of view.
The error is:
duplicate symbol _OBJC_METACLASS_$_PodsDummy_Pods_myapp in:
/Users/myuser/Library/Developer/Xcode/DerivedData/myapp-cojufufwukcibtcgwjgdbqesleta/Build/Products/Debug-iphoneos/libPods-ibizahelp.a(Pods-myapp-dummy.o)
/Users/myuser/Library/Developer/Xcode/DerivedData/myapp-cojufufwukcibtcgwjgdbqesleta/Build/Products/Debug-iphoneos/libPods-IbizaHelp.a(Pods-myapp-dummy.o)
duplicate symbol _OBJC_CLASS_$_PodsDummy_Pods_myapp in:
/Users/myuser/Library/Developer/Xcode/DerivedData/ibizahelp-cojufufwukcibtcgwjgdbqesleta/Build/Products/Debug-iphoneos/libPods-ibizahelp.a(Pods-myapp-dummy.o)
/Users/myuser/Library/Developer/Xcode/DerivedData/myapp-cojufufwukcibtcgwjgdbqesleta/Build/Products/Debug-iphoneos/libPods-IbizaHelp.a(Pods-myapp-dummy.o)
ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
my Podfile is:
#Uncomment this line to define a global platform for your project
platform :ios, '6.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'myapp' do
pod 'MWPhotoBrowser'
pod 'AFNetworking', '~> 2.0'
pod 'UIActivityIndicator-for-SDWebImage'
end
Please I am stuck

I've had it after target name update, it added pods framework twice - removing the old framework solved it.
Project > Target > Linked Frameworks and Libraries
(remove with "-")

go to Finder click ALT and see GO option you will find library and click on application delete derived data.Xcode 6 is entirely new format of data storage.so delete old xcode derived data.

Finally I have found a solution.
It seems that the cocoapods have changed something or my proyect had a problem in the name, not sure at all but my target configuration had an specific configuration set, and cocoapods needs its own.
my configuration set was Pods-myappname-xconfig.release and I the correct was Pods-xconfig.release that was located in the pods folder when install them.
Once I have changed it, the error disappear and I just had to remove from link libraries the old library related to that config.
if anyone has similar issues, I will be glad of help him

Related

iOS/Google Ads giving Linker Code Failure

Trying to insert Google Ads/Firebase into a test app. Suspect I've almost got this working but. Using the Google notes from https://firebase.google.com/docs/admob/ios/quick-start
When I compile I receive "Linker code failed with exit code 1":
ld: warning: directory not found for option '-L/Users/edward/Library/Developer/Xcode/DerivedData/TotalConversion-gtwxqoywudjqpodqkpfpwcnovyuz/Build/Products/Debug-iphoneos/GoogleToolboxForMac'
ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have created the Podfile as instructed with:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ’7.0’
target 'TotalConversion' do
pod 'Firebase/Core'
pod 'Firebase/AdMob'
end
and then run a pod update. I don't see a .xcworkspace file referred to in the docs. Does the iOS, '7.0' line above need to be altered?
I presume that using pods GoogleAds is instead of the standard framework (Build Phases/Link Binary) approach.
If there is a linker error, this might be few things. First, check if you haven't open .xcodeproj instead of .xcworkspace by mistake. If not, the solution might be simple project cleaning by pressing cmd+shift+k. At last, check if those libraries are linked with project and are having status required in your target's general/build phases (Pods_YourProjectName.framework).
In Podfile you can actually comment out lines with source and platform by placing # in front of them. Go to terminal, cd to your project directory and try pod install once again, maybe that will do the job.
Sorry for not placing this in comments but my reputation doesn't allow me doing it.
The {projectName}.xcworkspace folder should be in the same folder as the .xcodeproj that you have open. Close Xcode {projectName}.xcodeproj instance and open {projectName}.xcworkspace using the Finder, command line, or Xcode open.

linker command failed with exit code 1 (use -v to see invocation), build app in xcode-Cocoapods

I am bulding my app in xcode 7, and get the following error:
ld: library not found for -lAFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error
Cocoapods was used to load the necessary libraries in the app as follows:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'myapp' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'AFNetworking', '~> 3.0'
pod 'MBProgressHUD', '~> 0.9.2'
pod 'Reachability', '~> 3.2'
pod 'SDWebImage', '~> 3.8.1'
pod 'ZipArchive', '~> 1.4.0'
pod 'JDFTooltips', '~> 1.1'
end
what should I do?
I had similar problem.
1) Clean DerivedData (~/Library/Developer/Xcode/DerivedData)
2) Product -> Clean -> Rebuild
3) Open Pods Targets and set Build Active Architecture Only - NO
First of all, I would check to see if your podfile is in the same directory as your target.
If it is, delete the podfile.lock and the pods folder. (Leave the podfile alone.)
Clean the project (CMD+SHIFT+K). This may be unnecessary, but its usually worth doing just to be sure.
Then, do a pod install.
See if there are any warnings (yellow, not red text) in the terminal. Sometimes these warnings will prevent your project from building, and sometimes they won't. If your project won't build, and you do have warnings, try to fix them.
For example, there is a warning that mentions setting the build paths or something to $(inherited). I had one project that built fine with this warning, and another that required me to fix it.
I'm not guaranteeing this will work, but I think its a good first step.
Did you change the name of your project?
Check this answer: ld: file not found: linker command failed with exit code 1 (use -v to see invocation)
This also happened to me a lot, but i solved it by deleting the DerivedData folder of the project and related projects
that was having problems, you can see how to simply do this by looking at this answer:
https://stackoverflow.com/a/37990186/3975501
Also this poses no risk to your application as DerivedData is just a folder that Xcode uses to reduce compiling time. If it's deleted Xcode will simply recreate it.
I faced the same error while writing C using Xcode 8,
The issue was there was a duplicate main method in two different files.
So, I commented one of them, then the error disappeared and the application started to compile successfully.

Xcode: Cannot parse the debug map for .. is a directory

I'm trying to link my iPhone simulator project and I'm getting the following error at link time:
(null): error: cannot parse the debug map for "/Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks": Is a directory
Here's the linker output:
GenerateDSYMFile /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app.dSYM /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks
cd /Work/TrainTracks/TrainTracks
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks -o /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app.dSYM
error: cannot parse the debug map for "/Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks": Is a directory
What would cause this problem?
I started off with a Game template (Xcode 7.2.1) and deleted the main story board and AppDelegate.* files since this is an SDL cross-platform project.
This problem was caused by a second inclusion of a TrainTracks folder in my project. I already had a yellow TrainTracks group with all of my source but for some reason Xcode was also showing a blue TrackTracks folder as well. This has a duplicate info.plist and other files. I removed the blue folder reference and the project now builds successfully.
If you are using CocoaPods, and you get this error after changing the name of your Target, click on your target, go to the General tab, scroll down to "Linked Frameworks and Libraries" and then delete the following library:
libPods-YourOldTargetName.a
For me this error was the inclusion of the same .m file twice in the project. Happened while moving some files around. Quit Xcode, clean and it told me the file in a linker error.
I ran into this problem trying to run my tests, and it was because my test target required the use of one of the pods I had in my Podfile. To fix it I just added my test target to the Podfile and included the relevant pods, as per the following pattern:
workspace 'myproject.xcworkspace'
platform :ios, '8.0'
use_frameworks!
def shared_pods
pod 'RealmSwift', '~> 2.8'
end
project 'myproject.xcodeproj'
target :MyProject do
project 'myproject.xcodeproj'
shared_pods
end
target :MyProjectTests do
project 'myproject.xcodeproj'
shared_pods
end
In my case, this same error showed up because one of the frameworks used in the app was compiled without Bitcode, so I had to turn off Bitcode for the entire project.
In my case, I had made a duplicate of one of my .m files in the finder to keep as reference, and somehow (most likely my error) it was added to the project explorer. The real error was duplicate definitions since the class appeared twice. Removing the "ClassNameHere_copy.m" fixed the issue.
For me, it was because I changed my target name which made a new cocoa pods .a library but didn't remove the other from linking.
In My case I had to delete my entire repository and clone again, nothing else worked, after fresh cloning, I ran a pod install and it worked.

How to remove duplicate files generated through cocoa pods in iOS

I am using cocoa pods to integrate multiple third party files into my project.
I have to integrate below pod into my project
xcodeproj 'MyApp'
workspace 'MyApp'
source 'https://github.com/CocoaPods/Specs.git'
target :"MyApp", :exclusive => true do
platform :ios, '7.0'
pod 'AFNetworking', '2.0.2'
pod 'TwilioSDK', '~>1.2.2'
pod 'SocketRocket', '0.3.1-beta2'
pod 'AppRTC'
end
When I run pod install. I get duplicates as shown below..
When I build my app I am getting error
ld: warning: directory not found for option '-L/Users/anand/Documents/
Project/myApp_Backups/myApp_June/myApp_WEBRTC/Pods/build/Debug-
iphoneos'
duplicate symbol _MD5_Update in:
/Users/anand/Documents/Project/myApp_Backups/myApp_June/
myApp_WEBRTC/Pods/AppRTC/Lib/libWebRTC.a(nss_static.md5.o)
/Users/anand/Documents/Project/myApp_Backups/myApp_June/
myApp_WEBRTC/Pods/TwilioSDK/Libraries/libcrypto.a(md5_dgst.o)
duplicate symbol _SHA1_Update in:
duplicate symbol _OBJC_IVAR_$_SRIOConsumer._readToCurrentFrame in:
/Users/anand/Library/Developer/Xcode/DerivedData/myApp-
gxdbyoohznnpigavdqmaeilzlavd/Build/Products/Debug-iphoneos/libPods-
myApp-SocketRocket.a(SRWebSocket.o)
/Users/anand/Documents/Project/myApp_Backups/myApp_June/
myApp_WEBRTC/Pods/AppRTC/Lib/libWebRTC.a(socketrocket.SRWebSocket.o)
ld: 71 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I thought to do below solutions:
1) Remove SRWebSocket.h file -- but it may get errors as it is in Pods.
2) Remove pod 'SocketRocket', '0.3.1-beta2' from pod file and run pod install -- but I used both SRWebSocket.h and SRWebSocket.m in my project before installing AppRTC into my project..!
Please suggest how can I solve this issue..
Thanks in Advance..!
I have fixed the above issue as below
At my Xcode project -- Build Settings -- Other linker Flags -- I removed -all_load then some of the duplicate errors are gone.
Still I get Socket Rocket duplicate warnings after the above solution.
I fixed this by going to Pods Project -- Selected Socket Rocket pods target -- Removed the SRWebSocket.m file from Compiling. It works fine and duplicates are removed.
Thanks for all answers..
You need to remove the socketrocket object code from libWebRTC.a
run lipo -info libWebRTC.a to see what architectures are in the library (current version is i386, armv7, and arm64)
Then run
lipo libWebRTC.a -thin i386 -output libWebRTC-i386.a
Do this for each architecture by replacing i386 with the relevant value. You then need to extract the object files from each archive.
mkdir libWebRTC-i386 && cd libWebRTC-i386 && ar -x ../libWebRTC-i386.a
Do this for each of the new single architecture libraries you've just created. In each of the new folders you will find .o files that contain "socketrocket" - delete these.
Then re-archive the object files for each architecture
libtool -static *.o -o ../libWebRTC-i386.a
Once you have done this re-combine them into a fat library
lipo -create libWebRTC-armv7.a libWebRTC-arm64.a libWebRTC-i386.a -output libWebRTC.a
And voila, it should now work. Really the libWebRTC.a binary needs re-building without the socket rocket object code, and socket rocket should be added as a dependency to the podspec.
Solution
Backup your project
Close the Xcode
- install this gem on terminal:
https://github.com/kylef/cocoapods-deintegrate
run the command line below :
pod deintegrate
remove the Podfile.lock file in your project directory
run install again :
pod install
Open Xcode and Clean your project and Derived Data directory then run again
Hope this solution will fix your problem.
Best
In your build phases, check to see that you aren't compiling the same file more than once.
In your case, maybe there're two same m files in Compile Sources, just remove one and try to rebuild.
Follow the below steps to resolve your duplication symbol error.
1) Select your Xcode Project > Navigate to "Build Phases".
2) From there, search the file name for which you are getting duplication.
3) If possible, then there might be more than one ".m files" for your search keyword.
4) Remove all the files except one which you need to actually compile.
5) Same way follow the process for all the duplicate error
6) That's it! Your problem will be solved for sure.
Create an issue for AppRTC repo to remove the header and set a dependency on SRWebSocket instead.
As a temporary solution - link AppRTC to a local path with :path directive and remove this file from the local directory. Or you may link to a local podspec file with ignorance on SRWebSocket header in exclude_files config.
Now it's very easy to remove duplicate pod files or any pod which is not in use for your project.
open your pod file.
comment all pod file which you want to remove.
use commend pod install
you will your all comment pod will remove in terminal
Enjoy your day with a cup of tea or coffee while doing code.

Cocoapods Completely Broke

To start: I'm using Cocoapods 0.37.2, XCode 6.3.1 compiling for iOS 8.3
My project worked just fine before I ran a basic "pod update" now it's completely refusing to compile. I'm quite positive this has nothing to do with the pods themselves. Specifically the error I'm getting is this:
ld: warning: directory not found for option '-F/Users/user_name/Library/Developer/Xcode/DerivedData/AppName-bjozswzeepmhacfkeimeepxzcxgb/Build/Products/Debug-iphoneos/include'
ld: library not found for -lPods-AppName-AFNetworking
Podfile is this:
# Uncomment this line to define a global platform for your project
platform :ios, "8.0"
def shared_pods
pod 'SocketRocket'
pod 'AFNetworking'
pod 'DateTools'
pod 'Spotify-iOS-SDK'
end
target "AppName" do
shared_pods
end
target "AppNameTests" do
shared_pods
end
I have cleared DerivedData (many many times), cleaned my builds, restarted XCode, restarted my machine, I have ensured my config files and linker config lists are set up correctly. I've been using Cocoapods for years and never had this much trouble.
Completely frustrated and confused... questioning sanity.
Any help?
Information from CocoaPods troubleshooting doc. Hope this helps you.
If Xcode complains when linking, e.g. Library not found for -lPods, it
doesn't detect the implicit dependencies:
Go to Product > Edit Scheme
Click on Build
Add the Pods static
library, and make sure it's at the top of the list
Clean and build again
If that doesn't work, verify that the source for the spec you
are trying to include has been pulled from GitHub. Do this by looking
in /Pods/. If it
is empty (it should not be), verify that the
~/.cocoapods/master//.podspec has the correct git hub url
in it.
If still doesn't work, check your Xcode build locations
settings. Go to Preferences -> Locations -> Derived Data -> Advanced
and set build location to "Relative to Workspace".

Resources