Carthage: carthage copy-frameworks seems to be broken with 0.36.1

Created on 28 Jan 2021  路  12Comments  路  Source: Carthage/Carthage

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

Cartfile

github "SVProgressHUD/SVProgressHUD" ~> 2.2
github "ivanbruel/MarkdownKit" ~> 1.5
github "pocketsvg/PocketSVG" ~> 2.5.0

Carthage Output

*** Checking out PocketSVG at "2.5.0"
*** Checking out MarkdownKit at "1.6"
*** Checking out SVProgressHUD at "2.2.5"
*** Building scheme "MarkdownKit" in MarkdownKit.xcworkspace
*** Building scheme "PocketSVG (iOS)" in Demos.xcworkspace
*** Building scheme "SVProgressHUD-Framework" in SVProgressHUD.xcodeproj

Actual outcome
carthage copy-frameworks fails with the following error message:

In attempt to read NSBundle 芦file:///Users/john/git/appsmono/ios/Apps/Calprotectin/Carthage/Build/iOS/PocketSVG.framework/禄's binary url, could not relativize 芦file:///Users/john/git/appsmono/ios/Carthage/Build/iOS/PocketSVG.framework/PocketSVG禄 against 芦file:///Users/john/git/appsmono/ios/Apps/Calprotectin/Carthage/Build/iOS/PocketSVG.framework/禄.

You can replace the framework with an arbitrary one. It does not solve the problem.

Expected outcome
Carthage should copy the frameworks correctly.

I could trace that back the problem to the changes in the current version. Rolling carthage version back to 0.36.0 fixes the problem.

https://github.com/Carthage/Carthage/compare/0.36.0...0.36.1

We are using the recommended shell script since a few weeks and updated the contents with the ones in the Documentation/Xcode12Workaround.md. Did also not help! Caches were cleared accordingly and we also used a brand-new machine to simulate a build from scratch.

Most helpful comment

I had the same issue as the OP on 0.36.1 and downgrading to 0.36.0 solved the issue for me.

All 12 comments

Same here, I setup a new buildserver with carthage 0.36.1 -> the build fails.
On my laptop I first had 0.36.0 installed, the build succeeded, now after the upgrade to 0.36.1, the build also works.

Same here, I setup a new buildserver with carthage 0.36.1 -> the build fails.
On my laptop I first had 0.36.0 installed, the build succeeded, now after the upgrade to 0.36.1, the build also works.

Did you also clear the Build folder and remove DerivedData? I cannot successfully build our project with 0.36.1 馃槥馃馃.

No. You鈥榬e right. I was happy that it still works on my laptop.
I also installed version 0.36.0 on our buildserver and it works now.

I see, you also have a symlink to a shared Carthage-folder right?
This is also on our buildserver. Have you tried it without it?

No. You鈥榬e right. I was happy that it still works on my laptop.
I also installed version 0.36.0 on our buildserver and it works now.

I see, you also have a symlink to a shared Carthage-folder right?
This is also on our buildserver. Have you tried it without it?

Hm that's indeed a good idea! Thanks @mfreiwald! Haven't thought about that one but given the fact, that the release is out for a few days without any other report of that type of problem, this could be the solution. I am going to give it a shot tomorrow!

I had the same issue as the OP on 0.36.1 and downgrading to 0.36.0 solved the issue for me.

Any news about that with Version 0.37.0?

@mfreiwald Still got the same issue with version 0.37.0. As far as I can trace that issue down, it seems related to the symlinks. In our project structure, we have to use those symlinks. I guess we just stick to 0.36.0 until we replaced everything with SwiftPM. The issue acts as a booster for us to finish that transition.

After further investigation I found source of the problem, but I'm not sure how to solve it:
Precondition: main project has custom framework and both of them has dependency on the same framework (AFNetworking in my example).

public func nonDestructivelyStripArchitectures(_ frameworkURL: URL, _ architectures: Set<String>) -> SignalProducer<(Data, URL), CarthageError> {
    return SignalProducer(value: frameworkURL)
        .attemptMap(binaryURL)
        .attemptMap {
            let frameworkPathComponents = sequence(state: frameworkURL.absoluteURL.pathComponents.makeIterator(), next: {
                $0.next() ?? ""
            })
      // frameworkURL:
      // file:///Users/vitaliigozhenko/Work/test-carthage-issue-project/Carthage/Checkouts/MyAnotherFramework/Carthage/Build/iOS/AFNetworking.framework/
      // binaryURL:
      // file:///Users/vitaliigozhenko/Work/test-carthage-issue-project/Carthage/Build/iOS/AFNetworking.framework/AFNetworking

      let suffix = zip(frameworkPathComponents, $0.pathComponents).drop(while: { $0 == $1 })
      // suffix has 2 path components that was not dropped: Optional(("Checkouts", "Build")))

      if suffix.contains(where: { $0.0 != "" }) { // And it fails here because there is 2 more elements 
                return .failure(CarthageError.internalError(description: "In attempt to read NSBundle 芦\(frameworkURL.absoluteString)禄's binary url, could not relativize 芦\($0.debugDescription)禄 against 芦\(frameworkURL.absoluteString)禄."))
            }
...

Most likely it is related to symlink, because
file:///Users/vitaliigozhenko/Work/test-carthage-issue-project/Carthage/Checkouts/MyAnotherFramework/Carthage/Build
is symlink to the Build folder in parent project:
file:///Users/vitaliigozhenko/Work/test-carthage-issue-project/Carthage/Build

My team and I are also seeing this issue with 0.36.1 and 0.37.0

Does someone testet it with 0.38? https://github.com/Carthage/Carthage/pull/3152

Does someone testet it with 0.38? #3152

Sry, we just cut out the last pieces of Carthage from our repository and solely rely on SwiftPM.

Does someone testet it with 0.38? #3152

I have and I am seeing the same issue.

Was this page helpful?
0 / 5 - 0 ratings