expo: Error with `pod install` using Expo 42 & `use_frameworks!`

Summary

Enabling use_frameworks! with Expo 42 in a bare workflow causes pod install to fail because @unimodules/core includes statically linked binaries.

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)

No response

Environment

  Expo CLI 4.9.1 environment info:
    System:
      OS: macOS 11.4
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
      Yarn: 1.19.1 - /usr/local/bin/yarn
      npm: 6.14.10 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.10.2 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
      Android SDK:
        API Levels: 23, 25, 26, 27, 28, 29
        Build Tools: 23.0.1, 23.0.2, 25.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.1, 29.0.2
        System Images: android-26 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 4.0 AI-193.6911.18.40.6626763
      Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~42.0.1 => 42.0.3
      react: 16.13.1 => 16.13.1
      react-dom: 16.13.1 => 16.13.1
      react-native: ~0.63.4 => 0.63.4
      react-native-web: ~0.13.12 => 0.13.18
    npmGlobalPackages:
      expo-cli: 4.9.1
    Expo Workflow: bare

Reproducible demo or steps to reproduce from a blank project

Demo project created using the steps below: https://github.com/carsondarling/expo42_use_frameworks_error_demo

Steps to Reproduce

  1. expo init --npm --template bare-minimum
  2. Update Podfile to enable use_frameworks!:
# ios/Podfile
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'

platform :ios, '11.0'

target 'expo42useframeworkserrordemo' do
  use_frameworks!
  use_unimodules!
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # Uncomment to opt-in to using Flipper
  #
  # if !ENV['CI']
  #   use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
  #   post_install do |installer|
  #     flipper_post_install(installer)
  #   end
  # end
end
  1. cd ios && pod install
  2. Pod install fails with the following error: [!] The 'Pods-expo42useframeworkserrordemo' target has transitive dependencies that include statically linked binaries: (/Users/cdarling/Workspace/expo42_use_frameworks_error_demo/node_modules/@unimodules/core/ios/UMCore.xcframework)
Ignoring digest-crc-0.6.3 because its extensions are not built. Try: gem pristine digest-crc --version 0.6.3
Installing unimodules:
 expo-application@3.2.0 from ../node_modules/expo-application/ios
 expo-constants@11.0.1 from ../node_modules/expo-constants/ios
 expo-error-recovery@2.2.0 from ../node_modules/expo-error-recovery/ios
 expo-file-system@11.1.3 from ../node_modules/expo-file-system/ios
 expo-font@9.2.1 from ../node_modules/expo-font/ios
 expo-image-loader@2.2.0 from ../node_modules/expo-image-loader/ios
 expo-keep-awake@9.2.0 from ../node_modules/expo-keep-awake/ios
 expo-modules-core@0.2.0 from ../node_modules/expo-modules-core/ios
 expo-splash-screen@0.11.2 from ../node_modules/expo-splash-screen/ios
 expo-structured-headers@1.1.1 from ../node_modules/expo-structured-headers/ios
 expo-updates@0.8.3 from ../node_modules/expo-updates/ios
 expo-updates-interface@0.2.2 from ../node_modules/expo-updates-interface/ios
 unimodules-app-loader@2.2.0 from ../node_modules/unimodules-app-loader/ios
 unimodules-core@7.1.1 from ../node_modules/@unimodules/core/ios
 unimodules-react-native-adapter@6.3.5 from ../node_modules/@unimodules/react-native-adapter/ios
 unimodules-task-manager-interface@6.2.0 from ../node_modules/unimodules-task-manager-interface/ios

Auto-linking React Native modules for target `expo42useframeworkserrordemo`: RNGestureHandler, RNReanimated, and RNScreens
Analyzing dependencies
Downloading dependencies
[!] The 'Pods-expo42useframeworkserrordemo' target has transitive dependencies that include statically linked binaries: (/Users/cdarling/Workspace/expo42_use_frameworks_error_demo/node_modules/@unimodules/core/ios/UMCore.xcframework)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hey @carsondarling πŸ‘‹ Thanks for reporting this issue to us and I apologize this is the case for you πŸ™‡ Looks like it’s related to the prebuilt binary of unimodules core, so the solution might be to compile the package from sources. There are two ways to do this:

  1. Add $ExpoUseSources = ['@unimodules/core'] somewhere at the top of your podfile (if it still breaks for another package then you can add it there too).
  2. Run EXPO_USE_SOURCE=1 pod install which entirely opts-out from using the prebuilt binaries from .xcframework files

It’s definitely not a long-term solution, but I’d appreciate if you can let me know if that helps, at least for now πŸ™‚

Hey all! #14523 is going to fix these problems, we will keep you informed here πŸ™‚ cc @Kudo

Hey @carsondarling πŸ‘‹ Thanks for reporting this issue to us and I apologize this is the case for you πŸ™‡ Looks like it’s related to the prebuilt binary of unimodules core, so the solution might be to compile the package from sources. There are two ways to do this:

  1. Add $ExpoUseSources = ['@unimodules/core'] somewhere at the top of your podfile (if it still breaks for another package then you can add it there too).
  2. Run EXPO_USE_SOURCE=1 pod install which entirely opts-out from using the prebuilt binaries from .xcframework files

It’s definitely not a long-term solution, but I’d appreciate if you can let me know if that helps, at least for now πŸ™‚

$ExpoUseSources = [β€˜@unimodules/core’]

Adding this has helped πŸ‘

@tsapeta just gave it a shot with $ExpoUseSources and ran into a similar error as @guyzmo:

While building module 'EXUpdates' imported from /Users/cdarling/Workspace/expo42_use_frameworks_error_demo/ios/expo42useframeworkserrordemo/AppDelegate.h:2:
In file included from <module-includes>:1:
In file included from /Users/cdarling/Library/Developer/Xcode/DerivedData/expo42useframeworkserrordemo-canezlcaqaxzrmbqdrmdjdjehfmo/Build/Products/Debug-iphonesimulator/EXUpdates/EXUpdates.framework/Headers/EXUpdates-umbrella.h:39:
/Users/cdarling/Library/Developer/Xcode/DerivedData/expo42useframeworkserrordemo-canezlcaqaxzrmbqdrmdjdjehfmo/Build/Products/Debug-iphonesimulator/EXUpdates/EXUpdates.framework/Headers/EXUpdatesDevLauncherController.h:3:9: error: include of non-modular header inside framework module 'EXUpdates.EXUpdatesDevLauncherController': '/Users/cdarling/Workspace/expo42_use_frameworks_error_demo/ios/Pods/Headers/Public/EXUpdatesInterface/EXUpdatesExternalInterface.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import <EXUpdatesInterface/EXUpdatesExternalInterface.h>
        ^
1 error generated.
In file included from /Users/cdarling/Workspace/expo42_use_frameworks_error_demo/ios/expo42useframeworkserrordemo/main.m:3:
/Users/cdarling/Workspace/expo42_use_frameworks_error_demo/ios/expo42useframeworkserrordemo/AppDelegate.h:2:9: fatal error: could not build module 'EXUpdates'
#import <EXUpdates/EXUpdatesAppController.h>
 ~~~~~~~^
2 errors generated.

Given that previous releases of Expo have also failed with use_frameworks (see #10841, #7610), it’s clear that something needs to be done in the pre-release testing process to make sure that these regressions do not creep back in in the future.

As suggested by @brentvatne (here), I’m currently working on adding a use_frameworks smoke test step to the Expo release process (I believe it should go here: https://github.com/expo/expo/blob/master/guides/releasing/Release Workflow.md#22-standalone-app-quality-assurance, please correct me if I’m wrong).

That being said, I’m fairly lost on how exactly to work around this problem and would love any suggestions for moving forward in the meantime.

@guyzmo I just tested, you just need to add "eas-build-pre-install": "sudo gem install cocoapods-user-defined-build-types" to package.json