Carthage often fails build- with a random xcodebuild error

Created on 30 May 2016  路  14Comments  路  Source: Carthage/Carthage

  • carthage version: 0.16.2
  • xcodebuild -version: 7.3
  • Are you using --no-build? No
  • Are you using --no-use-binaries? No
  • Are you using --use-submodules? No

Carthage Output

** BUILD FAILED **

A shell task (/usr/bin/xcrun xcodebuild -project /Users/dcg/Desktop/git/ios-charts/ChartsRealm/ChartsRealm.xcodeproj -scheme ChartsRealm-iOS -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** BUILD FAILED **


The following build commands failed:
        Ld /Users/dcg/Library/Developer/Xcode/DerivedData/ChartsRealm-awkviyhwwiusraefxhcbyfgemped/Build/Intermediates/Charts.build/Release-iphoneos/Charts-OSX.build/Objects-normal/arm64/Charts normal arm64
        Ld /Users/dcg/Library/Developer/Xcode/DerivedData/ChartsRealm-awkviyhwwiusraefxhcbyfgemped/Build/Intermediates/Charts.build/Release-iphoneos/Charts-OSX.build/Objects-normal/armv7/Charts normal armv7
(2 failures)

And always- when taking the xcodebuild command from the log and running it - it succeeds.
Doing it again - it succeeds.
Running carthage - Fails again.
The log - always contains a random error. Not the same error...

Most helpful comment

Same problem here, I found the cause: massive bug in Xcode.

If you ever install a second version of Xcode, Xcode internally disables the command-line tools.

They are still there. You can use them from any command-line. They work perfectly. But ... xcode claims they are missing, because it's scared that you might want to use the old version of the new version.

You have to go into Xcode preferences, go to "Locations" tab, and you'll find the command-line tools dropdown has been wiped, with a note saying "none selected". Select anything, and ... problem goes away.

All 14 comments

What's in the xcodebuild log?

Sometimes "Cocoa framework not found" (when it's irrelevant, defined away in a multi-platform definition file), sometimes it's complaints about minimum deployment target of tvOS being too low, not matching a dependency (wrong), sometimes it's just random compilation errors about files that compiled just fine a minute ago.

But I can't stress this enough: When running the same xcodebuild command manually (copy-paste from the log) into the terminal, it runs fine!
It does not matter if I run it once, twice, or 10 times - it will run fine manually all of the times.
But when running Carthage, it will randomly fail, and not always on the same scheme.

sometimes it's complaints about minimum deployment target of tvOS being too low

Are you trying to build for tvOS? Or are you trying to build for iOS?

I've had Xcode get confused when building iOS projects through a workspace鈥攚here the dependencies are included as Xcode projects. Sometimes it seems to choose the wrong platform for implicit dependencies, in which case you need to switch to using explicit dependencies.

Do you have a Cartfile that you can share? Can you share the full output from running carthage?

It's a project with multiple targets, for iOS, tvOS, and OSX.
https://github.com/danielgindi/Charts

The only thing the Cartfile contains is:
github "facebook/ios-snapshot-test-case" ~> 2.1

I've made some efforts to assist Carthage, by raising minimum deployment target and other adjustments, but the same still happens.

What I did eventually is uncheck the "Shared" on most schemes, achieve a successful Carthage build, then check some other ones. If Carthage fails for one- run it again. Until it has built all of them, and then call archive.

The weird thing is that if I collect the xcodebuild commands and run them consecutively it runs just fine with no errors...
Maybe sometiming issue, maybe it takes Xcode some time to clear the cache between builds.
In one of the logs I've seen it confuse a dependency (another project in the workspace) and use the wrong target, OSX, for a tvOS build, when running right after successfully building the OSX target. And failing of course because of "Cocoa framework not found".

I'm not sure if it's appropriate to paste the log files here as they are huge...

Hi Daniel,
I'm getting the same error, funnily enough trying to build your iOS-Charts with Carthage in XCode 8. No problems with Code Signing anywhere else. Any clues about the issue?:

A shell task (/usr/bin/xcrun xcodebuild -project /Users/***/Carthage/Checkouts/Charts/Charts.xcodeproj CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) failed with exit code 72:
xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

Thanks by the way for what seems like a great library! ... If I can access it!-)

Is this still happening?

Well we don't know, we've moved away from Carthage since every other version causes trouble with builds. We've spent too much time trying to make it work...
And since Apple recommends against pre-built binaries now until ABI compatibility is ready, there's not much point in this (for the moment)

Same problem here, I found the cause: massive bug in Xcode.

If you ever install a second version of Xcode, Xcode internally disables the command-line tools.

They are still there. You can use them from any command-line. They work perfectly. But ... xcode claims they are missing, because it's scared that you might want to use the old version of the new version.

You have to go into Xcode preferences, go to "Locations" tab, and you'll find the command-line tools dropdown has been wiped, with a note saying "none selected". Select anything, and ... problem goes away.

The following should be the answer:

Sometimes it seems to choose the wrong platform for implicit dependencies, in which case you need to switch to using explicit dependencies.

Closing.

@ikesyo I don't see how that would affect the cause of these error messages that I ran into, but maybe there's more than one issue here?

I was not answering to you, but to the original issue.

@adamgit I think that the issue you had is separate one and that is _really_ Xcode problem, not tied to Carthage itself.

Sometimes it seems to choose the wrong platform for implicit dependencies, in which case you need to switch to using explicit dependencies.

You do this like this:

carthage update --platform ios

ios isn't mandatory, just one of the arguments.

I have had some kind of problem, and I solved it with changing the framework version in the Cartfile))

Was this page helpful?
0 / 5 - 0 ratings