Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'XXX' didn't contain all required architectures - xcode

A friend updated Cocoapods in our project. When I pulled the latest stuff from git I got the following error:
Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'x86_64' didn't contain all required architectures 'i386'
This results in
ld: library not found for -lPods-___PODLIBRARY____
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have searched around for hours now trying to find it. The most common fixes I've tried are..
Deleted derived data
Delete build data
Delete pods, and reinstalled with 'pod install'
Clean project
All of the above at the same time
Experimented with 'Build Active Architecture Only', both in our project and in Pod Project. Inserted armv7 and armv7s as hard code instead of $ variable
Experimented with 'Architectures', both in our project and in Pod Project. Inserted armv7 and armv7s as hard code instead of $ variable
We are aiming for iOS 8, iPhones.
My friend got it to work by combining the first 4 options, but I cannot.
Does anyone have any suggestions? We're supposed to release before christmas so production time is precious :D

Try to set Build Active Architecture Only to NO for 'Pods' project and your app's target

For me, what worked was to change the CocoaPod project "Base SDK" to "Latest iOS".

Try to run the project first on an iPhone 4s in simulator and after that it should work.

What fixed this problem for me was precisely the opposite of the most voted answer:
"Build Active Architecture Only" set to "YES"
both in main target and Pods target + Debug and Release

In my case, it was because I had the "Build Active Architecture Only" parameter set to Yes for Debug mode. Changing it no No fixed it.

Also make sure that your podfile targets the same iOS version your project targets:
For example, if you're targeting iOS 10.0 in your Xcode project your podfile should include platform :ios, '10.0' at the top, too.
Per this solution, which was the problem in my case.

Related

Xcode 5.0.2 dyld: Library not loaded: #rpath/XCTest.framework/Versions/A/XCTest

I have problems running a project in Xcode 5.0.2
I get the following error:
dyld: Library not loaded: #rpath/XCTest.framework/Versions/A/XCTest
Referenced from: /Users/chris/Library/Developer/Xcode/DerivedData/relatio-cwlmozvklaldmictbbjthzuoxnxz/Build/Products/Debug/relatio.app/Contents/MacOS/relatio
Reason: image not found
(lldb)
How do I solve this issue?
It looks like your main target is linking to XCTest.framework as well as your test target. It should only be linked to the main target.
1) Go to Project settings
2) Go to your apps main target -> other linker flags
3) remove '-framework XCTest'
4) make sure the 'other linker flags' field for your test target still contains '-framework XCTest'
I ran into this error by renaming my targets one of which was a testing target. After reading the other answers I realized that my Build Phases > Compile Sources was including test classes as compile sources for non-test targets which then tried to import the XCTest framework.
Removing the test classes from my regular target’s Compile Sources solved this for my case.
I solved this problem this way.
I have edited scheme, at "Build" tab ticked "Run".
The problem here is that, according to the dyld error message you posted, your application is linking against XCTest.framework. That's incorrect; only your test bundle needs to link against XCTest.framework since only your test bundle contains tests.
I had similar problem with OCMock library and solution is:
target :"Application Tests", :exclusive => true do
pod 'OCMock'
end
In my case It was RxTests added by Swift Package Manager to main application target. In pods you decide which Rx components add to which target, but SPM adds it all to main target as default.
This is how I solved the problem:
Navigate to the project's "Build Settings"
Search for "Runpath Search Paths"
Enter the following path in the column below the product name: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/
In my main Target's "Link Binary With Libraries" (under Build Phases), it was the testing framework I was using (Nimble.framework) that was causing the problem. Removed it, and everything's fine!
enter the reference of your framework on framework search path AND
Run path search path under "Build Settings"---...Now all set to invoke your projects by using import
I have same issue is because i add a new file into the framework. So just run "pod install" solved my issue. But make sure your pod under Tests target too.
Just for the ones that came up with the same issue:
Check on the lateral right menu which has to look like that:
And has not have to look like that:
For our case, we want to use Mockingjay for both app target and test target
target 'MyProject' do
pod 'Mockingjay/Core'
# all pods that are not test go here
target 'MyProjectTest' do
inherit! :search_paths
pod 'Mockingjay/XCTest'
pod 'Quick', ' ~> 0.9.2'
# .. all test pods go here
end
end
A solution that worked for me was changing your test target's inherit attribute in your Podfile from :search_paths to :complete.
Although this answer suggests that :search_paths is designed for test environments.
target 'myapp' do
use_frameworks!
target 'myappTests' do
#inherit! :search_paths
inherit! :complete
end
end
I had this error using ios-snapshot-test-case v5.0.2 via Carthage. The problem is related to XCode 11. Apple renamed libswiftXCTest.dylib to libXCTestSwiftSupport.dylib and added XCTest.swiftmodule which has the same symbols in it and can work in place of the old one. But Apple forgot to tell iOS 11.x simulators about this change.
So you need to fix the older iOS version simulators. Here is the terminal command that fixed it for me:
sudo zsh -c ' sourcedir="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib";
targetdir="/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 11.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib";
ln -s $sourcedir/libXCTestSwiftSupport.dylib $targetdir/libswiftXCTest.dylib;
ln -s $sourcedir/XCTest.swiftmodule $targetdir/XCTest.swiftmodule'
See my comment here: https://github.com/CocoaPods/CocoaPods/issues/9165#issuecomment-573523322
Go to General > Targets (Left side).
You might have 2nd item containing the word test/s. Click it.
In this general settings > Testing > Host application > Select from options (your app name). That's it!

Integration error with Cocoapods and XCode5

When building my project in the new XCode5, I receive the following warning: Pods-App was rejected as an implicit dependency for 'libPods-App.a' because its architectures 'i386' didn't contain all required architectures 'x86_64'.
To fix that, select the Pods project in the left menu, then under the targets section select the Pods-#YourAppName# target and in the build settings click on the Architectures and press delete so it goes to the default option (Standard architectures (armv7, armv7s). More information can be found in this link.
Non of the other answers worked for me.
What eventually solved it for me is to make sure Build Active Architecture Only is set to Yes for Debug and No for Release in my app's xcodeproj file.
Also, because I have custom configurations, I had to add the following to the Podfile:
xcodeproj 'MyApp.xcodeproj', 'MyDebugConfiguration' => :debug, 'MyReleaseConfiguration' => :release
Take a look at the blog post here, it will do the work.
To make your Applications compatible for iPhone 5s and older models (till iPhone 3Gs running iOS6), select the following option for your architectures – “Standard Architectures – armv7, armv7s”. Do not select the option that says “Standard Architectures (including 64 bit)…”. Since the Arm instruction sets are backward compatible, any application compiled for armv7s will also run on the iPhone 5s or the iPhone 5c.
ARCHS = armv7 armv7s
For valid architectures in the build settings, you can specify arm64,
armv7, armv7s.
VALID_ARCHS = armv6 armv7 armv7s arm64
env:
CocoaPods v0.24.0
Xcode 5 from App Store
Add the following at the end of your Podfile.
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ARCHS'] = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"
end
end
end
Go to Project "pods", set "build active architecture only" to NO for debug.
Above solution is working for me.
I have just upgraded one of my projects to Xcode 6 and experienced this problem. To fix it, I changed the Base SDK of the Pods project to a real one (previously it was like unknown SDK).
I had this same issue. The warning suggested that the pod library was not included and as a result, the app failed to finish compiling. (It complained about a missing header file that was part of a Pod dependency).
If you are experiencing the same compilation issue, you might be able to resolve it with the following:
Select Pods project in the workspace
Select Pods project to
access Pods project-wide settings
Go to Build Settings
Search
for 'Build Active Architecture Only'
Set to 'NO'
This seemed to work for me, but YMMV.

Link error attempting to build app with Cocoapods using xcodebuild on Jenkins

I'm trying to set up a Jenkins CI instance for our app development project. I have jobs working that run logic and application tests using the Debug configuration but I'm struggling to build the IPA as I get a linkage error during compilation.
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The app uses Cocoapods and I'm building with the Jenkins XCode plugin.
I searched for similar problems and tried/verified a bunch of things:
I am using a workspace.
I'm running pod install before the xcodebuild step.
I've checked that architectures on the project itself, the target and Pods are the same – standard (armv7, armv7s) – as suggested by this answer
I tried various solutions from this GitHub thread
I tried various settings for Derived Data locations as per this answer and similar ones
The Podfile specifies platform :ios, :deployment_target => "6.0"
At that point I'm at a loss for what more to try.
The 'Build Output Directory' setting can also cause this.
Changing the value of the 'Build Output Directory' from a relative path to a fully specified path fixed it for me.
E.g. instead of 'MyOutputDirectory' use '/Users/Shared/Jenkins/home/jobs/JenkinsProject/workspace/MyOutputDirectory'
The problem might be because you have different (custom) build configurations.
Take a look at this:
https://github.com/CocoaPods/CocoaPods/issues/121
Try adding following search path to "Library Search Paths" (For all configs)
$(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME)
You can try choose your Pods project and set Build Settings->Build Active Architectures Only->NO for Release and Debug, repeat this action for each target in Pods.
I can't speak to the XCode plugin, so my answer may be considered somewhat unresponsive, but here is how I got it working.
I added a build step that looks like this:
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
echo $WORKSPACE
cd "/Users/[jenkins-accountname]/.jenkins/jobs/[jobname]/workspace/[xcode project name]"
pod install
xcrun xcodebuild -workspace [your workspace (not project) name] -scheme [the build scheme to build] clean build -destination "platform=iOS,name=CurtsiPhone" -destination-timeout 120
The -destination and -destination-timeout were key build arguments for success. My project will only build on the phone since it uses specialized libraries, so my phone has to be plugged in so the XCode can find it. You may not need this if your project will build in the simulator, however I only got it working when I explicitly specified a destination.
If the XCode plugin allows you to state extra compile arguments, you should try these.
If you're using XCode 5 then I think this should help
basically update your Gemfile (or create one if it doesn't exist) and add:
gem 'cocoapods', :git => 'http://github.com/CocoaPods/CocoaPods', :branch => 'xcode-5-support'
gem 'xcodeproj', :git => 'http://github.com/CocoaPods/Xcodeproj', :branch => 'redacted-support'
Also if you have things like config.build_settings['ARCHS'] = 'armv7' in your Podfile, don't forget to get rid of it, you'll need to have armv7s too.
Hope this helps, cause it saved me a few days of nightmare.

Xcode 4.5 no such file or directory - libCordova.a

clang: error: no such file or directory: '/Users/admin/Library/Developer/Xcode/DerivedData/__TESTING__-fzbkvdbnndieeagphtjhdndiyttl/Build/Products/Debug-iphoneos/libCordova.a'
How do I get this a missing libCordova.a ?
(source: kerrydeaf.com)
UPDATE: For Simon Germain.
UPDATE: For Simon Germain. I don't see "Identity and Type". I can see "Identity". I'm using xcode 4.5
(source: kerrydeaf.com)
UPDATE: For Simon Germain. I got the Identity.
(source: kerrydeaf.com)
UPDATE: For Samuel
(source: kerrydeaf.com)
UPDATE: For Simon Germain - Architecture.
UPDATE: For james0n - armv.
(source: kerrydeaf.com)
UPDATE: For Simon Germain - Architecture.
UPDATE: For james0n - armv.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CDVURLProtocol", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
_OBJC_CLASS_$_MainViewController in MainViewController.o
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
UPDATE: For james0n - Valid Architecture.
(source: kerrydeaf.com)
UPDATE: It is now solved!!! make sure all armv7 and armv7s for ios 6 on all in xcode. It worked.
For your project, set the build setting "Build Active Architecture Only" to yes.
(Maybe also set the the Architectures build setting to "Standard (armv7, armv7s)" for CordovaLib project.)
Had (as many others) the same problem, here's what I did:
Redid the Getting Started guide from Phonegap (including downloading
and extracting the source again)
Same problem with the HelloWorld app
product - clean
Changed both the 'HelloWorld' and 'CordovaLib'-project (so not the Targets) according to james0n's answer, settings:
Architectures: Standard (armv7, armv7s)
Build Active Architecture only: Yes
and then it magically worked, I think steps 3 and 4 did it however.
Only need to remove armv6 from both YourProject and CordovaLib:
The consequences of doing this? Apparently, it's still working on iPhone 3GS, but not the previous versions..
I had the same problem as you, worked fine deployed to the simulators but not to a device. Neither of the suggested answers worked for me.
Here's what did work for me:
Set deployment target to v4.3 and on the project settings for the CordovaLib project, set the Build Active Architecture Only to Yes. (Not needed on your main project).
Important, do a Product-> Clean and rebuild.
Make sure that the CordovaLib's product's target is set to "Relative to Built Product" on the right hand-side panel, first tab on theleft, under "Identity and Type".
Download the Cordova installer from here http://phonegap.com/download. Make sure it is the same version that you are currently using (ex 2.0).
Then mount the dmg found in the ios directory.
Then run the .pkg installer.
Restart Xcode.
You gotta run the update script, I know it might be a pain in the butt to do it, but that's what it takes.
Download and open the Phonegap 2.1 package from the official site. Open a terminal window, and cd to the installation directory
You'll need to first create a new project:
./create [project_folder_path] [package_name] [project_name]
Then you need to set the path to your libraries.
/update_cordova_subproject [xcodeproj file]
Now open up your project and set the deployment target to 4.3 and you should be ready to go. Hope that helps
EDIT:
This is how my configuration looks like for CordovaLib Project
Also - make sure you don't have more than one PhoneGap Xcode project open at a time - I was getting conflicts between the two. "Workspace already open in another workspace" type of loop.
After spending many hours with even more errors, here's what worked for me. Basically combining much of the above:
Start with a fresh copy of Cordova. If you've been messing with it like me, it's not fresh anymore.
Move the Cordova files out of the download directory (I tend to clean that directory now and then...)
Create a new project as described in the Phonegap docs, i.e. drag the ios/bin folder to the Terminal icon and run the create script in Terminal. No need to run the update_cordova_subproject script.
Open the project in XCode.
For your product, set the iOS Deployment Target to 4.3 (I did it 2x, both in Project and Target Build Settings).
For CordovaLib.xcodeproj, set Build for Active Architecture to Yes in the Project Build Settings.
Clean and run.
Do not include armv7s in any of the architecture lists, as it will not build for device.
Tested in simulator and on an iPad with iOS 6. Using Phonegap 2.1.0 and XCode 4.5.1.
Update: if you want to support iPhone 5, you will need armv7s. It requires the fix in https://issues.apache.org/jira/browse/CB-1360 , which will be in Cordova 2.2.0. (Haven't tried it yet, working on an iPad project.)
I fixed this by removing the armv6 and i386 architecture from Valid Architecture setting
I had this problem too. I think it was because I had previously installed an old version of phone gap that installed some stuff in xcode. I uninstalled, then reinstalled xcode. Then I ran the Uninstall Cordova.applescript that came with phone gap. This fixed the problem of the red libCordova.a
In addition to several other suggestions & post, I found that I was experiencing this problem on my AdHoc builds only. Please note that I figured this out during debugging because if I set the Edit Scheme > Archive build configuration to "release" it would work OK, but if set to AdHoc it would give me a link error, telling me that this file could not be found:
/Users/jason/Library/Developer/Xcode/DerivedData/MommyNearest-ceourmykvgxdekbkmzenuvhcfnzk/Build/Intermediates/ArchiveIntermediates/MommyNearest/BuildProductsPath/Adhoc-iphoneos/libCordova.a
This was actually a good clue to what the problem was, which was that somehow the CordovaLib subproject did not have an AdHoc configuration (it had ONLY "Debug" and "Release" configurations).
Therefore, when building for an AdHoc release (to use with Testflight) it would not create a symlink for this file correctly. Once I added an "AdHoc" configuration to the CordovaLib subproject, this started working.

Upgrading to xcode 4 error No architectures to compile for

I am getting an error after upgrading to xcode 4, for all of the library projects that my application depends on.
[BEROR]No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=i386, VALID_ARCHS=armv6).
It looks like all you have to do is add i386 to the Valid Architectures in the build settings. I was compiling for the simulator, and that's why it was complaining.
This seems odd, because the project worked just fine before upgrade. It looks to me like you have to do this for any project you upgrade. At least that will work for now.
See https://devforums.apple.com/message/376732#376732
"No architectures to compile for" means "Valid Architectures" field is empty. Update it to $(ARCHS_STANDARD_32_BIT) and you'll see the usual armv6 armv7. This happens sometimes in XCode 4 GM after updating "Base SDK" to "Latest SDK".
Open project.pbxproj (show package content of xcodeproj file), remove all lines with VALID_ARCHS = "...";, and restart Xcode.
Very strange. I encountered the same error and both the Debug and Release "Valid Architectures" were set to armv6 and armv7. (The same code compiles fine in Xcode 3.2.) I ended up deleting both settings, then expressly setting them to $(ARCHS_STANDARD_32_BIT) ... which in turn translates to armv6 and armv7 again ... and it compiles just fine now. No i386 needed. Hmm ...
If this error occures in combination with Phonegap the solution is:
Add "i386" in the build settings to the "Valid Architectures": for your project and the library (PhoneGapLib.xcodeProj). In both cases for the project and the target.
I was getting this error when I was trying to convert to automatic reference counting in the latest Xcode. I fixed it by adding "x86_64" to the valid architecture list, which allowed me to continue building.
Just in case someone else was having the same issue, thought I'd throw in what worked for me!
Had similar issues with xcode6 it seems to pop when upgrading xcode, tried all of what is suggested with no success what worked for me was in the new xcode created a simple new app(tabbed) and made sure my App had the same settings for architectures
Open a new project and compile in Xcode 4 and then compare build settings with converted project. That's how I found it.

Resources