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 have a react-native app that is building successfully when I run it from react-native run-ios AND when I run it from Xcode, as long as I'm targeting an emulator.
However, when I change the target device to my attached Iphone, Xcode fails with the generic error
"clang: error: linker command failed with exit code 1 (use -v to see invocation)"
Builds fine when targeting emulator , but fails if I target real device?
Any ideas on what could be wrong or general direction to look to debug?
Error is 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 arm64
If you don't use bitcodes, don't use them.
Build Settings -> Build Options 'Enable Bitcode' is present.
Please change it to NO.
Environment
Xcode 7.1
OS X 10.11.1
Archiving iOS with minimum target requirement 8.0
Podfile
pod "WeiboSDK", :head
Error Message
ld: bitcode bundle could not be generated because
'/Users/XX/code/iOS/Pods/WeiboSDK/libWeiboSDK/libWeiboSDK.a(WBSDKNormalWebViewController.o)'
was built without full bitcode. All object files and libraries for
bitcode must be generated from Xcode Archive or Install build for
architecture armv7 clang: error: linker command failed with exit code
1 (use -v to see invocation)
It's OK when building, but will fail when archiving
download latest version of WeiboSDK. It supported bitcode
weibo_ios_sdk
1.If your app doesn't need bitcode (for Apple Watch).you should check you settings:
PROJECT/TARGETS -> Build Settings -> Enable Bitcode -> NO
2.If you need the Bitcode enable in your project,you should import the newest SDK from Weibo which has been build by Bitcode enabled.
The problem you have met is that if you want to enable your Bitcode in your project,the library in your project must be build by "Enable Bitcode".
About Bitcode,the official documentation here:
https://developer.apple.com/library/prerelease/watchos/documentation/IDEs/Conceptual/AppDistributionGuide/AppThinning/AppThinning.html#//apple_ref/doc/uid/TP40012582-CH35-SW2
The "Bitcode" is one of the adaption details of iOS 9.0 or above.You should pay attention to this.Here is a good repository on Github for iOS 9 adaption details collection:
https://github.com/ChenYilong/iOS9AdaptationTips
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 been developing my app on top of the Cordova 2.9 framework and it builds fine on the iPhone simulator and also builds fine on my devices. When I try to "archive" it to submit to the app store it throws these errors:
I don't understand why it builds and runs fine but won't archive for the store. I also tried to archive Cordova 2.9 right out of the box so to speak without any of my files in it and it still fails with these errors. Does anyone know how to fix these errors?
I have tried things like
Change "Build Active Architecture Only" to "YES"
Go to project settings and Build Tab.
Search for "Other Linker Flags"
Double click on the linker flags for Release and Change ${TARGET_BUILD_DIR}/libCordova.a to ${BUILT_PRODUCTS_DIR}/libCordova.a
Do the same for Debug Clean and build archive again
Those haven't worked.
Thanks.