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.

[iOS] Linker error: 'Undefined symbols for architecture arm64'

See original GitHub issue

I followed installation procedure, plugin version 0.0.23, Flutter 1.12.13+hotfix.9 channel stable. Got this linker error in Xcode:

Undefined symbols for architecture arm64: "CKAnalyticsListenerHelpers::GetReusedNodes(NSObject*)", referenced from: +[SKComponentLayoutWrapper newFromRoot:parentKey:] in libFlipperKit.a(SKComponentLayoutWrapper.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
kiplelive-zarimancommented, Dec 30, 2020

Here the solution worked for me

  1. declare all flavour on this section
project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
  
  # Declare all flavaor/variant here
  'Debug-Development' => :debug,
  'Release-Development' => :release,
  'Release-Staging' => :release,
  'Release-Production' => :release,
}
  1. remove
use_modular_headers!
  1. $static_framework should be declare same level with post_install, not inside project 'Runner'
$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
  'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
  'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
  'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']
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

post_install do |installer|

Finally the Podfile should look like this

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
  # Declare all flavaor/variant here
  'Debug-Development' => :debug,
  'Release-Development' => :release,
  'Release-Staging' => :release,
  'Release-Production' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  # use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
# If you use `use_frameworks!` in your Podfile,
# uncomment the below $static_framework array and also
# the pre_install section.  This will cause Flipper and
# it's dependencies to be built as a static library and all other pods to
# be dynamic.s
$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
  'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
  'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
  'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']
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

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end
  end
  file_name = Dir.glob("*.xcodeproj")[0]
  app_project = Xcodeproj::Project.open(file_name)
  app_project.native_targets.each do |target|
    target.build_configurations.each do |config|
      cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
      unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
        puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
        cflags << '-DFB_SONARKIT_ENABLED=1'
      end
      config.build_settings['OTHER_CFLAGS'] = cflags
    end
    app_project.save
  end
  installer.pods_project.save
end

1reaction
lijy91commented, Oct 22, 2020

@amorenew Can you try to remove use_modular_headers! on the Podfile?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Undefined symbols for architecture arm64 - Apple Developer
I am working on the ios project. I didn't have any problem at the moment. However, there is a problem with iOS 11.4...
Read more >
Undefined symbols for architecture arm64 #2600 - GitHub
Bug Report Throws an error of arm 64 when running app from Xcode 12.4 to iOS 14.6 Undefined symbols for architecture arm64: ...
Read more >
How To Fix It: Undefined Symbols for Architecture X86_64:
This error is happening due to the lack of included values inside the declared statements in your code. The browser is going to...
Read more >
The heartbreak of the Xcode “Undefined symbols ... - iOS Brain
If you have the source code for library.a, you can easily fix the problem. Remove the current reference to library.a in your app...
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 >

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