question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_RNSScreenView", referenced from: REAUIManager.o

See original GitHub issue

Description

When compiling for iOS in Xcode I get the following error in linking phase:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RNSScreenView", referenced from:
      objc-class-ref in REAUIManager.o
ld: symbol(s) not found for architecture arm64

Expected behavior

No errors.

Actual behavior & steps to reproduce

Build fails in Xcode.

  1. Select build from code.

Snack or minimal code example

podfile:

platform :ios, '11.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
project 'MyApp.xcodeproj'

install! 'cocoapods', :deterministic_uuids => false

def pods
  config = use_native_modules!
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => false
  )
  use_frameworks!
  
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'ReachabilitySwift'
end

target 'MyApp' do
    pods
end

pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNScreens')
      def pod.build_type
        Pod::BuildType.static_library
      end
    end
  end

  Pod::Installer::Xcode::TargetValidator.send(
    :define_method,
    :verify_no_static_framework_transitive_dependencies
  ) {}
end

post_install do |installer|
  react_native_post_install(installer)
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
  
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    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 requires a crude patch to bump up iOS deployment target, or "error: thread-local storage is not supported for the current target"
  # I'm not aware of any other way to fix this one other than bumping iOS deployment target to match react-native (iOS 11 now)
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
      end
  end

  # ...but if you bump iOS deployment target, Flipper barfs again "Time.h:52:17: error: typedef redefinition with different types"
  # We need to make one crude patch to RCT-Folly - set `__IPHONE_10_0` to our iOS target + 1
  # https://github.com/facebook/flipper/issues/834 - 84 comments and still going...
  `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`
end

Package versions

  • React Native: 0.66.0
  • React Native Reanimated: 2.3.0-beta.2
  • React Native Screens: 3.8.0
  • NodeJS: 14.18.0
  • Xcode: 13.0 (13A233)
  • Java & Gradle: OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing), Gradle 7.2
  • CocoaPods: 1.11.2

Affected platforms

  • Android
  • iOS
  • Web

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
Aurelienlajoiniecommented, Jul 20, 2022

Hello guys,

Finally this morning i was able to build RN 0.66.4 project with reanimated v2.9.1 for this i have to

  • Upgrade react-native-screens to v3.15.0
  • Remove RNScreens from static library preinstall script from Podfile
target 'myTarget' do
  inherit! :complete
  use_expo_modules!

  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
  )

  # here come my pods
  ...

  use_frameworks!
end



$static_libraries = [
  # 'RNScreens' <==== remove it
  'RNVectorIcons', 'RNPermissions', ...
]

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_libraries.include?(pod.name) || pod.name.start_with?('Permission-')
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

post_install do |installer|
    ....
end

I still have a problem with bottom-sheet on debug but its another fight 😄 Now im able to build both android and iOS and debug remotely works again on android !

Hope it can help you 😃

3reactions
Aurelienlajoiniecommented, May 2, 2022

Hello, same error as @architect-aimonkey here with RN 0.63.4 and RN 0.66.4. So as we didn’t find any solution for this ios build error, we stay in reanimated 2.2.4 and upgrade to 2.8.0 on demand when we need to debug remotely on android.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Undefined symbols for architecture arm64: "_OBJC_CLASS_ ...
Undefined symbols for architecture arm64 : "_OBJC_CLASS_$_GlobalVariables", referenced from: objc-class-ref in MapViewController.o.
Read more >
Undefined symbols for architecture arm64 in Xcode 14
I am facing an issue when building a project that builds without issue in Xcode 13.4.1, but hits a build error in Xcode...
Read more >
How to fix Linker error (Undefined symbols for ... - YouTube
In this video you can see how to fix following issue:- Undefined symbols for architecture arm64 : "_OBJC_CLASS_$_GADRequest", referenced from: ...
Read more >
Xcode Undefined Symbols For Architecture Arm64 - Buildbox
Undefined symbols for architecture arm64 : "_OBJC_CLASS_$_SKStoreReviewController", referenced from: objc-class-ref in libcore.a(PTServices.o)
Read more >
Undefined symbols for architecture arm64 - Obi Official Forum
Obi Robe: 4.1. Errors log is pasted below: Code: Undefined symbols for architecture arm64: "_GetProfilingInfoCount", referenced from:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found