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.
Related
We are trying to enable Bitcode fully in our Static Framework but we are receiving the following error while archiving the app when the framework is integrated with it though we are able to build it on the simulator or device.
ld: bitcode bundle could not be generated because '.framework/p-iOS(PTFWOperationPrepareTransaction.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build file '.framework/p-iOS' for architecture armv7
We have verified Bitcode state through otool -l Versions/A/p-iOS | grep __bitcode and seems like it is enabled correctly
.
Following are our project settings for bitcode on framework's end,
And following are our project settings for bitcode on app's end,
A humble request:
Please review our settings in the above screenshots as we have already checked all the related queries on SO so please do not give them as a reference.
Also, we have already tried Static Libraries, Frameworks, and Bitcode to get our things fixed.
Thanks in advance.
I also had this problem with a framework I built.
This is what worked for me:
In Build Settings of the framework project set Other C Flags to -fembed-bitcode
In the Build Settings of the framework target add a user defined flag called BITCODE_GENERATION_MODE with the value of bitcode
Both in the framework project and target, Enable Bitcode should be set on Yes
This problem has been bothering me for a long time and like you I did everything I could and it still didn't work. Finally I found out it was a stupid configuration I made in Podfile:
target 'MySDK' do
project 'Src/MySDK.xcodeproj'
end
target 'Demo' do
project 'Demo/Demo.xcodeproj'
pod 'MySDK', :path => $spec_path
end
Since my SDK doesn't have any dependencies, I added such a target to automatically add my SDK project to the workspace created by cocoapods.
As a result, even though this target doesn't have any dependencies, this action creates libPods-MySDK.a in my SDK and adds it in Build Phases - Link Binary With Libraries.
This causes the same problem as yours.
The solution is simple, delete the empty targets in the podfiles, delete the invalid Pods and Frameworks directories, and delete the pod-related config in Build Phases.
I have a pretty classical error during my project building:
ld: library not found for -lAppLovinSdk
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Originally I got the library from Cocoapods pod, but then I started having a lot of errors and decided to remove the pod from the Podfile and executed pod update
My Podfile looks like this:
I've tried to clean project, reinstall the Podfile, deleting Pods folder and Podfile.lock file, "Build Active Architecture Only" is set to "No", but I still have the error. I assume I still have some references to libraries from the deleted Pod. What is the way to get rid of them?
UPDATE: Here is a full error message:
Ok, so I figured out the problem:
I had to go to Target -> Build Settings -> Linking -> Other Linking Flags and there I had to remove all deleted libraries references, manually. And then it worked!
I have been struggling to get my xcode project to build for the last couple hours. I keep getting the following error:
ld: library not found for -lGoogleAnalyticsServices
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried almost everything. I saw that the Google Developers website said to use pod 'Google/Analytics', even after trying almost everything I could find on StackOverflow and Google regarding the error, I have had absolutely no luck.
I upgraded to XCode 7 yesterday, everything seemed to work yesterday but today suddenly I started getting this error.
If someone has anything I can do about this error, please help!
Pointing me in the right direction to get it fixed would be awesome too!
Thanks in advance for your help.
The linker flag has been renamed to:
-lGoogleAnalytics
but the Cocoapods settings have not been updated yet. Rename the entry in "Other Linker Flags" and your problem will be solved.
Also, the library (as of the moment I write is version 3.13.0) does not support Bitcode yet, thus please turn off Bitcode in Build Options > Enable Bitcode > Select "No". Clean & Rebuild afterwards.
Same problem occurred in my project. What I did, I just updated all my pods and after that my app got compiled.
Run "pod update" command from terminal in your project directory where the pod file is located.
Please make sure you opened .xcworkspace not .xcodeproj.
Go to Library Search Paths in Build settings and
add
$(PROJECT_DIR)/Pods/build/Debug-iphoneos
$(inherited)
pod install again.
Update cocoapods to the newest version that supports 64 arch.
sudo gem update cocoapods
Delete all Valid Architectures and Re-Add the architectures that you just removed.
Clean and run
Without looking directly at your build settings, there's a number of things that could be causing this. The main issue is in your linker flags you likely have something lingering/incorrect. Most of your pods have the prefix of:
-lPods-WhichIt-SomePodsLib
However your GoogleAnalyticsLibrary has the prefix:
-lGoogleAnalyticsServices
This might indicate a lingering flag from your. Try looking for this entry in Other Linker Flags (Under Build Settings) and clear this out and re-running pod install.
Other things to check:
Cocoapods version is latest stable version
You are using the latest version of Google's official Analytics pod
Your library/framework search paths (build settings) are correctly pointing to the analytics library in question.
For the record, I've had issues with pods and using google libs before they officially started releasing in cocoapods. If all else fails, remove the pod entry from your Podfile and try adding the library manually.
I've installed cocoa pods library and some frameworks through it. Now when I compile project the build fails.
Error:
ld: library not found for -lPods-Project
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here part of text:
Ld /Users/polzovatel/Library/Developer/Xcode/DerivedData/Project-bybevfqrgvqqldbzsgewqafpmylj/Build/Products/Debug-iphonesimulator/Project app/Project normal i386
cd /Users/polzovatel/Projects/iOS-master/Project_iPhone
export IPHONEOS_DEPLOYMENT_TARGET=6.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
What I need to do to fix this problem?
Fixed it by deleting the -lPods-Projectname.a in Link Binary (for newer versions, delete the -lPods-Projectname.a under the Frameworks group).
Whenever I execute "pod install" it leads me to spend several hours fixing build errors. So, I deleted CocoaPods stuff and do not have problems any more! Now I am lucky and happy man.
Start using Swift Package Manager (SPM). If your 3rd party lib still do not support SPM I encourage you to take action on adding SPM support on your own. Here is instructions.
Or create an issue for the 3rd party lib about adding support for SPM.
The exact location that you should remove your libs is at:
Remove -lyourlibname.a in "Link Binary With Libraries" on "Build Phases" of your target.
You can try "Build Active Architecture Only" = YES . it may be solving problem.
Ensure that Build Active Architectures Only settings for both of your project and the Pods project were equal for debug and release configuration! That's was a problem in my case.
Make sure Build Active Architectures Only in your Project/Target and in your Pod/Target and Pod are the same.
We often set the debug yes and set the release no.
I realized the xcproject file was opened instead of the updated workspace. This fixed my error. Hope this information will help others too.
If none of the other answers help you, try this:
Deintegrate cocoa pods using pod deintegrate. Check this link https://github.com/kylef/cocoapods-deintegrate.
Search on the build settings for target and project file for "pod". Anything that looks like it belonged to cocoa pods, remove.
Finally, run pod install once again.
Go to Product > Scheme > Edit Scheme... > Build > + > Add the Pods-Projectname.a and drag it to the top > Clean & Build your project.
I had a very different experience. I tried removed the library from build settings to no avail. And honestly, I couldn't see the logic behind it.
What I did was try a new pod install. And so it gave me this error
[!] The ProjectName [Debug] target overrides the LIBRARY_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-/Pods-.debug.xcconfig. This can lead to problems with the CocoaPods installation
- Use the $(inherited) flag, or
- Remove the build settings from the target.
[!] The ProjectName [Release] target overrides the LIBRARY_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-/Pods-.debug.xcconfig. This can lead to problems with the CocoaPods installation
- Use the $(inherited) flag, or
- Remove the build settings from the target.
So I did what it told me to, I added the $(inherited) flag to build settings. And all worked well
In my case I found that a mis-match of deployment target of the Project (iOS 11.4) versus the Target (iOS 10.3). Updating the target to iOS 11.4 fixed the issue.
Project > Info > Deployment Target > iOS Deployment Target
Project > Target > General > Deployment Target > Target
Podfile:
platform :ios, '11.4'
I had this problem when I accidentally opened project instead of workspace so Cocoapods where missing....
Check your Project -> Targets -> Build Phases -> Link Binary With Libraries
Point to your Pods project, set the BaseSDK to iOS SDK since 'pod install' process clear it.
Also set Build Valid Architecture Only to NO
That should work.
I experienced a similar error which affected one of my computers but not the other when compiling the same project.
I reinstalled cocoapods, all gems, rebuilt the project and none of it worked. I finally got it to compile but required me to completely remove Xcode and related data (iPhone simulator, DerivedData) then reinstall Xcode.
I've had this error after adding a new build configuration.
pod install helped, because it adds separate settings for each build configuration.
i also had the same sort of issue. So Check your pod file's platform :ios . and check Deployment info target versions. and please make sure version of both files are same. if both are not same the issue will be executed. i also had the issue after library updating my react native project
(Target info = select your project, then select target, In general section Deployment info is available.)
I am getting the following error when trying to build a project I found on GitHub.
ld: library not found for -lPod
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've heard of some people saying to use the workspace file instead of the workspace file but there is no project file.
Here is the project
My app can run on simulator but can't run on device.
I fixed this by these steps.
The Pods Xcode project now sets the ONLY_ACTIVE_ARCH build setting to YES in the Debug configuration. You will have to set the same on your project/target, otherwise the build will fail.
Ensure your project/target has an ARCHS value set, otherwise the build will fail.
When building a iOS project from the command-line, with the xcodebuild tool that comes with Xcode 4, you’ll need to completely disable this setting by appending to your build command: ONLY_ACTIVE_ARCH=NO.
http://guides.cocoapods.org/using/troubleshooting.html
All my pods project have debug build only active architecture to YES(from pod install), but my project set to NO. So, I change it to YES, then it's work.
This project uses Cocoapods to manage its third party dependencies. Whilst the developer has committed the Pods/ directory, it's probably best to install the Pods yourself:
Install Cocoapods if you don't already have it: sudo gem install cocoapods
cd into the top level project directory, and install the required Pods for this project: pod install
Open the TestOCR.xcworkspace that will be created.
Build and run.
I got it working, all I had to do was simply drag the Pods.xcodeproj into the TestOCR.xcodeproj thanks for the help.
I have encountered this issue couple of times and the common fix is to simply build the Pods target.
The project seems to have bad CocoaPods configuration (or not at all). There is no workspace and no Podfile (which is even worse, because if there's a Podfile you can install CocoaPods by your own and update pods).
You can look into Pods directory and try to create Podfile from scratch (depending on found libraries) and the install CocoaPods. This should work.