Here is my podFile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'AFNetworking'
pod 'ODSAccordionView', '0.4.4'
pod 'IQKeyboardManager'
pod 'NYXImagesKit', :git => 'https://github.com/Nyx0uf/NYXImagesKit.git'
pod 'PEPhotoCropEditor'
pod 'CocoaAsyncSocket'
pod 'PKRevealController'
pod 'Haneke', '~> 1.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'RadioButton'
Everythig has been working fine for a long time, but now, when I update my pods (pod update) these 3 pods get uptated:
AFNetworking
CocoaAsyncSocket
IQKeyboardManager
After that, nothing works anymore.
I get more than 600 duplicate symbols for architecture i386 errors, like this one:
duplicate symbol _OBJC_IVAR_$_AFHTTPRequestOperation._responseSerializer in:
/Users/myuser/Library/Developer/Xcode/DerivedData/MyProject-emjexnnjljambodthokzwpwcddhz/Build/Products/Debug-iphonesimulator/libPods-AFNetworking.a(AFHTTPRequestOperation.o)
/Users/myuser/Library/Developer/Xcode/DerivedData/MyProject-emjexnnjljambodthokzwpwcddhz/Build/Products/Debug-iphonesimulator/libAFNetworking.a(AFHTTPRequestOperation.o)
... (661 times the same error but pointing to different duplicated files)
ld: 661 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas?
EDITED: After doing the solution shown below, my project only compiles for iPad Air and I can not Archive anymore, i still get the same error...
I use the 'Manually Rename All of the Symbols' approach. I was experiencing the duplicate symbol _OBJC_METACLASS_$_PodsDummy_Pods and so i added the post_install in the Podfile to avoid the duplicate symbol.
Replace your pod file content with this to 'Manually Rename All of the Symbols'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited), PodsDummy_Pods=SomeOtherNamePodsDummy_Pods'
end
end
end
pod 'AFNetworking'
pod 'ODSAccordionView', '0.4.4'
pod 'IQKeyboardManager'
pod 'NYXImagesKit', :git => 'https://github.com/Nyx0uf/NYXImagesKit.git'
pod 'PEPhotoCropEditor'
pod 'CocoaAsyncSocket'
pod 'PKRevealController'
pod 'Haneke', '~> 1.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'RadioButton'
Edited :
Delete the following pod item's from your project
1.Pods Folder
2.Podfile.lock
3.ProjectName.xcworkspace
And then install the pods again
This hook allows you to make any last changes to the generated Xcode
project before it is written to disk or any other tasks you might
want to perform.
Reference -
1. https://developerinsider.co/cocoapods-remove-duplicate-symbols-errors/
2. http://guides.cocoapods.org/syntax/podfile.html#post_install
Even after deleting my pods and reinstalling them, I had always the same problem.
I finally found the solution by comparing with another project.
The issue was in the parameter "Other Linker Flags" (OTHER_LDFLAGS) in the Build Settings of the project. The pods were referenced not just by their name, but by adding the prefix "Pods-myProject"
"-l\"Pods-myProject-AMSlideMenu\"",
"-l\"Pods-myProject-CocoaLumberjack\"",
"-l\"Pods-myProject-DLAlertView\""
So I just removed the prefix and all was right
"-l\"AMSlideMenu\"",
"-l\"CocoaLumberjack\"",
"-l\"DLAlertView\""
I fixed a similar error (after a messy Cocoapods upgrade) by simply removing and then re-adding the pods. Backup your project, then run:
pod deintegrate
pod install
In my case we had a project written in objective C and swift with a custom framework module inside and to solve the symbols duplication problem we had to remove all the flags from Other Linker Flags under Build Settings of the project and the framework module.
Before inside Build Settings:
OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", "-all_load" );
After inside Build Settings:
OTHER_LDFLAGS = "$(inherited)";
I think Cocoapods has a bug where pod source files can be accidentally duplicated.
My project was building fine until after performing one pod update at which point a duplicate symbol error appeared.
After lots of confusion, I finally noticed that a Google pod ended up with two files. In my case, it was GTMOAuth2SignIn.m and GTMOAuth2SignIn 2.m. Hence, the duplicate symbol error.
Note that pods seem to reference files by wildcards indicating all source in a directory should be included. This differs from a classic Xcode project where files are explicitly referenced.
Also, I suspect that performing a pod update during a build process could be what's tripping up Cocoapods. The concurrent access to the same file(s) may cause problems. Just a theory.
Also, this may explain why some "solutions" associated with this problem are to remove/delete referenced pods, then re-add.
What worked for me:
Read the error report to identify the repo that supposedly contains duplicate files.
Drag the offending repo to the trash.
re-clone your repo.
set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>
This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream develop for a local dependency, git would pull in/generate duplicate files from multiple commits.
After following the above steps, the issue went away and git pull upstream develop was no longer pulling from multiple commits at once. Perhaps there was a weird git cache for my repo.
Related
I have installed the pod libcommoncrypto, the path is
<project>/Pods/IDZSwiftCommonCrypto/IDZSwiftCommonCrypto/*.swift files
I fail to understand why Xcode is not able to find a framework installed by the pod.
Edit (Podfile)
source 'https://github.com/CocoaPods/Specs.git'
project 'myproject.xcodeproj'
target 'myproject' do
use_frameworks!
pod 'Toaster'
pod 'libCommonCrypto'
end
Edit : CommonCrypto not found
You apparently have IDZCSwiftCommonCrypto and Toaster as explicit entries in your "Linked Frameworks and Libraries", not as part of you cocoapods. Remove those two and try again, these should be added to your app only via Pods_SwiftCommons.framework that cocoapods creates for you.
Also: pod 'libCommonCrypto' does not create any files named IDZSwiftCommonCrypto at all, instead I find Pods/libCommonCrypto/CommonCrypto.{h,swift}, as I would expect. IDZSwiftCommonCrypto is another pod, unrelated to libCommonCrypto, if you still have those files I'd recommend cleaning your your Pods directory and running pod update again.
I keep getting this error when compiling an Xcode project and cannot for the life of me figure out what the issue is.
ld: framework not found GTMOAuth2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am working from an .xcworkspace with a Podfile that has:
use_frameworks!
pod 'Firebase', '~> 4.0'
pod 'Firebase/Core'
pod 'Firebase/Invites'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'TwitterKit'
pod 'GoogleSignIn'
pod 'GTMOAuth2'
amongst other things. It finds all of the platforms save GTMOAuth2. What is strange is that otherwise everything seems in order - I'm opening the correct xcworkspace and definitely not an xcodeproj
My Pods directory seems in order:
In my pods I see it as a target:
This should do it. Interestingly, when I add it as a Linked Framework and Library, it comes up gray...
Also, in the build directory, I see both:
/Build/Products/Release-iphonesimulator/GTMOAuth2/GTMOAuth2.framework
and
./Build/Products/Release-iphoneos/GTMOAuth2/GTMOAuth2.framework
but to no avail, GTMOAuth2 is not found. No clue how to proceed - any tips would be really helpful! I should mention that I'm new to iOS development and that the project is in the context of a React Native App.
-l"GTMOAuth2" Remove this line
then Compile:)
This worked for me
Go to Target -> Build Settings
Inside Framework Search Paths, delete the paths
I seem to have a issue with my project settings, in Xcode 8. The issue is as follows:
When adding a new Pod - lets say, Pod Firebase - the install works, and adds the necessary files to my project. I can then, do #Import Firebase
All is fine, up to this point. However, as soon as I make a reference to the Firebase API example: [FirApp configure]; - all is still fine - autocomplete on Xcode works as expected and no issues. However, when building I then get a compile time issue which states:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRAppIndexing", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The only way I am able to solve this - is by manually adding the _FIRAppIndexing.framework in my projects, Build settings, under Link Libraries with Libraries
To do that, I just drag and drop the frame work from the project navigator to the correct section under link libraries.
This works sometimes; as with other parts of the Firebase SDK, I get runtime crashes.
So, to try get to the root cause, I created a brand new test project, installed the Pods using Pod install - I however did not have to add the framework manually to Libraries - its actually not even listed there.
Everything in the test project worked just fine, at compile and run time.
Which leads me to believe its something in my project settings that's causing this.
Things I have tried
Removed cocoapods completely with pod deintegrate and removed all
other traces of it. Then did a clean build. Then Pod install
Added -objc to linker flag
Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Crashlytics'
pod 'AsyncDisplayKit', '>= 2.0'
pod 'Firebase'
pod 'Firebase/Messaging'
pod 'FBSDKCoreKit'
pod "HockeySDK", :subspecs => ['AllFeaturesLib']
pod 'Fabric'
pod 'FirebaseAppIndexing'
pod 'AFNetworking', '~> 3.0'
pod '1PasswordExtension', '~> 1.8.4'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
GitHub example project
https://github.com/TanderZA/MyApp
I duplicated my current project - and removed all files. Problem still exists. You will see the project won't compile due to linker errors, with references to the Firebase AP.
By manually adding the frameworks to Link Libraries with Libraries, you will see that it should compile. But that is not how it should work. The current project has an issue with infoPlist.strings that I did not solve. But the project is in the state to demonstrate the issue.
I have checked the project, it seems you have messed up with schemes.
Create a new scheme properly then install the pods again and as the project is in Obj-C you don't need to enable frameworks in the podfile.
So comment like # use_frameworks!
Also update the pods using pod update
Then select the new scheme and build the project in it.
Let me know if you are not able to do it.
It is a xcode bug by the way
But try this :
Upgrade to latest version of xcode and Pods
Remove all architectures in your project
Clean your project
Add arcitectures from start.
This should resolve the issue.
Have you tried to use frameworks?
# platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
I am not sure though but I think what you need is pod 'Firebase/Core'. not pod 'Firebase'.
This link have the list of the Firebase framework that can be used.
And, in the video on the top of the page it says something about there is no single pod that can be installed and you need to set each one of them on the podfile depending on the features you want.
My guess they mislead us in some places where they had pod 'Firebase'. I dont think that they meant that it should do the work.
som try the following:
# Pods for MyApp
pod 'Firebase/Core'
pod 'Firebase/Messaging'
.
.
I know that you said that you had it work on another new project.
I added Firebase libraries to my project, and then I got this error. When I compile it, Xcode can't find some directories. However, they are in the Pods directory.
Here is the error log:
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GTMSessionFetcher'
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GTMSessionFetcher
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ToDoTogether' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
platform :ios, '10.0'
pod 'Firebase'
pod 'Firebase/AdMob'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
# Pods for ToDoTogether
end
Make sure you are opening the workspace file and not the project file. I was receiving the same error and realized I was using the project not the workspace.
I was facing same issue and I tried multiple things but still it was not working. I tried below.
Using XCworkspace file
Cleaned the project, restarted XCode, Mac
Turned bitcode to No
Deleted the search path for Framework, Library
Finally the thing that worked is, deleting pod file and re-creating pod file. It worked as magic!
P.S.: This is very generic error and so same solution may not work for all.
Go To Project Target > Build Settings:
Look for Search Paths > Framework Search Paths, delete all paths which you have been warned; then in Library Search Paths, delete all paths which you have been warned.
For me i had to change/edit the schema and choose the new one.
I had renamed my debug schema to debug(development) and that was causing my problem.
Fix:
Product > Edit Schema > Change Build Configuration
What I did was create alternate Configurations and renamed my current one.
In my case I just had to go to Edit Scheme > Run and Reselect "None" as Executable.
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.