React-native: 0.62.0 iOS build fails when use_frameworks! enabled in Podfile

Created on 1 Apr 2020  ·  16Comments  ·  Source: facebook/react-native

Description

The iOS build fails in version 0.62.0 when use_framworks! is enabled in Podfile.

React Native version:

System:
    OS: macOS 10.15.4
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 480.01 MB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.6.0 - /var/folders/r4/pdxxhfbj3cqg_0n5th1p2t400000gn/T/yarn--1585746478847-0.9015524840092832/node
    Yarn: 1.22.4 - /var/folders/r4/pdxxhfbj3cqg_0n5th1p2t400000gn/T/yarn--1585746478847-0.9015524840092832/yarn
    npm: 6.13.7 - ~/.nvm/versions/node/v13.6.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /Users/jafar/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6308749
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  Languages:
    Python: 2.7.17 - /usr/local/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.0 => 0.62.0
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

  1. Make new project : npx react-native init MyTestApp
  2. Run yarn ios => it builds
  3. Add use_frameworks! in the MyTestApp target of the Podfile
  4. run yarn ios=> build fails with:
▸ Linking folly

❌  ld: library not found for -lDoubleConversion



❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Expected Results

Build should work.

iOS CocoaPods

Most helpful comment

@hramos I'm not sure what test_ios_unit_frameworks does exactly but it seems to be green on 0.62-stable as well.
By the way it is now broken on master but probably for another reason.

@Daavidaviid Looks like completely disabling Flipper on iOS works. I just noticed this in the Podfile:

# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.

Noted 😅

All 16 comments

Same here, I'm trying to find a solution involving :

, :modular_headers => true
$static_framework = ['FlipperKit', 'Flipper', 'Folly', 'Flipper-Folly',
    'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion','DoubleConversion',
    'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
    'CocoaLibEvent', 'openssl-ios-bitcode', 'boost-for-react-native',
    'RNVectorIcons', 'RNFBAnalytics', 'RNFBApp'
  ]

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

    end
  end

But still no luck on my side... Trying hard to solve this issue

@alexisbronchart were you able to make some progress on this issue ?
On my side, not to so much.
My theory is that Flipper relies on DoubleConversion and Flipper doesn't support use_frameworks, so now DoubleConversion doesn't support it anymore and they made some regression, not sure.

We're not seeing this failure on master (the test_ios_unit_frameworks job is green), so it looks like it has been fixed on master since 0.62 was cut: https://app.circleci.com/pipelines/github/facebook/react-native/4318/workflows/a9b1bfe9-0664-4182-96fb-d287bb57f63f/jobs/143419

You think it could land in 0.62.1 ?

@hramos I'm not sure what test_ios_unit_frameworks does exactly but it seems to be green on 0.62-stable as well.
By the way it is now broken on master but probably for another reason.

@Daavidaviid Looks like completely disabling Flipper on iOS works. I just noticed this in the Podfile:

# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.

Noted 😅

Did you try that and can confirm it works @alexisbronchart ? I’ll try that later

Yes I confirm it works. But no Flipper then...

I confirm it works too. I removed any mentions of Flipper in AppDelegate.m and Podfile

@alexisbronchart yeah it's weird that it is mentioned in the docs but doesn't work :(

Unfortunately having the same issue with 62.2. I have tried different setups already: Recommended approach for use_frameworks! from https://fbflipper.com/docs/getting-started/ios-native.html, applying diff from https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.62.2 (though it clearly states that there is no use_frameworks! support there), trying to modify setup by modifying list of static frameworks that yielded this error.

I also tried different Flipper versions (33.1 is the one recommended by upgrade-helper, and I tried also the latest one, which was 37.0).

Everything works as expected on 62.2 without Flipper for me.

@crazyjooe Everything works as expected on 62.2 without Flipper for me. +1

Isn't there any way to use Flipper with !use_frameworks? Is something they plan to change in the future?

We cannot use Flipper because of this limitation.

@hramos
Isn't there any way to use Flipper with !use_frameworks? Is something they plan to change in the future?
We cannot use Flipper because of this limitation.
same issue here. Is there any progress about this?

Removing Flipper from just the Podfile and AppDelegate didn't work for me. I also needed to remove "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)" from Library Search Paths in Build Settings. Hope that helps someone else.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Hi there! I need to use a dynamic native library inside a react native project. I linked the library as a pod with a bridge react module. I had the same issue with Flipper. I removed all mentions from Podfile and AppDelegate, updated pods. And I've got a new issue. Which reproduce after removing Flipper without linking of the native lib.

TypeError: null is not an object (evaluating '_RNGestureHandlerModule.default.Direction')

<global>
    Directions.js:3:15
loadModuleImplementation
    require.js:321:11
<global>
    GestureHandler.js:2
loadModuleImplementation
    require.js:321:11
<global>
    Swipeable.js:10
loadModuleImplementation
    require.js:321:11
<global>
    index.js:1
loadModuleImplementation
    require.js:321:11
<global>
    StackView.js:12
loadModuleImplementation
    require.js:321:11
<global>
    index.js:12
loadModuleImplementation
    require.js:321:11
<global>
    index.js:1
loadModuleImplementation
    require.js:321:11
<global>
    AppNavigation.ts:4
loadModuleImplementation
    require.js:321:11
<global>
    NavigationReducer.ts:3
loadModuleImplementation
    require.js:321:11
<global>
    index.ts:2
loadModuleImplementation
    require.js:321:11
<global>
    index.ts:7
loadModuleImplementation
    require.js:321:11
<global>
    index.tsx:21
loadModuleImplementation
    require.js:321:11
<global>
    index.js:8
loadModuleImplementation
    require.js:321:11
guardedLoadModule
    require.js:201:44
global code
    index.bundle?platform=ios&dev=true&minify=false:148725:3
System:
    OS: macOS 10.15.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 53.18 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.13.1 - /usr/local/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /Users/george/.gem/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3
      System Images: android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6626763
    Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_265 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
Was this page helpful?
0 / 5 - 0 ratings