clang: error: SDK does not contain 'libarclite' at the path
Asked Answered
A

6

93

After Updating to Xcode 15 I am getting the following error in my react-native app while it try to build it.

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

the Minimum deployment target is 13.0

this is my 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

Here is my package.json file

 "react": "17.0.2",
 "react-native": "0.66.1",
Arcane answered 20/9, 2023 at 5:54 Comment(0)
C
146

The issue is with the minimum OS version on the Cocoapods project. Just go on your project navigator and select the pods project:

  • Select all pods installed
  • Change the iOS deployment target to at least iOS 13

It should work after that.

enter image description here

Compressibility answered 20/9, 2023 at 17:8 Comment(2)
iOS 11 with Xcode 14 and iOS 12 with Xcode 15 are also fine.Goal
Thanks! it worked good. But in order to see something similar to the screenshot, In the project navigator, one should select the 'Pods' item (parent of Podfile, not the one that is sibling of the Podfile, nor the item under the top item)Dominoes
A
65

XCode 15, iOS 17.0+

Apple staff mentions:

libarclite was necessary for older OS versions, but is now obsolete. If you're encountering errors referring to this library, you should audit every target in your project for those that declare support for a minimum deployment target under iOS 11, and update them to at least iOS 11, or something more recent than that. You should not modify your Xcode installation to resolve this.

In podfile: add these lines at the end of the file. This will automatically change all pods targets to iOS 11 after running pod install. You don't have to select each target step by step.

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
Aftereffect answered 20/11, 2023 at 2:57 Comment(2)
must be the approved answerSianna
Adding the script to the bottom of the Podfile is indeed a quick and easy trick. Tks.Thermostatics
L
6

I ran into the same issue. All I needed was to set the deployment target to be 13.0.

Below is the Podfile (post install portion). Please replace your development team 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
Leontineleontyne answered 25/10, 2023 at 16:21 Comment(2)
You don't have to set the team id for library tagets since all of them will be signed after building & signing the app target.Thill
I found that this line config.build_settings["DEVELOPMENT_TEAM"] = "YOUR TEAM ID" which is unnecessary, just do the for loop and config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' which is okay.Cabotage
E
4

I added the below code in a pod file and fixed this issue, Please install podfile after adding this below code. After that build your project.

Also follow this link steps https://mcmap.net/q/233788/-clang-error-sdk-does-not-contain-39-libarclite-39-at-the-path

 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
Escolar answered 26/10, 2023 at 12:40 Comment(0)
A
1

No thing worked for me. after I have changed the Podfile like this and it start working again. don't understand this but finally it running and publish successfully.

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
Arcane answered 21/9, 2023 at 11:23 Comment(0)
P
1

Set minimum deployment for all packages under Pods. (for my project iOS 14.0 is working fine)

enter image description here

Potentate answered 26/5 at 10:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.