expo: iOS build failed after upgrading to sdk 44(x86_64-apple-ios-simulator not found)
Summary
I recently upgraded expo sdk to 44.0.4 (Thanks to @Kudo in #15749 ) And the previous error has gone lovely, however, different error occurred.
The error message is :
/Users/(userName, projectPath)/ios/Pods/Target Support Files/Pods-(projectName)/ExpoModulesProvider.swift:8:8: Could not find module 'ExpoModulesCore' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator, at: /Users/(userName)/Library/Developer/Xcode/DerivedData/(projectName)-fpsfqwuotwecxtbofsfpimvwsbrn/Build/Products/Debug-iphonesimulator/ExpoModulesCore/ExpoModulesCore.framework/Modules/ExpoModulesCore.swiftmodule
I think that the library ExpoModulesCore is only for x86 (intel chip) environment. As might you think, I’m using M1 Mac. Is there any extra work to do if I run Expo 44.0.0 in M1? It works fine when 43.0.0. Thanks in advance.
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
bare
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
44.0.4
Environment
Expo CLI 5.0.3 environment info: System: OS: macOS 12.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.1 - /usr/local/bin/node Yarn: 2.4.2 - /usr/local/bin/yarn npm: 8.1.2 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild npmPackages: @expo/metro-config: ^0.3.0 => 0.3.0 babel-preset-expo: 9.0.1 => 9.0.1 expo: ^44.0.4 => 44.0.4 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: expo-cli: 5.0.3 Expo Workflow: bare
Reproducible demo
my pod file is :
# require_relative '../node_modules/react-native/scripts/react_native_pods'
# require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
# require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
$RNFirebaseAsStaticFramework = true
$RNFirebaseAnalyticsWithoutAdIdSupport=true
$FirebaseSDKVersion = '8.9.1'
platform :ios, '12.0'
pod 'Firebase/Analytics'
target '(projectName)' do
# use_unimodules!
use_expo_modules!
config = use_native_modules!
use_react_native!(:path => config[:reactNativePath], :hermes_enabled => false)
pod 'RNPhotoEditor', :path => '../node_modules/react-native-photo-editor/ios'
use_frameworks! :linkage => :static
pod 'iOSPhotoEditor', :git => '(custom repository)', :branch => 'master'
pod 'TZImagePickerController', :git => '(custom repository)', :branch => 'master'
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!({ 'Flipper' => '0.74.0' })
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name.include?('iOSPhotoEditor')
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5'
end
end
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end
# flipper_post_install(installer)
end
# Follow [Flipper iOS Setup Guidelines](https://fbflipper.com/docs/getting-started/ios-native)
# This is required because iOSPhotoEditor is implemented using Swift and we have to use use_frameworks! in Podfile
$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Flipper-Fmt', 'Flipper-Boost-iOSX', 'Yoga', 'YogaKit',
'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native', 'EXPermissions','UMPermissionsInterface']
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if $static_framework.include?(pod.name)
def pod.build_type;
Pod::BuildType.static_library
end
end
if pod.name.start_with?('RNFB') || pod.name.start_with?('KakaoSDK')
def pod.build_type;
Pod::BuildType.static_library
end
end
if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
def pod.build_type;
# Uncomment the line corresponding to your CocoaPods version
Pod::BuildType.static_library # >= 1.9
# Pod::Target::BuildType.static_library # < 1.9
end
end
end
end
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# end
end
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 21 (2 by maintainers)
I finally found the solution. When I added the following codes on Podfile, the error has gone and works charmingly.
On Apple Silicon (M1/M2) I was fighting with Expo builds for days, my final working solution was as follows (using react-native-maps and react-native-firebase):
softwareupdate --install-rosettaarch -x86_64 npx expo run:iosI could not figure out how to inject the
post_installinto the Podfile without getting a “duplicate post_install error”. I also didn’t want to persist this in the project since my cloud builds run on Intel.Adding
x86_64inBuild Settings > Architecturefixed the issue for me. No additional setup needed.We are still hitting this even if you wipe out the
/iosfolder on every runDid anyone achieve a solution?
@lliamscholtz your notes helped a lot to find a solution. I have made an additional plugin to make it work with Expo 48
It worked for me, thank bro!
I ran into this same issue so I first removed the DerivedDate folder which just ended up giving me a different error, found that for whatever reason in Xcode arm64 was set under excluded architectures. Removing that fixed it for me and app was able to finally build
If I use this solution, the app builds correclty, but the DocumentPicker don’t work in the simulator.
There is an error in this code:
https://github.com/expo/expo/blob/62732c47261012540bdcc9685ee1716f29a53279/packages/expo-document-picker/ios/EXDocumentPicker/EXDocumentPickerModule.m#L16-L36
In some research, I found something related to
[UTType typeWithMIMEType]in M1: https://developer.apple.com/forums/thread/685968Has anyone ever experienced this?
hey @Kudo I’m now experiencing this too. Should we re-open and discuss here or would you like a new issue?
In case useful for anyone running into a similar error, we were having this same build error (could not find module ‘ExpoModulesCore’ for target…) against Expo 49.0.x when building on Mac M1/M2s.
We found that modifying the
Podfileto include settingONLY_ACTIVE_ARCHto NO for all Pods targets as mentioned above by @douglasjunior would help.But we finally tracked down the cause of the issue to be related to the version of the Google Cast SDK that one of the dependencies of our project was using.
We use
expo-build-propertiesto add an additional dependency on a custom native iOS Framework via theextraPodssetting in ourapp.json. That framework depends on the native Google Cast library, but was declaring the dependency in itspodspecas:s.dependency 'google-cast-sdk-no-bluetooth'When we update this to the following we can now build on M1/M2 machines
s.dependency 'google-cast-sdk-dynamic-xcframework-no-bluetooth'So if you are depending any native iOS libraries be sure that you are correctly specifying a version which supports compilation on M1/M2s
This didn’t work for me, I lots of errors
It works for me. Thanks.
Oh my god I tried everything but as @danjenkins said, remove pods before yarn ios
Actually, after clearing out my Pods directory it did succeed. So yes adding the relevant part of the post_install to what you’ve already got does work. Does make me wonder why that’s needed at all though @Kudo
@iKoru i’m glad you found a solution. let me close this. if you encounter other problems, please open new issue. thank you!