apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.87k stars 718 forks source link

Carthage fails to compile Apollo Playground #1793

Closed justinswart closed 3 years ago

justinswart commented 3 years ago

I initially commented on a closed issue (#1392) but realized I should have probably opened a new one.

Bug report

Carthage installation is failing for me on *** Building scheme "Apollo Playground" in Apollo.xcodeproj. I'm running Xcode 12.2 (also tried 12.5), here's the output:

~/d/carthage-test $ carthage bootstrap --use-xcframeworks --platform iOS
*** No Cartfile.resolved found, updating dependencies
*** Fetching apollo-ios
*** Checking out apollo-ios at "0.43.0"
*** xcodebuild output can be found in /var/folders/j0/scg4rxsd58j5w4njqh0xmc7c0000gq/T/carthage-xcodebuild.wKvEuY.log
*** Building scheme "Apollo" in Apollo.xcodeproj
*** Building scheme "ApolloCore" in Apollo.xcodeproj
*** Building scheme "Apollo Playground" in Apollo.xcodeproj
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/justinswart/dev/carthage-test/Carthage/Checkouts/apollo-ios/Apollo.xcodeproj -scheme Apollo\ Playground -configuration Release -derivedDataPath /Users/justinswart/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/apollo-ios/0.43.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/j0/scg4rxsd58j5w4njqh0xmc7c0000gq/T/apollo-ios SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/justinswart/dev/carthage-test/Carthage/Checkouts/apollo-ios)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/j0/scg4rxsd58j5w4njqh0xmc7c0000gq/T/carthage-xcodebuild.wKvEuY.log

I dug into the build log and noticed this output:

[DEBUG - ApolloCodegenLib:CLIDownloader.swift:72] - Downloading zip file with the CLI...
[DEBUG - ApolloCodegenLib:CLIDownloader.swift:123] - CLI zip file successfully downloaded!
[DEBUG - ApolloCodegenLib:CLIExtractor.swift:39] - Apollo folder doesn't exist, extracting CLI from zip file.
[DEBUG - ApolloCodegenLib:CLIExtractor.swift:117] - Extracting CLI from zip file. This may take a second...
[DEBUG - ApolloCodegenLib:Basher.swift:59] -
[ERROR - ApolloCodegenLib:Basher.swift:55] - dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.66.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
/bin/bash: line 1: 80416 Abort trap: 6           '/Users/justinswart/dev/carthage-test/Carthage/Checkouts/apollo-ios/SwiftScripts/ApolloCLI/apollo/bin/run' --version

Error: Task failed with code 134.
SHASUM of downloaded file: ff50f341f09fe7ef8e125412fb14f0f3359ac0adfb7864cf2a9c8a99d5a7e6e5
SHASUM of downloaded file: ff50f341f09fe7ef8e125412fb14f0f3359ac0adfb7864cf2a9c8a99d5a7e6e5
Command PhaseScriptExecution failed with a nonzero exit code

I've tried:

Appreciate any pointers on how I could resolve this!

Thanks.

Versions

Please fill in the versions you're currently using:

Steps to reproduce

I am able to reproduce this by:

  1. Creating an empty folder with a Cartfile with the only entry being github "apollographql/apollo-ios".
  2. Running carthage update --platform iOS. I've tried this with and without the workaround script.
justinswart commented 3 years ago

The best issues are those that resolve themselves! Turns out this was because I had a broken/outdated node installation. Fixed with brew upgrade node.