Carthage: Improve documentation around interaction between subdependencies which check into `Carthage/Checkouts` and correspondingly-named-but-maybe-different-and-maybe-also-intended-to-override dependencies from elsewhere in the dependency graph and why they don't override.

Created on 6 Aug 2019  Â·  33Comments  Â·  Source: Carthage/Carthage

Hi,

I was wondering if Carthage compiles desired versions of subsequent dependencies.

My case is that my project depends on ReactiveSwift and ReactiveCocoa so I have both dependencies in my _Cartfile_. As I'd love to use Xcode 11 Beta, I require ReactiveSwift ~> 6.1 as this is the first version compilable by Xcode 11.

Problem is that while _ReactiveSwift_ compiles correctly, _ReactiveCocoa_ fails to compile. I assume that when compiling _ReactiveCocoa_ Carthage checkouts _ReactiveSwift 6.0.0_ as stated in _ReactiveCocoa_'s 10.0.0 _Cartfile.resolved_. I assume this as calling carthage update in _Carthage/Checkouts/ReactiveCocoa_ and then carthage build in my project makes _ReactiveCocoa_ to compile successfully.

So question is if this behavior is correct when my Cartfile requires ReactiveSwift ~> 6.1 and 6.1 is also fetched according to Carthage log?

Thanks in advance.

  • carthage install method: [ ] .pkg, [x] homebrew, [ ] source
  • which carthage: /usr/local/bin/carthage
  • carthage version: 0.33.0
  • xcodebuild -version: Xcode 11.0 Build version 11M382q
  • Are you using --no-build? No
  • Are you using --no-use-binaries? No
  • Are you using --use-submodules? No
  • Are you using --cache-builds? Yes
  • Are you using --new-resolver? Yes

Cartfile

github "ReactiveCocoa/ReactiveSwift" ~> 6.1
github "ReactiveCocoa/ReactiveCocoa" ~> 10.0

Carthage Output

Jakub-MacBook:tst olejnjak$ carthage update --platform iOS --cache-builds --new-resolver
*** Fetching ReactiveCocoa
*** Fetching ReactiveSwift
*** Checking out ReactiveSwift at "6.1.0"
*** Checking out ReactiveCocoa at "10.0.0"
*** No cache found for ReactiveSwift, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/carthage-xcodebuild.c6IZXm.log
*** Building scheme "ReactiveSwift-iOS" in ReactiveSwift.xcworkspace
*** Building scheme "ReactiveCocoa-iOS" in ReactiveCocoa.xcworkspace
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -workspace /private/tmp/tst/Carthage/Checkouts/ReactiveCocoa/ReactiveCocoa.xcworkspace -scheme ReactiveCocoa-iOS -configuration Release -derivedDataPath /Users/olejnjak/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11M382q/ReactiveCocoa/10.0.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/ReactiveCocoa SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /tmp/tst/Carthage/Checkouts/ReactiveCocoa)

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

Actual outcome
Carthage is unable to compile ReactiveCocoa

Expected outcome
Should Carthage compile ReactiveCocoa?

help wanted

Most helpful comment

The minimal reproducible input is _Cartfile_ shared in description of this issue, so yes I am sure that I have no other dependency that requires ReactiveSwift 6.0.0 (and if so I think that as that Cartfile requires ~> 6.1) I think I'd receive an error that dependencies are unsatisfiable.

Throughout this thread I removed ~/Library/Caches/org.carthage.CarthageKit, ./Carthage and ./Cartfile.resolved. I also stopped using --cache-builds parameter. I think that there is no more cache I can purge.

Also my friend @fortmarek reproduces this issue in 100 % cases so I think it is not caching issue.

All 33 comments

Require == 6.1

That produces the same compile error

Jakub-MacBook:tst olejnjak$ cat Cartfile
github "ReactiveCocoa/ReactiveSwift" == 6.1
github "ReactiveCocoa/ReactiveCocoa" ~> 10.0
Jakub-MacBook:tst olejnjak$ carthage update --platform iOS --cache-builds --new-resolver
*** Fetching ReactiveSwift
*** Fetching ReactiveCocoa
*** Checking out ReactiveSwift at "6.1.0"
*** Checking out ReactiveCocoa at "10.0.0"
*** No cache found for ReactiveSwift, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/carthage-xcodebuild.lfqWaT.log
*** Building scheme "ReactiveSwift-iOS" in ReactiveSwift.xcworkspace
*** Building scheme "ReactiveCocoa-iOS" in ReactiveCocoa.xcworkspace
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -workspace /private/tmp/tst/Carthage/Checkouts/ReactiveCocoa/ReactiveCocoa.xcworkspace -scheme ReactiveCocoa-iOS -configuration Release -derivedDataPath /Users/olejnjak/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11M382q/ReactiveCocoa/10.0.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/ReactiveCocoa SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /tmp/tst/Carthage/Checkouts/ReactiveCocoa)

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

I'm just wondering whether this is intended behavior or a bug. If this is a bug I'll try to fix that, just wanna know if there is something to fix 🙂

Are there any errors that might point us in the right direction in the build log?

Not sure, I can just share the log

carthage-xcodebuild.eNX6ZS.log

Looks like a build error in ReactiveSwift. I don’t use the project — is it ready for Xcode 11 and Swift 5.1? Don’t know how far you want to go into troubleshooting, but if you clone the ReactiveSwift project does it build in Xcode?

tmp/tst/Carthage/Checkouts/ReactiveCocoa/Carthage/Checkouts/ReactiveSwift/Sources/Signal.swift:1851:71: error: will never be executed
                                lifetime += action(index, strategy) { observer.send($0.map { _ in fatalError() }) }
                                                                                                  ^
/tmp/tst/Carthage/Checkouts/ReactiveCocoa/Carthage/Checkouts/ReactiveSwift/Sources/Signal.swift:1851:64: note: '_' is uninhabited, so this function body can never be executed
                                lifetime += action(index, strategy) { observer.send($0.map { _ in fatalError() }) }
                                                                                           ^

** ARCHIVE FAILED **

As I mentioned - ReactiveSwift 6.0.0 is not compiable in Xcode 11 and Swift 5.1, but version 6.1.0 is. And that's the reason why running carthage update in _Carthage/Checkouts/ReactiveCocoa_ and then carthage build in project fixes the issue.

That's the reason why I assume that Carthage tries to build _ReactiveCocoa_ with _ReactiveSwift 6.0.0_ as stated in ReactiveCocoa's _Cartfile.resolved_ even though I have ReactiveSwift ~> 6.1 in my _Cartfile_

I suspect something is off with the caches. Delete all cache and you .resolved file and run bootstrap

Still the same issue, maybe it is worth noting that _ReactiveSwift 6.1.0_ is successfully compiled and later on it fails to compile when compiled as dependency of _ReactiveCocoa_, so obviously _ReactiveSwift_ is compiled in different version when compiled as dependency of _ReactiveCocoa_

```
Jakub-MacBook:tst olejnjak$ rm -rf ~/Library/Caches/org.carthage.CarthageKit/
Jakub-MacBook:tst olejnjak$ rm -rf Carthage/
Jakub-MacBook:tst olejnjak$ rm -rf Cartfile.resolved
Jakub-MacBook:tst olejnjak$ carthage bootstrap --platform iOS --new-resolver
* No Cartfile.resolved found, updating dependencies
Cloning ReactiveSwift
Cloning ReactiveCocoa
Checking out ReactiveSwift at "6.1.0"
Checking out ReactiveCocoa at "10.0.0"
xcodebuild output can be found in /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/carthage-xcodebuild.VbV6yC.log
Building scheme "ReactiveSwift-iOS" in ReactiveSwift.xcworkspace
*
Building scheme "ReactiveCocoa-iOS" in ReactiveCocoa.xcworkspace
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -workspace /private/tmp/tst/Carthage/Checkouts/ReactiveCocoa/ReactiveCocoa.xcworkspace -scheme ReactiveCocoa-iOS -configuration Release -derivedDataPath /Users/olejnjak/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11M382q/ReactiveCocoa/10.0.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/ReactiveCocoa SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /tmp/tst/Carthage/Checkouts/ReactiveCocoa)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/carthage-xcodebuild.VbV6yC.log```

on Tag 6.1 the line of code that is failing seems correct https://github.com/ReactiveCocoa/ReactiveSwift/blob/6.1.0/Sources/Signal.swift#L1851

So carthage is not building the version it should build. Pin BOTH ReactiveSwift and ReactiveCocoa with ==

So carthage is not building the version it should build. Pin BOTH ReactiveSwift and ReactiveCocoa with ==

It looks like that. When using == for both dependencies the issue is still the same.

Jakub-MacBook:tst olejnjak$ rm -rf ~/Library/Caches/org.carthage.CarthageKit/
Jakub-MacBook:tst olejnjak$ rm -rf Carthage/
Jakub-MacBook:tst olejnjak$ rm -rf Cartfile.resolved 
Jakub-MacBook:tst olejnjak$ cat Cartfile 
github "ReactiveCocoa/ReactiveSwift" == 6.1
github "ReactiveCocoa/ReactiveCocoa" == 10.0
Jakub-MacBook:tst olejnjak$ carthage bootstrap --platform iOS --new-resolver
*** No Cartfile.resolved found, updating dependencies
*** Cloning ReactiveSwift
*** Cloning ReactiveCocoa
*** Checking out ReactiveCocoa at "10.0.0"
*** Checking out ReactiveSwift at "6.1.0"
*** xcodebuild output can be found in /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/carthage-xcodebuild.NJm0xP.log
*** Building scheme "ReactiveSwift-iOS" in ReactiveSwift.xcworkspace
*** Building scheme "ReactiveCocoa-iOS" in ReactiveCocoa.xcworkspace
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -workspace /private/tmp/tst/Carthage/Checkouts/ReactiveCocoa/ReactiveCocoa.xcworkspace -scheme ReactiveCocoa-iOS -configuration Release -derivedDataPath /Users/olejnjak/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11M382q/ReactiveCocoa/10.0.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/ReactiveCocoa SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /tmp/tst/Carthage/Checkouts/ReactiveCocoa)

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

The checkout version is not 6.1.0 for some reason. Can you go to the git localtion to confirm that?

Yes it is 6.0.0 base on changelog which is part of ReactiveSwift repository

Jakub-MacBook:ReactiveSwift olejnjak$ pwd
/tmp/tst/Carthage/Checkouts/ReactiveCocoa/Carthage/Checkouts/ReactiveSwift
Jakub-MacBook:ReactiveSwift olejnjak$ cat CHANGELOG.md | head
# master
*Please add new entries at the top.*

# 6.0.0
1. Dropped support for Swift 4.2 (Xcode 9)
2. Removed dependency on https://github.com/antitypical/Result (#702, kudos to @NachoSoto and @mdiep)

**Upgrade to 6.0.0**

* If you have used `Result` only as dependency of `ReactiveSwift`, remove all instances of `import Result`, `import enum Result.NoError` or `import struct Result.AnyError` and remove the `Result` Framework from your project.

This looks like a bug to me. Are you sure you don't have any other dependency requiring 6.0.0 ? Or that there is a bad checkout cached somewhere?

The minimal reproducible input is _Cartfile_ shared in description of this issue, so yes I am sure that I have no other dependency that requires ReactiveSwift 6.0.0 (and if so I think that as that Cartfile requires ~> 6.1) I think I'd receive an error that dependencies are unsatisfiable.

Throughout this thread I removed ~/Library/Caches/org.carthage.CarthageKit, ./Carthage and ./Cartfile.resolved. I also stopped using --cache-builds parameter. I think that there is no more cache I can purge.

Also my friend @fortmarek reproduces this issue in 100 % cases so I think it is not caching issue.

Have you tried --new-resolver

Yes all commands had --new-resolver

Hi, I'm not seeing this problem with the regular resolver:

$ xcode-select -p
/Applications/Xcode_10.2.app/Contents/Developer
$ cat Cartfile
github "ReactiveCocoa/ReactiveSwift" ~> 6.1
github "ReactiveCocoa/ReactiveCocoa" ~> 10.0
$ carthage bootstrap --platform iOS
*** Checking out ReactiveCocoa at "10.0.0"
*** Checking out ReactiveSwift at "6.1.0"
*** xcodebuild output can be found in /var/folders/b4/qz7m1r9x3mj1bm3nfsjjf64m0000gp/T/carthage-xcodebuild.u7ME9q.log
*** Building scheme "ReactiveSwift-iOS" in ReactiveSwift.xcworkspace
*** Building scheme "ReactiveCocoa-iOS" in ReactiveCocoa.xcworkspace
*** Building scheme "ReactiveMapKit-iOS" in ReactiveCocoa.xcworkspace
$ cat Cartfile.resolved
github "ReactiveCocoa/ReactiveCocoa" "10.0.0"
github "ReactiveCocoa/ReactiveSwift" "6.1.0"

Hi,

the output of new resolver is the same, the point is that Carthage does something different than what it outputs to the log. In Carthage/Checkouts/ReactiveSwift there is correctly version 6.1.0. But if you go to Carthage/Checkouts/ReactiveCocoa/Carthage/Checkouts there is version 6.0.0, its Build folder is symlinked to Carthage/Build of project, so folders Carthage/Checkouts/ReactiveCocoa/Carthage/Checkouts and Carthage/Checkouts/ReactiveCocoa/Carthage/Build point to different versions of ReactiveSwift. And according to this I think that Carthage builds ReactiveSwift using the incorrect checkout in Carthage/Checkouts/ReactiveCocoa/Carthage/Checkouts, rather than the one that will be used in the final app.

Use Xcode 11, the issue is there obvious as ReactiveCocoa 10.0.0 is compilable in Xcode 11 if compiled with ReactiveSwift 6.1.0. The issue is the same while using Xcode 10.x, but while using Xcode 11, it is more obvious as it fails to compile.

Jakub-MacBook:tst olejnjak$ xcversion selected
Xcode 11.0
Build version 11M382q
Jakub-MacBook:tst olejnjak$ cat Cartfile
github "ReactiveCocoa/ReactiveSwift" ~> 6.1
github "ReactiveCocoa/ReactiveCocoa" ~> 10.0
Jakub-MacBook:tst olejnjak$ carthage bootstrap --platform iOS
*** No Cartfile.resolved found, updating dependencies
*** Fetching ReactiveSwift
*** Fetching ReactiveCocoa
*** Checking out ReactiveCocoa at "10.0.0"
*** Checking out ReactiveSwift at "6.1.0"
*** xcodebuild output can be found in /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/carthage-xcodebuild.6sYv6O.log
*** Building scheme "ReactiveSwift-iOS" in ReactiveSwift.xcworkspace
*** Building scheme "ReactiveCocoa-iOS" in ReactiveCocoa.xcworkspace
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -workspace /private/tmp/tst/Carthage/Checkouts/ReactiveCocoa/ReactiveCocoa.xcworkspace -scheme ReactiveCocoa-iOS -configuration Release -derivedDataPath /Users/olejnjak/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11M382q/ReactiveCocoa/10.0.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/ReactiveCocoa SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /tmp/tst/Carthage/Checkouts/ReactiveCocoa)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/lm/syft_2w9151gjr9d844tjg5h0000gn/T/carthage-xcodebuild.6sYv6O.log

It still doesn't work if using regular resolver.

Jakub-MacBook:tst olejnjak$ cat Carthage/Checkouts/ReactiveSwift/CHANGELOG.md | head -n4 | tail -n1 | cut -f2 -d" "
6.1.0
Jakub-MacBook:tst olejnjak$ cat Carthage/Checkouts/ReactiveCocoa/Carthage/Checkouts/ReactiveSwift/CHANGELOG.md | head -n4 | tail -n1 | cut -f2 -d" "
6.0.0

ok, I see this too.

I've created a simple shell script which reproduces the issue.

Script steps:

  1. create problematic Cartfile
  2. perform carthage checkout
  3. check that ReactiveSwift version in Carthage/Checkouts/ReactiveSwift matches version in Carthage/Checkouts/ReactiveCocoa/Carthage/Checkouts/ReactiveSwift based on value in its CHANGELOG.md

carthage_checkout_test.sh.txt

Well maybe the premise that incorrect version is checked out is invalid as ReactiveCocoa does have Carthage/Checkout in git, that's why there is ReactiveSwift 6.0.0.

But still even though I think that it should be able to compile as the 6.0.0 version should not be used when running bootstrap.

So question is - should Carthage/Checkouts/<Dependency>/Carthage/Checkouts always be a symlink to Carthage/Checkouts or even Carthage/Checkouts/Dependency/Carthage be a symlink to Carthage?

Having this issue too. @olejnjak do you have a workaround for it?

The only workaround I have is to run carthage update in Carthage/Checkouts/<Dependency> and then carthage build in your project. Then it might be useful to commit Carthage/Checkouts if you do not commit it already.

Makes sense....thank you olejnjak! Will use this workaround for now...

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Do we have any opinion on this? https://github.com/Carthage/Carthage/issues/2844#issuecomment-520528708

And other point - is it something worth fixing? As obviously not many people experienced this issue.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Yes but I think of it as a workaround, not a fix. Still I'm curious about this question https://github.com/Carthage/Carthage/issues/2844#issuecomment-520528708

Not sure if dependencies (e.g. ReactiveCocoa 10.0.0) should be compiled with different version of their own dependencies (in this case ReactiveSwift 6.0.0), when in the final project itself the version will be different (ReactiveSwift 6.1.0).

So, when dependencies in your Cartfile have their subdependencies checked in to Carthage/Checkouts (as submodules or files and folders), we don't overwrite whats there — and it's really a namespace issue.

If a dependency’s Cartfile.private is used to manage non-shared, but needed for building subdependencies like, say xcconfigs — another dependency's xcconfigs doing an overwrite with symlink in Carthage/Checkouts because the larger combined-from-your-Cartfile-and-your-Cartfile.private-and-your-subdependency's-Cartfiles has one named xcconfigs could have disastrous results.

Good point, I think that with this we can consider this as known limitation and close this issue right?

Turned it into a documentation improvement ticket.

As I mentioned - ReactiveSwift 6.0.0 is not compiable in Xcode 11 and Swift 5.1, but version 6.1.0 is. And that's the reason why running carthage update in _Carthage/Checkouts/ReactiveCocoa_ and then carthage build in project fixes the issue.

That's the reason why I assume that Carthage tries to build _ReactiveCocoa_ with _ReactiveSwift 6.0.0_ as stated in ReactiveCocoa's _Cartfile.resolved_ even though I have ReactiveSwift ~> 6.1 in my _Cartfile_

v6.1.0 is working with xcode 11.3

Was this page helpful?
0 / 5 - 0 ratings