Cocoapods error: linker command failed with exit code 1 (use -v to see invocation)
Asked Answered
A

7

19

First time using cocoa pods (latest version) for dependencies in the latest Xcode 7.2.1 with Swift 2.1. I initialize my project folder and then edit the podfile and add my dependencies. When I run pod install it runs without a hitch until I open my project and try to build. I've tried this with two separate projects (one being brand new for testing) and I get linker command failed with exit code 1 (use -v to see invocation) for both. My pod file looks like this:

platform :ios, '8.0' #8.0 is minimum supported, right?
use_frameworks!

target 'Testing Frameworks' do
    pod 'Alamofire', '~> 3.0'
end
Anstus answered 6/2, 2016 at 2:0 Comment(0)
K
57

Close your current project and open the .xcworkspace created in your project folder.

Good luck!

Kidder answered 6/2, 2016 at 17:35 Comment(3)
I completely removed all the pod files and dependencies from the project and got a successful build with just the base project files. Then I did a pod init on the project again, added the dependencies to my pod file, did a pod install and opened the project with the new xcworkspace. It loads the project but has the exact same error, and a new warning that says: Target 'Pods-project' of project 'Pods' was rejected as an implicit dependency for 'Pods_project.framework' because its architectures 'x86_64' didn't contain all required architectures 'i386 x86_64'Anstus
Got it, I had to change BUILD ACTIVE ARCHITECTURE ONLY to NO in the build settings. Thank you!Anstus
this has been bothering me for a while and I laughed when I read your answer because of how short and simple it was. I wasn't expecting it XD. Thanks for the good work!Ressieressler
L
14

First try to Show the Report navigator (8. tab in left navigator of Xcode) and check the report. It should give you some info what is going on like:

framework not found Pods_[PODFILE_OLD_ABSTRACT_TARGET_NAME].

Often when you change the abstract_target's name (or whatever the Cocoapods is using to name the framework in the future) in podfile, check your target's Link binary With libraries under the Build phases.

If it keeps the framework with the old name that no longer exists (next to the new one), remove it.

Lanie answered 12/7, 2017 at 23:17 Comment(1)
You are my hero.Dews
M
8
  1. Go to Project Settings.
  2. Go to Build Settings.
  3. Change BUILD ACTIVE ARCHITECTURE ONLY to NO.
Mousey answered 16/11, 2016 at 5:35 Comment(1)
Godsend...had different values for build / releaseCorinnacorinne
T
6

I just had similar problem in my project. I found that in GENERAL settings of the project in section "Linked Frameworks and Libraries" there are two files for pods: "libPods.a" and "Pods_ProjectName.framework"

Deleting "libPods.a" helped in my case.

Linked Frameworks and Libraries

Toilette answered 5/4, 2017 at 14:13 Comment(0)
M
3
  1. Open Pods project
  2. Select pod that is throwing an error in targets
  3. Go to iOS Deployment Target
  4. Make sure it matches your project iOS version

Example

Misalliance answered 18/5, 2023 at 13:7 Comment(0)
Z
1

Solution for me was adding `$(inherited) flag to LIBRARY_SEARCH_PATHS in target build settings.

Zaremski answered 2/8, 2017 at 20:33 Comment(0)
W
1

If you encounter this error while developing a pod, it's possible that your module doesn't export anything. Check the pattern for s.source_files in your .podspec. For me, the glob pattern was missing my source files.

Wyon answered 4/4, 2019 at 21:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.