facebook / flipper

A desktop debugging platform for mobile developers.
https://fbflipper.com/
MIT License
13.36k stars 952 forks source link

Flipper Folly crashes build on x86_64 Mac #3359

Open wojewski opened 2 years ago

wojewski commented 2 years ago

🐛 Bug Report

After setting up the Flipper in React Native app along with manual config from doc and also by following the Flipper React Native Example. The app crashes on the build phase as follows:

Undefined symbols for architecture x86_64:
  "_make_fcontext", referenced from:
      folly::fibers::FiberImpl::FiberImpl(folly::Function<void ()>, unsigned char*, unsigned long) in Fiber.o
  "folly::detail::crc32c_combine_hw(unsigned int, unsigned int, unsigned long)", referenced from:
      folly::crc32c_combine(unsigned int, unsigned int, unsigned long) in Checksum.o
  "folly::detail::crc32c_combine_sw(unsigned int, unsigned int, unsigned long)", referenced from:
      folly::crc32c_combine(unsigned int, unsigned int, unsigned long) in Checksum.o
  "folly::detail::crc32_combine_hw(unsigned int, unsigned int, unsigned long)", referenced from:
      folly::crc32_combine(unsigned int, unsigned int, unsigned long) in Checksum.o
  "folly::detail::crc32_combine_sw(unsigned int, unsigned int, unsigned long)", referenced from:
      folly::crc32_combine(unsigned int, unsigned int, unsigned long) in Checksum.o
  "_jump_fcontext", referenced from:
      folly::fibers::FiberImpl::deactivate() in Fiber.o
      folly::fibers::FiberImpl::activate() in SimpleLoopController.o
  "folly::detail::crc32c_hw(unsigned char const*, unsigned long, unsigned int)", referenced from:
      folly::crc32c(unsigned char const*, unsigned long, unsigned int) in Checksum.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To Reproduce

platform :ios, '11.0'

$RNFirebaseAsStaticFramework = true

react_native_path = '../node_modules/react-native'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

# source 'https://bitbucket.org/authenteq/cocoapods-specs.git'
source 'https://cdn.cocoapods.org/'

target 'App' do
  use_native_modules!
  use_frameworks!

  # Pods for App

  config = use_native_modules!
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )
  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'NewRelicAgent'

  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"

  target 'AppTests' do
    inherit! :complete
    # Pods for testing
  end
end

target "AirshipNotificationServiceExtension" do
  use_frameworks!
  pod 'AirshipExtensions/NotificationService'
end

$static_framework = ['RNScreens', 'RNPermissions', 'Permission-PhotoLibrary', 'Permission-AppTrackingTransparency', 'Permission-Camera']
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)
      puts "Overriding the static_framework method for #{pod.name}"
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

use_flipper!({'Flipper' => '0.129.0'})

post_install do |installer|
  react_native_post_install(installer)
  flipper_post_install(installer)

  installer.aggregate_targets.each do |aggregate_target|
    aggregate_target.user_project.native_targets.each do |target|
      target.build_configurations.each do |config|
        # Arch selection is needed to work across M1/Intel macs, became necessary when App Check was added
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
        config.build_settings['EXCLUDED_ARCHS'] = 'i386'
      end
    end
    aggregate_target.user_project.save
  end

  __apply_Xcode_12_5_M1_post_install_workaround(installer)
end

Environment

Flipper desktop version: tried on both: 0.58.0 and 0.129.0 React Native version: tried on both: 0.66.3 and 0.67.1 Hermes: disabled System: Mac x86_64

ZComwiz commented 2 years ago

Connected to: https://github.com/facebook/flipper/issues/3117

aigoncharov commented 2 years ago

CC @lblasa

wojewski commented 2 years ago

I've just tested on arm64, M1 mac and got the same error

Undefined symbols for architecture arm64:
  "_make_fcontext", referenced from:
      folly::fibers::FiberImpl::FiberImpl(folly::Function<void ()>, unsigned char*, unsigned long) in Fiber.o
  "folly::detail::crc32c_combine_hw(unsigned int, unsigned int, unsigned long)", referenced from:
      folly::crc32c_combine(unsigned int, unsigned int, unsigned long) in Checksum.o
  "folly::detail::crc32c_combine_sw(unsigned int, unsigned int, unsigned long)", referenced from:
      folly::crc32c_combine(unsigned int, unsigned int, unsigned long) in Checksum.o
  "folly::detail::crc32_combine_hw(unsigned int, unsigned int, unsigned long)", referenced from:
      folly::crc32_combine(unsigned int, unsigned int, unsigned long) in Checksum.o
  "folly::detail::crc32_combine_sw(unsigned int, unsigned int, unsigned long)", referenced from:
      folly::crc32_combine(unsigned int, unsigned int, unsigned long) in Checksum.o
  "_jump_fcontext", referenced from:
      folly::fibers::FiberImpl::deactivate() in Fiber.o
      folly::fibers::FiberImpl::activate() in SimpleLoopController.o
  "folly::detail::crc32c_hw(unsigned char const*, unsigned long, unsigned int)", referenced from:
      folly::crc32c(unsigned char const*, unsigned long, unsigned int) in Checksum.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
thibaultcapelli commented 2 years ago

Any news on this issue please?

ZComwiz commented 2 years ago

@thibaultcapelli what is your build setup? In what capacity are you using Flipper?

thibaultcapelli commented 2 years ago

@thibaultcapelli what is your build setup? In what capacity are you using Flipper?

I'm making a migration to RN 0.69.5. I'm using a M1. If I disable Flutter in the Profile I can bypass this error

I have exactly the same error than @wojewski. I can't test with an Intel processor for now

ZComwiz commented 2 years ago

@thibaultcapelli — according to the release notes, RN .70 should support Mac Catalyst. Haven't gotten through removing all PropTypes yet to find out. For now we remove Flipper reference for Mac Catalyst from Podfile. No errors when building to the other device types/simulators with Flipper enabled.

NJHu commented 2 years ago

Undefined symbols for architecture arm64: "_make_fcontext", referenced from: folly::fibers::FiberImpl::FiberImpl(folly::Function<void ()>, unsigned char, unsigned long) in Fiber.o "folly::detail::crc32c_combine_hw(unsigned int, unsigned int, unsigned long)", referenced from: folly::crc32c_combine(unsigned int, unsigned int, unsigned long) in Checksum.o "folly::detail::crc32c_combine_sw(unsigned int, unsigned int, unsigned long)", referenced from: folly::crc32c_combine(unsigned int, unsigned int, unsigned long) in Checksum.o "folly::detail::crc32_combine_hw(unsigned int, unsigned int, unsigned long)", referenced from: folly::crc32_combine(unsigned int, unsigned int, unsigned long) in Checksum.o "folly::detail::crc32_combine_sw(unsigned int, unsigned int, unsigned long)", referenced from: folly::crc32_combine(unsigned int, unsigned int, unsigned long) in Checksum.o "_jump_fcontext", referenced from: folly::fibers::FiberImpl::deactivate() in Fiber.o folly::fibers::FiberImpl::activate() in SimpleLoopController.o "folly::detail::crc32c_hw(unsigned char const, unsigned long, unsigned int)", referenced from: folly::crc32c(unsigned char const*, unsigned long, unsigned int) in Checksum.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Watersdr commented 2 years ago

Anyone have any clues on a fix for this? 😩 I also get a similar one:

Undefined symbols for architecture x86_64:
  "_jump_fcontext", referenced from:
      folly::fibers::FiberImpl::deactivate() in libRCT-Folly.a(Fiber.o)
      folly::fibers::FiberImpl::activate() in libRCT-Folly.a(SimpleLoopController.o)
btkramm commented 1 year ago

Anyone have any clues on a fix for this? 😩 I also get a similar one:

Undefined symbols for architecture x86_64:
  "_jump_fcontext", referenced from:
      folly::fibers::FiberImpl::deactivate() in libRCT-Folly.a(Fiber.o)
      folly::fibers::FiberImpl::activate() in libRCT-Folly.a(SimpleLoopController.o)

I have the same issue when using Hermes on iOS. Did you solve it?

dimplegarg commented 7 months ago

Anyone have any clues on a fix for this? 😩 I also get a similar one:

Screenshot 2024-03-29 at 1 31 15 PM
QDFish commented 6 months ago

Anyone have any clues on a fix for this? 😩 I also get a similar one: Screenshot 2024-03-29 at 1 31 15 PM

did you enable fliper?

QDFish commented 6 months ago

@dimplegarg @btkramm @Watersdr you can delete the 'all_load' in the OTHER_LDFLAG of your main project target to solve this problem