Actually my project does compile for an iPhone 6s but not for any iOS simulators. When I want to build for a simulator I get two build time errors.
Errors
'CocoaLumberjack/CocoaLumberjack.h' file not found
and
failed to emit precompiled header
'/DerivedData/Project/Build/Intermediates.noindex/PrecompiledHeaders/Bridging-Header-swift.pch'
for bridging header
'/Users/Development/ProjectMobile/Views/Project-Bridging-Header.h'
What have I tried yet?
pod deintegrate, clear Build, delete "DerivedData", pod install and pod update
open Project.xcworkspace instead of Project.xcodeproj
keep target iOS version in podfile and deployment target the same (iOS 12)
check "Framework Search Paths" at targets build settings 1
check "Header Search paths" 2
I am not 100% sure if the paths are correct. And I am wondering that Xcode can't find Cocoalumberjack.h, because I can find it under /Pods/CocoaLumberjack/Sources/CocoaLumberjack/Supporting Files/CocoaLumberjack.h.
Questions
Are these paths probably incorrect?
What else could be the problem?
I am happy for every serious answer!
(1) Framework Search Paths
(2) Header Search paths
Xcode couldn't build the project for an iOS simulator because there was no valid CPU architecture set for the simulator (respectively for the Mac).
Under Project > Targets > User-Defined > VALID_ARCHS there were just armv7, armv7s and arm64 architectures set.
I added x86_64 architecture to the VALID_ARCHS and it works fine now.
Related
Our iOS project is built successfully in Xcode 11. However, on Xcode 12, it shows an error like this:
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/NgoHoangLien/Library/Developer/Xcode/DerivedData/BeneKitten-asctqxwawireafgebpjujkfxjvcg/Build/Intermediates.noindex/BeneKitten.build/Debug-iphoneos/BeneKitten\ Dev.build/Script-6F989132ECCA2B13FEF9458F.sh (in target 'BeneKitten Dev' from project 'BeneKitten')
cd /Users/NgoHoangLien/Project/Benekitten-iOS
/bin/sh -c /Users/NgoHoangLien/Library/Developer/Xcode/DerivedData/BeneKitten-asctqxwawireafgebpjujkfxjvcg/Build/Intermediates.noindex/BeneKitten.build/Debug-iphoneos/BeneKitten\\\ Dev.build/Script-6F989132ECCA2B13FEF9458F.sh
sent 1868986 bytes received 70 bytes 3738112.00 bytes/sec
total size is 1868525 speedup is 1.00
/Users/NgoHoangLien/Project/Benekitten-iOS/Pods/Target Support Files/Pods-BeneKitten Dev/Pods-BeneKitten Dev-frameworks.sh: line 144: ARCHS[#]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code.
I followed guides on the internet to make "arm64" for EXCLUDED_ARCHS. Delete VALID_ARCHS. But it still cannot compile. I hope you the senior engineers, experts like you can help me.
Note :- React native developers
After wasting couple of hours only solution that worked for me was
Open VSCode and go to directory ios/App/App.xcodeproj/project.pbxproj that file
and perform a search EXCLUDED_ARCHS
EXCLUDED_ARCHS = arm64;
and delete everyline containing EXCLUDED_ARCHS
For Xcode 12.3, when there is no VALID_ARCHS property, follow below steps:
Build Settings -> Build Active Architecture Only -> Debug -> Yes
Add "arm64" in "Excluded Architectures" in build settings of both project and pods project, to run the app in simulator. Remove it while making build on device or archiving the app.
You may try below steps:
In Main Project(Not TARGETS), Go to build settings and add Simulator-iOS 14.0 SDK with value arm64 inside Excluded Architecture and repeat the same for the Pod project too.
Delete VALID_ARCHS from your Main project and Pod project both.(You may open the project file in editor to delete this) [You already did this ✅ ]
Upgrade all Pods to the latest version available.
Last, Clean Project and Re-Build.
I got this error in my React Native app and finally found the issue and the fix.
Initially I added the arm64 for all 4 like this in Build Settings -> Architectures -> Excluded Architecture. And this was my issue.
But it should be like this. Only for Any iOS Simulator SDK in both Debug and Release.
Then my error fixed.
I think this will help you. Happy coding!
In my case for Xcode 13.1, Here's what I did:
Build Settings -> Build Active Architecture Only -> Debug -> No (both project and pods project)
Remove the "arm64" in "Excluded Architectures" in build settings of both project and pods project.
I was running on my real device if you try with simulator you might need to do the opposite
In our case, we needed to add x86_64 to VALID_ARCHS to build on simulator.
Make sure that in your
Project -> build settings -> Excluded Architecture
and
Pods -> build settings -> Excluded Architecture
The same values.
In my case, this soap is due to in Project architecture was arm64 but in Pods nothing
Just remove arm64 from Excluded Architecture if you start Archive or installing on real device
All the answers here are probably wrong for your project, and have the potential of breaking your project. You can only remove excluded archs completely if all your pods use xcframework and are ready for the arm64 simulator architecture.
The correct answer is to remove excluded archs from directly to the right of "Debug" and "Release", and add arm64 for excluded arch for "Any iOS Simulator SDK" only:
Adding arm64 as an excluded arch directly to the right of "Debug" and "Release" will exclude arm64 for the physical iOS device, and all physical iOS devices are arm64, hence why the build cannot be packaged.
The Build Settings editor no longer includes the Valid Architectures build setting (VALID_ARCHS), and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED_ARCHS). If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor. (15145028)
-> https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes
It works for me by removing VALID_ARCHS lines on my project.pbxproj
you need to open this page and delete excluded architectures inside debug and release section if it is default arm64 delete it!
clean your project (cmd + shift + k)
clean derived data (dev.cleaner)
and restar your mac
I've got the same issue here.
I want to launch the application either on a connected device or on a simulator. And I get the error ARCHS[#] unbound variable trying to use the simulator.
Steps to fix the issue:
Choose the architecture either x86_64 for the simulator or arm64 for the device picture 1
Check VALID_ARCHS list contains the target architecture picture 2
Launch pod install command (the step propagates the right architecture to the pod-generated Xcode projects)
Build and launch the application
In build-settings, set VALID_ARCHS to $(ARCHS_STANDARD).
i had the same issue once we converted to XCFramework,
fixed by(still not for debugging and only for archiving)
1.build active architecture only - YES
2.remove arm64 from excluded architecture( if it was given)
3.valid_archs - arm64 (only arm64 )
after that i am able to build successfully on "any device"
I am directly linking PLCrashReporter in my iOS app without using any external tool and now when I try to compile it on Xcode 7 I get link error:
ld:
'.../CrashReporter.framework/CrashReporter(libCrashReporter-iphoneos.a-armv7-master.o)'
does not contain bitcode. You must rebuild it with bitcode enabled
(Xcode setting ENABLE_BITCODE), obtain an updated library from the
vendor, or disable bitcode for this target. for architecture armv7
Where do I get the updated framework or the sources to compile them with bitcode enabled and get rid of the error without disabling bitcode for the full project?
I ended up addressing this by building PLCrashReporter 1.2.1 from source. This version is the minimum that has had Xcode 7 and iOS9 fixes merged.
The source is obtained from here: PLCrashReporter 1.2.1
Unzip the downloaded 1.2.1 source into a folder.
Pull the Xcode project inside that folder up within Xcode and add the following to the Custom Compiler Settings "Other C Flags" section of the project build settings: -fembed-bitcode
Next add the following to the Custom Compiler Settings "Other Warning Flags" section of the project build settings: -Wno-error=unused-command-line-argument
Then close the project from the Xcode GUI. The custom settings are necessary because we are going to build from the command line using xcodebuild to avoid the PLCR deprecation errors, and when doing so the default is only -fembed-bitcode-marker when building a framework this way. We are overriding the default behavior, and need to suppress the hard stop warning this causes.
Lastly, from a terminal window prompt within the folder where the zip file of the source including the xcode project file is located run the following:
xcodebuild -configuration Release -target 'Disk Image'
This will run the build and leave the framework in ./build/Release/PLCrashReporter-1.2.1/iOS Framework
Now, these steps will produce a bitcode enabled framework, but third party crash reporting is incompatible with bitcode (when the App Store recompiles you have no way to get the symbol file from that on the fly build).
There is 2 options.
1. Download PLCrashReporter sources and compile it whit bitcode enabled, and use that in your project.
2. Disable bitcode for your target
Go to your target's Build Settings tab, search for Enable Bitcode set value to NO.
This worked for me, in order to include Rollbar framework in my project:
Within my workspace, I first select my project from the Project Navigator -> my project's target -> Build Settings -> Enable Bitcode = NO
Then I select the PODS from the Project Navigator -> Rollbar Target -> Enable Bitcode = NO
Experienced same issue. I built the crash reporter framework from source using
https://www.plcrashreporter.org/code
Open it in Xcode
Select the 'CrashReporter' target with the red bullseye.
Build it
Then search in ~/Library/Developer/Xcode/DerivedData/CrashReporter-xxxxxxx to get the .framework bundle
Unfortunately the issue presented itself again. Also when I try to compile again I get:
ld: warning: object file
(/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(cf.o))
was built for newer OSX version (10.6) than being linked (10.5) ld:
warning: object file
(/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o))
was built for newer OSX version (10.6) than being linked (10.5)
Moreover if I set enable bit code at the project level I get an immediate error:
target 'CrashReporter-MacOSX-Static' has bitcode enabled (ENABLE_BITCODE = YES), but it is not supported for the 'macosx' platform
What should I do to produce the framework with bitcode enabled?
I have an iOS project that has iOS 6.0 as a deployment target. It builds fine both under Xcode and xcodebuilder (necessary for CI). However the client now wants the project to only be available for users who have iOS7+ installed.
No problem, I'll just increase the deployment target number right? Wrong!
Under Xcode the project continues to compile just fine. Under xcodebuild however, the project fails to compile with lots of errors like this:
Undefined symbols for architecture armv7:
"std::string::_Rep::_S_empty_rep_storage", referenced from:
in drmNativeInterface
It's using Adobe Primetime and drmNativeInterface is part of that.
To help isolate the problem I've created a brand new, single-screen project and performed the following changes:
Added the drmNativeInterface framework and the two Apple-supplied dependencies that are required for the project to build in Xcode, MediaPlayer and AVFoundation to "Link Binary with Libraries". The Primetime documentation lists other dependencies as well but it makes no difference if I add those - these are the only 2 that are needed for a successful build under Xcode.
Replaced the valid archs "arm64 armv7 armv7s" with "armv6 armv7 armv7s" (even though drmNativeInterface apparently contains i386, x86_64, armv7s and arm64 slices, even Xcode won't compile the project unless I switch arm64 for armv6).
Set "Build Active Architecture Only" to NO for both configurations.
And finally, added "-lstdc++ -ObjC -all_load" to "Other Linker Flags".
Other than those few steps above, the project is stock single-screen: no code has been added.
Xcode will compile it but xcodebuild will not. For xcodebuild to compile it I have to switch the deployment target to 6.0 which defeats the client's request.
The CI xcodebuild command contains a few params but here's the minimised command I'm using for this test project:
xcodebuild -project "MyProject.xcodeproj" -scheme "MyProject"
I've tried adding FRAMEWORK_SEARCH_PATHS, HEADER_SEARCH_PATHS and ALWAYS_SEARCH_USER_PATHS params in case xcodebuild was simply unable to use the paths contained within the project file but that made no difference.
If I remove the drmNativeInterface framework from the project - leaving the 2 Apple-based dependencies alone - the project compiles just fine for both Xcode and xcodebuild. But obviously this isn't a solution because I need that framework!
Does anyone have any idea what could be causing this or how to fix it?
**NB: **
There are a lot of questions on SO where projects will build in Xcode and not in xcodebuilder, but I couldn't find any where a project will build in xcodebuilder just fine for one deployment target and not for another.
Thanks in advance.
Linking the libstdc++ library (in this case, libstdc++6.dylib to be exact) fixed the problem.
You lose the libstdc++6.dylib in Link Binary With Libraries
Just add it like :
After updating to Xcode 5.1, I can no longer build my project for the 64-bit simulator, receiving this error:
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).
These are my target build settings:
I tried changing "Build Active Architecture" to No, as well as adding "i386" to the "Valid Architectures", unfortunately neither worked.
Thanks for any suggestions!
What you need to do is just set the ONLY_ACTIVE_ARCH to NO (at least works for me). Below is a screenshot for it:
EDIT:
As far as I know (please point it out if there's something wrong, thanks), if you set ONLY_ACTIVE_ARCH to YES, it means the Xcode will only build for the active architecture (which refers to the device that's active in Xcode currently). Seems Xcode's default setting is set Debug to YES, so it won't build binaries for other architectures when you only want to build for a special device that connected to your Mac.
The reason failed to build might be that, the project does not support the architecture of the device you connected. So the best solution is to add the right architecture for your device. Below is a list for architectures & the devices that support:
ARMv8/ARM64: iPhone 6, iPhone 5s, iPad Air, Retina iPad Mini
ARMv7s: iPhone 5, iPhone 5c, iPad 4
ARMv7: iPhone 3GS, iPhone 4, iPhone 4S, iPod 3G/4G/5G, iPad, iPad 2, iPad 3, iPad Mini
ARMv6: iPhone, iPhone 3G, iPod 1G/2G
So why "set the ONLY_ACTIVE_ARCH to NO" works? Because the device can still run the binary that built for all architectures you added (pass the build), but will lose some performance. This's just a quick solution, but not best.
Note: The more architectures you added, the bigger the binary will be generated. So it's good to choose right architectures for your project. ;)
I had the same error message after upgrading to XCode 5.1. Are you using CocoaPods? If so, this should fix the problem:
Delete the "Pods" project from the workspace in the left pane of Xcode and close Xcode.
Run "pod install" from the command line to recreate the "Pods" project.
Re-open Xcode and make sure "Build Active Architecture Only" is set to "No" in the build settings of both the "Pods" project and your own project.
Clean and build.
Add arm64 to the target's valid architectures. Looks like it adds x86-64 architecture to simulator valid architectures as well.
If you are using CocoaPods, the most likely problem is because your Pods project Build Settings for Build Active Architecture Only is set to Yes for Debug.
The solution is simple. Change it to No.
Similarly, change to No for your application project.
I had similar issue. Got it solved by changing "Architecture" to "$(ARCHS_STANDARD_32_BIT)" in Build Settings for Project.
Now, you have to select Standard architectures (armv7, arm64) - $(ARCHS_STANDARD) since apple recommends apps to be build on 64-bit architecture. Click : Apple document
Add:
Architectures: $(ARCHS_STANDARD_INCLUDING_64_BIT)
Valid architectures: arm64 armv7 armv7s
Just in case, for anyone still encountering the issue despite following the above, check that the simulator you are running is also the supported one. I had mine specified to arm7 and arm7s but was trying to run the app on a 64 bit simulator.
To avoid having "pod install" reset only_active_arch for debug each time it's run, you can add the following to your pod file
# Append to your Podfile
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end
Just add arm64 in valid architecture.i hope it will work for you.
My problem was that the Pods project was targeting OS X, despite my Podfile having platform :ios. I'm using cocoapods 0.35.0.rc2.
To fix it, select the Pods project in the project navigator, and check that the Pods PROJECT node (mind you, not the Pods target) is targeting iOS. That is, the architectures build settings should be:
Architectures: $(ARCHS_STANDARD)
Base SDK: iOS 8.1
Supported Platforms: iOS
Valid architectures: $(ARCHS_STANDARD)
I also wanted to build all architectures, so I added the following to the Podfile:
post_install do | installer |
installer.project.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
I had to add the following i386 and x86_64 to Valid Architectures. I'm running Xcode 7.2 and targeting iOS 8+. I already had armv7, armv7s and arm64 in there and that was working in Xcode 6.4.
I faced the same problem when running my app on iPad using xcode 5.1. It got resolved by removing armv7s from 'valid architectures' and setting the 'build active architectures only' value to No. Both these fields can be found in your app->targets->build settings->architectures.
I arrived at this question due to a problem with command line build for simulator in Xcode 7.2. In case anyone else gets here with the same issue, I will share the solution I found:
Apparently there is a bug in Xcode 7.2 that causes xcodebuild to fail when trying to build for simulator. The solution is to specify the option "-destination", e.g:
xcodebuild -project TestBuildCmd.xcodeproj -scheme TestBuildCmd -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' build
Update
The above example command will build a binary including the graphics for iPhone 6 only. If the binary is run on other simulators, the iPhone 6 graphics is scaled to the platform. A better workaround which contains all graphics for all platforms is to specify the parameter PLATFORM_NAME=iphonesimulator, for example:
xcodebuild -project TestBuildCmd.xcodeproj -scheme TestBuildCmd -sdk iphonesimulator -arch i386 PLATFORM_NAME=iphonesimulator build
Try removing all previous architectures (i.e. remove the ARCHS_STANDARD setting) at the same time as you add i386 to the Architectures. This should change the active architecture to i386. I encountered a similar issue when I tried to build for armv7 by default, but it kept trying to build for arm64. I changed ARCHS_STANDARD to ARCHS_STANDARD_32_BIT, and this changed the active architecture chosen.
In acrhiecture - sometimes to support 6.0 and 7.0 , we exlude arm64
In architectures - > acrchitecture - select standard architecture arm64 armv7 armv7s.
Just below in Valid acrchitecture make user arm64 armv7 armv7s is included.
This worked for me.
I solved this problem using #Kjuly's answer and the specific line:
"The reason failed to build might be that, the project does not support the architecture of the device you connected."
With Xcode loaded it automatically set my iPad app to iPad Air
This caused the dependancy analysis error.
Changing the device type immediately solved the issue:
I don't know why this works but this is a very quick answer which saved me a lot of fiddling around in the background and instantly got the app working to test. I would never have thought that this could be a thing and something so simple would fix it but in this case it did.
I found that it was necessary to enter the architecture names by hand:
I don't know why this was necessary, i.e. why these values were not inherited from Xcode itself. But as soon as I did this, the problem went away.
In Valid architectures: Select each entry (release, debug) and build and press backspace. It should work
I'm attempting to convert an iOS (pure Objective-C) project to ARC. The conversion fails at the octest target CreateUniversalBinary stage with the following error. The project and target architecture build settings look correct to me so I am struggling to understand why this is failing:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: can't figure out the architecture type of: /Users/andybowskill/Library/Developer/Xcode/DerivedData/Make-Up_Kit-axtbxqtkmnlfmlcafkoetwqmeufc/Build/Intermediates/Make-Up Kit.build/Debug-iphoneos/Make-Up KitTests.build/Objects-normal/armv7/Make-Up KitTests
Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo failed with exit code 1
The aforementioned CreateUniversalBinary command is as follows:
CreateUniversalBinary "/Users/andybowskill/Library/Developer/Xcode/DerivedData/Make-Up_Kit-axtbxqtkmnlfmlcafkoetwqmeufc/Build/Products/Debug-iphoneos/Make-Up KitTests.octest/Make-Up KitTests" normal "armv7 armv7s"
cd "/Users/andybowskill/Development/iOS/Make-Up Kit"
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
lipo -create "/Users/andybowskill/Library/Developer/Xcode/DerivedData/Make-Up_Kit-axtbxqtkmnlfmlcafkoetwqmeufc/Build/Intermediates/Make-Up Kit.build/Debug-iphoneos/Make-Up KitTests.build/Objects-normal/armv7/Make-Up KitTests" "/Users/andybowskill/Library/Developer/Xcode/DerivedData/Make-Up_Kit-axtbxqtkmnlfmlcafkoetwqmeufc/Build/Intermediates/Make-Up Kit.build/Debug-iphoneos/Make-Up KitTests.build/Objects-normal/armv7s/Make-Up KitTests" -output "/Users/andybowskill/Library/Developer/Xcode/DerivedData/Make-Up_Kit-axtbxqtkmnlfmlcafkoetwqmeufc/Build/Products/Debug-iphoneos/Make-Up KitTests.octest/Make-Up KitTests"
Please could someone help to explain the error? Many thanks in advance!
Removing "armv7" from "Valid Architectures" in the Target (leaving only "armv7s") solved this for me. My iOS Deployment Target is 4.3.
Adding "armv6" to "Valid Architectures" in the Target and updating my iOS Deployment Target to 6.1 did not work.
Encountered while converting to Objective-C ARC in XCode Version 4.6 (4H127)
I trawled my project build settings again and noticed that I had removed armv6 architecture support but still had the deployment target set to an iOS version less than 4.3. Updating the deployment target to iOS 4.3 or above resolved the problem.
I also encountered same problem while migrating to ARC from NON-ARC. and after digging and banging head I come to know 2 solutions
Add armv6 in valid arch's in target, OR
Set build Active Arch. only to NO.