react-native: Archive fails on XCode 13.1 with React Native 0.66.1 and use_frameworks!

Description

Archive of the app fails with an error:

ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Showing Recent Messages
Dylib (/Users/vytautas/Library/Developer/Xcode/DerivedData/TestApp-ferjgbytfspgkvgspawguupwmviq/Build/Intermediates.noindex/ArchiveIntermediates/TestApp/BuildProductsPath/Release-iphoneos/fmt/fmt.framework/fmt) was built for newer iOS version (10.0) than being linked (9.0)
Ignoring file /Users/vytautas/Library/Developer/Xcode/DerivedData/TestApp-ferjgbytfspgkvgspawguupwmviq/Build/Intermediates.noindex/ArchiveIntermediates/TestApp/BuildProductsPath/Release-iphoneos/DoubleConversion/DoubleConversion.framework/DoubleConversion, building for iOS-armv7 but attempting to link with file built for iOS-arm64
Ignoring file /Users/vytautas/Library/Developer/Xcode/DerivedData/TestApp-ferjgbytfspgkvgspawguupwmviq/Build/Intermediates.noindex/ArchiveIntermediates/TestApp/BuildProductsPath/Release-iphoneos/glog/glog.framework/glog, building for iOS-armv7 but attempting to link with file built for iOS-arm64
Undefined symbol: double_conversion::DoubleToStringConverter::ToPrecision(double, int, double_conversion::StringBuilder*) const
Undefined symbol: double_conversion::DoubleToStringConverter::ToShortestIeeeNumber(double, double_conversion::StringBuilder*, double_conversion::DoubleToStringConverter::DtoaMode) const
Undefined symbol: double_conversion::DoubleToStringConverter::ToExponential(double, int, double_conversion::StringBuilder*) const
Undefined symbol: double_conversion::DoubleToStringConverter::ToFixed(double, int, double_conversion::StringBuilder*) const
Undefined symbol: google::base::CheckOpMessageBuilder::CheckOpMessageBuilder(char const*)
Undefined symbol: double_conversion::StringToDoubleConverter::StringToIeee(char const*, int, int*, bool) const
Undefined symbol: google::base::CheckOpMessageBuilder::ForVar2()
Undefined symbol: google::LogMessageFatal::LogMessageFatal(char const*, int)
Undefined symbol: google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()
Undefined symbol: google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)
Undefined symbol: google::base::CheckOpMessageBuilder::NewString()
Undefined symbol: google::LogMessage::stream()
Undefined symbol: void google::MakeCheckOpValueString<char>(std::__1::basic_ostream<char, std::__1::char_traits<char> >*, char const&)
Undefined symbol: google::LogMessageFatal::~LogMessageFatal()

Version

0.66.1

Output of react-native info

System:
    OS: macOS 11.6.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 656.85 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.4 - ~/.nvm/versions/node/v14.17.4/bin/node
    Yarn: 1.22.11 - ~/.nvm/versions/node/v14.17.4/bin/yarn
    npm: 6.14.14 - ~/.nvm/versions/node/v14.17.4/bin/npm
    Watchman: 2021.09.06.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /Users/vytautas/.rvm/gems/ruby-2.7.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK: Not Found
  IDEs:
    Android Studio: Arctic Fox 2020.3.1 Patch 3 Arctic Fox 2020.3.1 Patch 3
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  Languages:
    Java: 14.0.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  • Create new app with react-native init;
  • Update Podfile:
    • Add use_frameworks!;
    • Remove use_flipper!();
  • Reinstall pods with pod install;
  • Archive the app.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17

Most upvoted comments

I’ve resolved the issue by dropping the armv7 support.

Added this to my Podfile:

post_install do |installer|
  ...

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ARCHS'] = '${ARCHS_STANDARD_64_BIT}'
    end
  end
end

And set ARCHS = "${ARCHS_STANDARD_64_BIT}"; in the target’s build settings.

@gHashTag No need to remove the react-native purchase plugin all you have to do is just replace your pod file with following code.

post_install do |installer| react_native_post_install(installer) fix_library_search_paths(installer) end end

def fix_library_search_paths(installer) def fix_config(config) lib_search_paths = config.build_settings[“LIBRARY_SEARCH_PATHS”] if lib_search_paths if lib_search_paths.include?(“$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)”) || lib_search_paths.include?(“”$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)“”) # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1) # since the libraries there are only built for x86_64 and i386. lib_search_paths.delete(“$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)”) lib_search_paths.delete(“”$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)“”) if !(lib_search_paths.include?(“$(SDKROOT)/usr/lib/swift”) || lib_search_paths.include?(“”$(SDKROOT)/usr/lib/swift"")) # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11 lib_search_paths.insert(0, “$(SDKROOT)/usr/lib/swift”) end end end end

projects = installer.aggregate_targets .map{ |t| t.user_project } .uniq{ |p| p.path } .push(installer.pods_project)

projects.each do |project| project.build_configurations.each do |config| fix_config(config) end project.native_targets.each do |target| target.build_configurations.each do |config| fix_config(config) end end project.save() end end

I have managed to fix this issue by replacing ‘Folly’ to ‘RCT-Folly’ at Podfile static_framework row, and set ONLY_ACTIVE_ARCH to YES at post_install

$static_framework = [ ... , 'RCT-Folly', ...]

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|
      target.build_configurations.each do |config|
        config.build_settings['ENABLE_BITCODE'] = 'NO'
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
      end
    end
    react_native_post_install(installer)
  end