React Native clang:error:SDK does not contain 'libarclite' at the path

zc0qhyus  于 6个月前  发布在  React
关注(0)|答案(5)|浏览(209)

更新到Xcode 15后,我在react-native应用程序中尝试构建它时遇到以下错误。

clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a'; try increasing the minimum deployment target

字符串
最低部署目标为13.0
我的Podfile

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

platform :ios, '13.0'

target 'MyProject' do
  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
  )

  # ADDED BY ME 
  def __apply_Xcode_14_3_RC_post_install_workaround(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']  = '13.0'
        # minimum_target = 13.0 
        # if current_target.to_f < minimum_target.to_f
        #   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_target
        # end
      end
    end
  end
 # ADDED Y ME TO FINSH HE ISSUE

  pod 'Google-Mobile-Ads-SDK' ,"9.14.0"
  pod 'GoogleMobileAdsMediationFacebook','6.11.0.0'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'RNIap', :path => '../node_modules/react-native-iap'
  # permissions
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'react-native-contacts', :path => '../node_modules/react-native-contacts'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'RNExitApp', :path => '../node_modules/react-native-exit-app'

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

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  #use_flipper!()

  pre_install do |installer|
    $RNMBGL.pre_install(installer)
  end
  
  post_install do |installer|
    react_native_post_install(installer)
    $RNMBGL.post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    __apply_Xcode_14_3_RC_post_install_workaround(installer)
  end
end


这是我的package.json文件

"react": "17.0.2",
 "react-native": "0.66.1",

isr3a4wc

isr3a4wc1#

问题出在Cocoapods项目的最低操作系统版本上。只需进入项目导航器并选择pods项目:

  • 选择安装的所有Pod
  • 将iOS部署目标更改为至少iOS 13

在那之后应该会有用。


的数据

xa9qqrwz

xa9qqrwz2#

我遇到了同样的问题。我所需要的就是将部署目标设置为13.0。
下面是Podfile(安装后部分)。请替换您的开发团队ID。

post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
        target.build_configurations.each do |config|
            xcconfig_path = config.base_configuration_reference.real_path
            xcconfig = File.read(xcconfig_path)
            xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
            File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
            config.build_settings["DEVELOPMENT_TEAM"] = "YOUR TEAM ID"
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
         end
    end
  end
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

字符串

d6kp6zgx

d6kp6zgx3#

我在一个pod文件中添加了下面的代码并修复了这个问题,请在添加下面的代码后安装podfile。之后构建您的项目。
也请遵循此链接步骤https://stackoverflow.com/a/77144603/16687379

post_install do |installer|
     installer.generated_projects.each do |project|
         project.targets.each do |target|
                target.build_configurations.each do |config|
                    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
    config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
                  end
              end
          end
      end

字符串

vngu2lb8

vngu2lb84#

没有什么对我有用。在我像这样改变了Podfile之后,它又开始工作了。不明白这一点,但最后它运行并成功发布。

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

platform :ios, '13.0'

target 'MyProject' do
  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
  )

  # REMOVE THESE LINES
  #def __apply_Xcode_14_3_RC_post_install_workaround(installer)
    #installer.pods_project.targets.each do |target|
      #target.build_configurations.each do |config|
        #current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']  = '13.0'
        # minimum_target = 13.0 
        # if current_target.to_f < minimum_target.to_f
        #   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_target
        # end
      #end
    #end
  #end
 # The upper line are removed and it start working 

  pod 'Google-Mobile-Ads-SDK' ,"9.14.0"
  pod 'GoogleMobileAdsMediationFacebook','6.11.0.0'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'RNIap', :path => '../node_modules/react-native-iap'
  # permissions
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'react-native-contacts', :path => '../node_modules/react-native-contacts'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'RNExitApp', :path => '../node_modules/react-native-exit-app'

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

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  #use_flipper!()

  pre_install do |installer|
    $RNMBGL.pre_install(installer)
  end
  
  post_install do |installer|
    react_native_post_install(installer)
    $RNMBGL.post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    #__apply_Xcode_14_3_RC_post_install_workaround(installer) removed this line
  end
end

字符串

mzmfm0qo

mzmfm0qo5#

更新XCode 15运行iOS 17.0以上版本。Apple工作人员提到:
libarclite在旧版本的操作系统中是必需的,但现在已经过时了。如果您遇到引用此库的错误,您应该审计项目中的每个目标,以确定是否声明支持iOS 11下的最低部署目标,并将其更新到至少iOS 11或更新的版本。您不应该修改Xcode安装来解决此问题。
在podfile中:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "11.0"
    end
  end
end

字符串

相关问题