ld: library not found for -lPods - ios

I've upgraded to cocoapods 0.32.1 today and I get the linker error above. I've tried virtually any advice I could find and nothing works.
I've run pod install, which created a workspace which I'm using to build the project.
What seems weird to me is that the Pods project generated by default contains i386 and x86_64 architectures instead of arm ones.
Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'x86_64' didn't contain all required architectures 'i386 x86_64'
Then I changed Architectures of the Pods project to Universal and Build Active Architecture Only to No for both Debug and Release.
And I still get the same linker error, but with no warnings now.
I'm totally clueless now, any help is appreciated.

Related

Linking Xcode iOS project with OCMock using cocoaPod

I installed OCMock using cocoapod for my test project
target 'ProjectTests' do
use_frameworks!
pod 'OCMock'
end
In My test project, Build Phases -> Link Binary with Libraries, I added OCMock.framework (Under Pods). But the actual file doesn't seem to exist there. Am I missing something?
In Build setting, updated Header/Library search path with '/Pods/OCMock/Source/**' (recursive).
My headers are getting referenced, but when I try to the tests I get an error
ld: framework not found OCMock
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone help me resolve the issue?

could not find module 'Alamofire' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64

I have updated xcode to 12.3, i am getting the new errors.
could not find module 'Alamofire' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64
Command CompileSwift failed with a nonzero exit code
Another workaround is to set BuildSettings ->"Validate Workspace" to Yes. It will still show a warning, but will build the project.
I was using Carthage 0.38 and XCode 13. I encountered this issues when building Moya.
I found that in file Carthage > Build > iOS, there is a duplicate Alamofire framework build (another one is in Carthage > Build), and XCode somehow use this for building Moya.
After I deleted the duplicate one, it can be built successfully.
change your project name
use only english characters

adding ios core framework to podfile

I added a pod to my Podfile and got compiler errors when building:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_CLLocation", referenced from:
objc-class-ref in MoPubAdapter(GADMAdapterMoPub.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I then went to Build Settings > Target > Debug > Other Linker Files and manually added -framework and "CoreLocation".
The compiler did not complain anymore. I assume they were forgotten in as prerequisites for the pod.
Now I don't like the fact that I manually changed this value. I might forget to do this if Cocoapods i.e. overwrites this value again. Is there a way for me do add the CoreLocation framework to the Podfile so that Cocoapods takes care of including it?
Thanks
I am afraid there is no way to do that. Apple does not provide dependency of it's core frameworks on Cocoapods. As a test, you can search for any core library on Cocoapods. You won't find that. As a brief test, here is the result if you try to set pod CoreLocation in Podfile.
Sadly, fixing this manually is the only workaround.
You could add a dependency in your Podfile to a minimal CocoaPod that only adds a dependency to CoreLocation. See here for creating a podspec and here for referencing a podspec from a local path.
A better solution would be to update the offending pod's podspec to add CoreLocation as a framework.

XCode 6 CocoaPods error : target overrides the `OTHER_LDFLAGS` build setting

I just starting using CocoaPods and I am getting the following errors when I pod install from the terminal (My project is called babyMilestones and I'm trying to use CocoaPods for the ShipLib Framework). :
The babyMilestones [Release] target overrides the FRAMEWORK_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the$(inherited)` flag, or
- Remove the build settings from the target.
I'm getting this error for Header Search Paths and Framework Search Paths.
When I try to build my project I get an error on the #import line saying the ShipLib/ShipLib.h file cannot be found. In my project navigator my Pods project is showing properly, and the ShipLib framework is visible.
I never set any of these search paths explicitly, I just let XCode 6 do it's thing. I found this answer : The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig
I have tried the following :
Deleted all the Framework Search Paths in Build Settings. This did not fix the issue
I then added $(inherited) to the Framework Search Path. I did Clean then Build. This gave new errors of the following type:
ld: warning: directory not found for option '-L/Users/billpaystation/Documents/iOS/babyMilestones/babyMilestones/Pods/build/Debug-iphoneos'
ld: warning: directory not found for option '-F'
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ActionSheetDatePicker", referenced from:
objc-class-ref in EditItemViewController.o
"_OBJC_CLASS_$_SYSincerelyController", referenced from:
objc-class-ref in EditItemViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Action Sheet Picker and Sincerely Controller are the libraries I'm trying to add with Pods.
I noticed that libPods.a is red under Frameworks in my file inspector. So I went to Scheme ->Edit Scheme-> and added Pods to the Build.
I don't really understand the whole target/build settings and I may have made it worse trying so many different things. Any help would be appreciated!
You should add $(inherited) to the Framework Search Path. For the new errors you should go:
TargetSettings->Build Phases->Compile Sources->(+) ActionSheetDatePicker.m, and SYSincerelyController.m classes and then Build and Run.
Here's my problem and solution from yesterday.
target overrides the FRAMEWORK_SEARCH_PATHS build settings
Hope this helps.
In my case it was not an Xcode issue, plus I think that fixing it by hand is a bad idea. I tried to use a different (earlier version) of Cocoapods and it worked fine!
gem install cocoapods -v 0.33.1

Cocoa Pods Error ld: library not found for -lPods

I'm getting a error from cocoa pods that I've never seen before. I've had it working with several dependencies just fine. I recently added the TestFlightSDK as a dependency through pods and I'm unable to Archive the project. It builds just fine to devices but refuses to Archive. Has anyone else experienced this issue?
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My Library Search Paths looks like this (for both debug and release):
$(SRCROOT) recursive
$(PODS_ROOT) recursive
$(inherited) recursive
Ok so I found the answer (that worked for me) using some suggestions from this post
I was actually getting a different Warning that I hadn't noticed.
Pods was rejected as an implicit dependency for 'libPods.a' because its
architectures 'armv7 armv7s' didn't contain all required architectures
'armv7 armv7s arm64'
It was actually related to the Pods target not having the correct architectures. It turned out to be a xCode bug after all. In my Pods Target I had all the correct acrhitectures selected, armv7, armv7s, and arm64.
THE SOLUTION:
Update cocoapods to the newest version that supports 64 arch.
sudo gem update cocoapods
Delete all Valid Architectures and do a project clean (which fails alot..)
Re-Add the architectures that you just removed and voilĂ !
my fault was an old cocoa pods integration. had to delete the pod-.a files in "/Frameworks" folder and pod-.xcconfig in "/Pods".
-> run 'pod install'
everything fine
Other solution is if you update your pods with new target, you will check libpods.a, maybe was deleted and system not found it. Make sure that libpods is in your Linked Framework and libraries in General information (where you change version, bundle identifier and build).
In my case problem was with Scheme.
go to Product -> Scheme -> 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
You can fix this issue if this belongs to libraries by selecting your Target, then going to "Build Phases" in "Link Binary With Libraries", and removing ".a" file of that library. After this Clean and Build.
Hope this helps.

Resources