Carthage: Incompatible with Xcode 9 New Build System

Created on 23 Jun 2017  ·  3Comments  ·  Source: Carthage/Carthage

  • carthage version: 0.23.0
  • xcodebuild -version: Xcode 9.0 (Build version 9M137d)
  • Are you using --no-build? No.
  • Are you using --no-use-binaries? No.
  • Are you using --use-submodules? No.
  • Are you using --cache-builds? No.

With Xcode New Build System

Cartfile

github "TintPoint/Overlay" "9b650a401ab25d6ed0fd6b9c11624f4675b2e0ed"

Carthage Output

> carthage update
*** Checking out Overlay at "9b650a401ab25d6ed0fd6b9c11624f4675b2e0ed"
*** xcodebuild output can be found in /var/folders/8_/50yhmqsx707b9p23hj_lns680000gn/T/carthage-xcodebuild.cqRGfQ.log
*** Building scheme "Overlay" in Overlay.xcodeproj
Failed to write to ~/<ProjectName>/Carthage/Build/iOS/Overlay.framework: Error Domain=NSCocoaErrorDomain Code=260 "The file “Overlay.framework” couldn’t be opened because there is no such file." UserInfo={NSFilePath=~/Library/Caches/org.carthage.CarthageKit/DerivedData/Overlay/9b650a401ab25d6ed0fd6b9c11624f4675b2e0ed/Build/Products/Release-iphoneos/Overlay.framework, NSUnderlyingError=0x7f802dc72250 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

With Xcode Old Build System

This is the same project. The only change is I switched back to the old build system. Link: https://github.com/TintPoint/Overlay/commit/d903b7ae8f2cae50775b4d4499e72190a577e3dc

Cartfile

github "TintPoint/Overlay" "d903b7ae8f2cae50775b4d4499e72190a577e3dc"

Carthage Output

> carthage update
*** Checking out Overlay at "d903b7ae8f2cae50775b4d4499e72190a577e3dc"
*** xcodebuild output can be found in /var/folders/8_/50yhmqsx707b9p23hj_lns680000gn/T/carthage-xcodebuild.hyv7ig.log
*** Building scheme "Overlay" in Overlay.xcodeproj
help wanted

Most helpful comment

This is still an issue with Xcode 9 GM and Carthage 0.25.

All 3 comments

Just tried it out myself. It looks like it's due to us doing a clean action. In the old build system, a 'clean' would clean only products and intermediate build objects

Clean.Remove clean <user-home>/Library/Caches/org.carthage.CarthageKit/DerivedData/Overlay/d903b7ae8f2cae50775b4d4499e72190a577e3dc/Build/Intermediates.noindex/Overlay.build/Release-iphoneos/Overlay.build
    builtin-rm -rf <user-home>/Library/Caches/org.carthage.CarthageKit/DerivedData/Overlay/d903b7ae8f2cae50775b4d4499e72190a577e3dc/Build/Intermediates.noindex/Overlay.build/Release-iphoneos/Overlay.build

Clean.Remove clean <user-home>/Library/Caches/org.carthage.CarthageKit/DerivedData/Overlay/d903b7ae8f2cae50775b4d4499e72190a577e3dc/Build/Products/Release-iphoneos/Overlay.framework
    builtin-rm -rf <user-home>/Library/Caches/org.carthage.CarthageKit/DerivedData/Overlay/d903b7ae8f2cae50775b4d4499e72190a577e3dc/Build/Products/Release-iphoneos/Overlay.framework

Clean.Remove clean <user-home>/Library/Caches/org.carthage.CarthageKit/DerivedData/Overlay/d903b7ae8f2cae50775b4d4499e72190a577e3dc/Build/Products/Release-iphoneos/Overlay.framework.dSYM
    builtin-rm -rf <user-home>/Library/Caches/org.carthage.CarthageKit/DerivedData/Overlay/d903b7ae8f2cae50775b4d4499e72190a577e3dc/Build/Products/Release-iphoneos/Overlay.framework.dSYM

** CLEAN SUCCEEDED **

But in the new system, they just decided to go and blow away the whole Build folder

Removing '<user-home>/Library/Caches/org.carthage.CarthageKit/DerivedData/Overlay/9b650a401ab25d6ed0fd6b9c11624f4675b2e0ed/Build'

This appears to only be a problem for platforms that we do a architecture merge with. Any other scheme immediately performs a copy. But for the simulator situation, we sequence the two architecture sets (device, simulator), merge the products, _then_ do a copy. Possible solutions I can think of:
- Move the frameworks into a staging area when finished, then perform the binary merge from there, instead of just doing the merge directly from the build products directory
- Since we already customize our derived data, further split it up by whether it's a simulator sdk or not, so a device clean doesn't clobber a simulator build.

According to Apple the new build system does have a different clean behavior. To be more specific, the old system offers two options: clean and clean the build folder. The new system only offers one option: clean the build folder.

This is still an issue with Xcode 9 GM and Carthage 0.25.

Was this page helpful?
0 / 5 - 0 ratings