instacart / TrueTime.swift

NTP library for Swift and Objective-C. Get the true time impervious to device clock changes.
https://tech.instacart.com/truetime/
Apache License 2.0
586 stars 130 forks source link

Xcode 14.3 compatibility needed to resolve error: libarclite_iphonesimulator.a file not found #106

Open jordanhbuiltbyhq opened 1 year ago

jordanhbuiltbyhq commented 1 year ago

TrueTime is a dependency of our SDK we distribute via CocoaPods. When we build an XCFramework using xcodebuild from the 14.3 command line tools and run pod lib lint it fails with the following error:

Ld /Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/TrueTime.build/Objects-normal/x86_64/Binary/TrueTime normal x86_64 (in target 'TrueTime' from project 'Pods')
    cd /var/folders/4t/7g326jh57pg0k71lf8fbhmf80000gn/T/CocoaPods-Lint-20230419-87560-1sy6dj0-OurSDKNameHere/Pods
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target x86_64-apple-ios8.0-simulator -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk -L/Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/EagerLinkingTBDs/Release-iphonesimulator -L/Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Products/Release-iphonesimulator/TrueTime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/usr/lib/swift -F/Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/EagerLinkingTBDs/Release-iphonesimulator -F/Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Products/Release-iphonesimulator/TrueTime -filelist /Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/TrueTime.build/Objects-normal/x86_64/TrueTime.LinkFileList -install_name @rpath/TrueTime.framework/TrueTime -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/TrueTime.build/Objects-normal/x86_64/TrueTime_lto.o -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/TrueTime.build/Objects-normal/x86_64/TrueTime.swiftmodule -framework Foundation -Xlinker -no_adhoc_codesign -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/TrueTime.build/Objects-normal/x86_64/TrueTime_dependency_info.dat -o /Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/TrueTime.build/Objects-normal/x86_64/Binary/TrueTime
ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a

... more logs here ...

** BUILD FAILED **

    The following build commands failed:
        Ld /Users/Jordan/Library/Developer/Xcode/DerivedData/App-hclqfopkuzccksahrrngahsmzywo/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/TrueTime.build/Objects-normal/x86_64/Binary/TrueTime normal x86_64 (in target 'TrueTime' from project 'Pods')
    (1 failure)
   Testing with `xcodebuild`. 
 -> OurSDKNameHere (5.0.0)
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.

Flutter had this same error (issue) and fixed it (pull request) by updating transitive dependencies to a minimum version of at least iOS 9. It seems TrueTime needs to do the same. Explained in that PR, it happens because:

Xcode 14.3 (released March 30, 2023) stopped building automatic reference counted (ARC) code targeting < iOS 9 or < macOS 10.11 by removing a libarclite_* library from the toolchain that was needed to link for these older targets.

I also recommend filing issues with any pods you see hitting this to suggest they updated to a minimum of at least iOS 9 and macOS 10.11. For example https://github.com/openid/AppAuth-iOS/pull/761

Sun3 commented 1 year ago

I am having the same error:

Error (Xcode): File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
kivocsa99 commented 1 year ago

confirming that this still happens on flutter 3.10.0 macos 13

RaghavTheGreat1 commented 1 year ago

Any solution for this, because I facing the same error(nowadays very frequently) since I upgraded to Flutter 3.10

One fix I have found is to add the following line to the podfile

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'] = '13.0'
      end
    end
  end

  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
arbile26 commented 1 year ago

Still happening with flutter 3.10 flutter doctor: ✓] Flutter (Channel stable, 3.10.0, on macOS 13.3.1 22E772610a darwin-arm64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [✓] Xcode - develop for iOS and macOS (Xcode 14.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.1) [✓] VS Code (version 1.78.0) [✓] Connected device (3 available) [✓] Network resources

liu0527aa commented 11 months ago

yeah,i met the same problem when i use the carthage library to build

jordanhbuiltbyhq commented 11 months ago

We switched to Kronos, it's working great :)