react-native-dev-menu icon indicating copy to clipboard operation
react-native-dev-menu copied to clipboard

Undefined symbols for architecture arm64 on RN 0.62.2

Open Almouro opened this issue 5 years ago • 1 comments

Hello!

Describe your environment

  • React-Native 0.62.2
  • Platform: iOS
  • Device: simulator
  • OS version: macOS 10.15.4
  • react-native-dev-menu version 4.0.1
  • Devtools: XCode 11.4

Also note the project uses use_frameworks!

How to repeat issue and example

Upgrading to RN 0.62.2 broke the build with this error:

Undefined symbols for architecture arm64
> Symbol: _OBJC_CLASS_$_RCTDevMenuItem
> Referenced from: objc-class-ref in RNDevMenu.o

I tried already:

  • cleaning project
  • removing derived data A clean build on Bitrise also has the same issue, so it mustn't be related to cache or something of the sort

Not really a solution

The weird part is if I symlink RNDevMenu.h and RNDevMenu.m in the project and make sure it's not installed as a Pod, then it works

Let me know if you need any additional details!

Almouro avatar May 12 '20 08:05 Almouro

Hello!

This is related to use_frameworks usage (which is broken by design). A simple solution is to add this in your Podfile:

use_frameworks!

# Set every dep you want to build as static libraries here
$static_libs = ['RNDevMenu']

pre_install do |installer|
  installer.pod_targets.each do |pod|
    if $static_libs.include?(pod.name)
      puts "Flag #{pod.name} as static_library"
      def pod.build_type;
        # Uncomment one line depending on your CocoaPods version
        # Pod::BuildType.static_library # >= 1.9
        # Pod::Target::BuildType.static_library # < 1.9
      end
    end
  end
end

It's a workaround, but until CocoaPods 2.0 I'm afraid we have no choice.

zoontek avatar May 13 '20 17:05 zoontek