eas ios build fails with error you must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE) - react-native

I'm trying to build my react-native expo (46) app with an eas build and get this error:
ld: '/Users/expo/Library/Developer/Xcode/DerivedData/.../FBAEMKit.framework/FBAEMKit' 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. file '/Users/expo/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../FBAEMKit.framework/FBAEMKit' for architecture arm64
saying that I must enable Xcode setting ENABLE_BITCODE.
Is there any way to give this settinh in eas.json or app.json?

As stated in the comments by #brentvatne it's a problem with FBAEMKit that is used by react-native-fbsdk-next (I use the version 11.0.1)
I was able to get rid of the problem adding
"bitcode": "Debug"
in app.json under in the ios part.
(Please note that my IDE gave me an error but it was still valid and I'm now able to build my app)

Related

Xcode 12 Problems: "Build input file cannot be found "- Building for release on a react native app

When I try to do an archive build for "any iOS device", I receive this error:
Build input file cannot be found: '/Users/.../Library/Developer/Xcode/DerivedData/[app]-czrkuohjfzuzxxfobfoyptxhyoyo/Build/Intermediates.noindex/ArchiveIntermediates/[app]/InstallationBuildProductsLocation/Applications/[Product Name].app/[Product Name]'
I received this same error when building for an iOS simulator, but this post fixed it - Problems after upgrading to Xcode 12:ld: building for iOS Simulator, but linking in dylib built for iOS, architecture arm64.
I am also receiving a warning concerning the architectures that may or may not be relatable to the error:
None of the architectures in ARCHS (arm64) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one value from VALID_ARCHS (arm64, armv7s, armv7) which is not in EXCLUDED_ARCHS (arm64).
Build for "Any iOS Device" (for example, "Archive" because you want to upload to AppStore):
Delete arm64 from "Excluded Architectures"
Delete x86_64 from VALID_ARCHS
Add arm64 to VALID_ARCHS
All this changes on both "Build Settings", project and target. And if you want to build for simulator do the inverse path:
Add arm64 to "Excluded Architectures"
Delete arm64 from VALID_ARCHS
Add x86_64 to VALID_ARCHS
That works for me.
So I had the exact same issue. After updating to Xcode 12 I had originally set both my project and target 's 'Excluded Architecture' to arm64 in order to run on Simulator. But, as you mention, that blocks anything from working on Release / Real device. All I had to do was switch to 'Any iOS Simulator SDK = arm64' instead of all of them, see screen shot below:
link to screenshot
This error started happening for me with a SwiftUI app. I didn't need the file for my project, but the settings were set to generate a file anyways. What worked for me was to go into Project Navigator --> App Target --> Build Settings --> Packaging and delete the value (file name) for the Info.plist File key.
This problem wasted a lot of my time after upgrading to xcode 12, using React Native 0.63. Excluding architectures did not work for me.
Symptoms: "build input file could not be found..." when running on device in debug AND release. Simulator worked fine.
To Fix: Editor > Validate Settings... > Perform Changes
Now my app builds fine on device.
I know this question has been answered but this piece of information may help someone: This kind of error may also be produced if you have no node_modules folder e.g. you have deleted it and forgot to re-create it

Building for Mac Catalyst with Crashlytics

Has anybody using Crashlytics been able to compile their iOS app for Mac Catalyst?
I tried building one of our iOS apps for Catalyst but I got the following error:
ld: in /Users/foo/bar/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o), building for Mac Catalyst, but linking in object file built for iOS Simulator, file '/Users/foo/bar/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics' for architecture x86_64
I've updated to the latest version of Crashlytics using Cocoapods. Since CL already works on macOS, I would think it might be possible to link to the correct x86 library with Catalyst.
Previously Firebase Crashlytics was not supported by the Mac Catalyst. In the new version of Firebase Crashlytics (6.15.0), they have provided the support.
This is my current workaround. It does not let me use Crashlytics with Catalyst, but I can continue to create both Catalyst and iOS builds.
Clone your usual build target.
Enable Catalyst on the new target.
Add a section to the Podfile for the new target.
Include all required pods in the new target except Fabric and Crashlytics.
pod install
In the source code, conditionally build Crashlytics-dependent code using #if canImport(Crashlytics)
Continue to build the iOS app from the old target. Use the new target for Catalyst builds.

xcode the file couldn't be opened because you don’t have permission to view it

I have an Xcode project with Cocoa Pods installed which I added a tvOS single view app target. I shared with the tvOS target all the pod installed.
When I build and run my iOS target everything is ok, but when I run the tvOS target I get this error
"ld: library not found for -lAFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
So after searching on the web I found a solution to this error. If I go to the Build Settings for the tvOS target and under Valid Architectures I remove arm64 and type armv7 the error disappears but then when i run the project i get this:
So if I leave the arm64 I get the first error, if I remove it I get the other one...
Someone knows how can I fix it?

Works on Simulator, fails on device: error: WatchKit App doesn't contain any WatchKit Extensions

I am seeing the following error when trying to run a project on a real device, in the simulator it runs fine.
error: WatchKit App doesn't contain any WatchKit Extensions. Verify that the value of NSExtensionPointIdentifier in your WatchKit Extension's Info.plist is set to com.apple.watchkit
Things which may or may not be relevant
I am using cocoa pods in both the watch and main app target
The project is mostly objective-c but has a few swift files
Xcode 8.1 (8B62)
Device Software Versions: iOS 10.1.1 & WatchOS 3.1
Deployment Info > Deployment Target: iOS 10.0 watchOS 3.0
Things I’ve tried
I have checked several times that all the correct files belong to the watch target. I may have missed something here, but I assume it wouldn’t run on the simulator if this was the case
Bundle identifiers
main app’s identifier: < app id >
watch app’s bundle identifier: < app id >.watchkit
watch app’s WKCompanionAppBundleIdentifier: < app id >
watch extension’s bundle identifier: < app id >.watchkit.extension
watch extension’s NSExtension>NSExtensionAttributes>WKAppBundleIdentifier: < app id >.watchkit
NSExtension>NSExtensionPointIdentifier: com.apple.watchkit
WKWatchKitApp is set to YES in both the Watch Extension and the Watch App
I have removed and re-added the .appex from Build Phases>Embed App Extensions
Ensuring Mach-O Type is set to executable in all targets
Re-installing pods as described in this answer
Clearing derived data
Clearing build folder
Restarting Xcode
I tried an archive and this failed with the same error
In lieu of an answer, advice on debugging / troubleshooting this would be appreciated too.
I've seen this intermittently, but usually rebuilding a second time fixed it. I've never got to the bottom of why.
I've always assumed it's a bug in Xcode.
Sorry can't be more help, but you're not alone in seeing this.
I encountered this error, with 3 other errors.
Turned out the problem is that Valid Architectures is set incorrectly. Under Build Settings, make sure Valid Architectures includes i386 and armv7k.
Once that is fixed, the watch extension will be build, and all errors gone.

Worklight 7.1: Build failed due to ENABLE_BITCODE set to YES on the project.

/native/Frameworks/IBMMobileFirstPlatformFoundationHybrid.framework/IBMMobileFirstPlatformFoundationHybrid(WLAFURLRequestSerialization.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
https://developer.ibm.com/mobilefirstplatform/2015/09/09/mobilefirst-platform-support-for-ios-9/
Updating existing apps or submitting new apps on the App Store (with Xcode7 and iOS 9 features)
Review the following sections to learn what actions you need to take so that your app can support iOS 9.
Bitcode
iOS9 introduces a new feature called bitcode, an intermediate code uploaded to the Apple App Store. Apple compiles the bitcode of the application to optimize it for each type of devices. To learn more about bitcode, see the Apple documentation.
At this time, the IBM MobileFirst Platform SDK does not support bitcode. Your application will fail to build with Xcode 7 unless you disable bitcode. If bitcode is enabled, you will see an error message.
Action required
Disable bitcode for your project: In Xcode, select Build Settings > Build Options and set Enable Bitcode to No.