After upgrading to 0.21 (using brew upgrade carthage), I started to see various filesystem errors while copy-frameworks is run in a Build Phase.
I tried doing bootstrap, update (both with and without --cache-builds), but the result is still the same – the script stops on a particular framework (Kingfisher 3.6.2) with various filesystem errors, which tend to differ between ⌘B hits.
Failed to write to /<redacted>/Library/Developer/Xcode/DerivedData/<redacted>-hfdzmzweexlzswgvsyoqupohotyp/Build/Products/<redacted>-iphonesimulator/<redacted>.app/Frameworks/Kingfisher.framework: Error Domain=NSCocoaErrorDomain Code=516 "“Kingfisher.h” couldn’t be copied to “Headers” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/<redacted>/Carthage/Build/iOS/Kingfisher.framework/Headers/Kingfisher.h, NSUserStringVariant=(
Copy
), NSDestinationFilePath=/<redacted>/Library/Developer/Xcode/DerivedData/<redacted>-hfdzmzweexlzswgvsyoqupohotyp/Build/Products/<redacted>-iphonesimulator/<redacted>.app/Frameworks/Kingfisher.framework/Headers/Kingfisher.h, NSFilePath=/<redacted>/Carthage/Build/iOS/Kingfisher.framework/Headers/Kingfisher.h, NSUnderlyingError=0x7f8c7187f5f0 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
Failed to write to /<redacted>/Library/Developer/Xcode/DerivedData/<redacted>-hfdzmzweexlzswgvsyoqupohotyp/Build/Products/<redacted>-iphonesimulator/<redacted>.app/Frameworks/Kingfisher.framework: Error Domain=NSCocoaErrorDomain Code=516 "“Modules” couldn’t be copied to “Kingfisher.framework” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/<redacted>/Carthage/Build/iOS/Kingfisher.framework/Modules, NSUserStringVariant=(
Copy
), NSDestinationFilePath=/<redacted>/Library/Developer/Xcode/DerivedData/FitnessApp-hfdzmzweexlzswgvsyoqupohotyp/Build/Products/<redacted>-iphonesimulator/<redacted>.app/Frameworks/Kingfisher.framework/Modules, NSFilePath=/<redacted>/Carthage/Build/iOS/Kingfisher.framework/Modules, NSUnderlyingError=0x7fe5a735ed30 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
I suspect it to be a regression because switching back to 0.20.1 (using brew switch carthage 0.20.1) and rebuilding the project (with or without doing bootstrap again), copy-frameworks works as expected.
I will try to attach some reproducible project tomorrow (I just wanted to report the issue itself as soon as possible).
carthage version: 0.21
xcodebuild -version: 8.3.2 (8E2002)
--no-build: no
--no-use-binaries: no
--use-submodules: no
--cache-builds: yes and no
Hi @akashivskyy, thanks for reporting this issue.
In Carthage 0.21, the copy-frameworks command now copies frameworks concurrently. I've been able to reproduce your issue by providing multiple identical input files to the copy-frameworks command. For example, with four identical copies of AFNetworking as my input files, I receive an error that is identical to the one that you've provided.
Is this the case with your inputs to copy-frameworks?
Regardless of whether this is the root cause of your issue, it sounds like Carthage should perhaps filter duplicate input files to prevent these types of errors from being possible.
Yes it is... I have 15 dependencies in my project and I must've missed that duplication. Removing the duplicated entry and switching version back to 0.21 works as expected (and quicker 😉).
Thanks for the response! IMO this issue can be closed as soon as #1902 is merged.
Most helpful comment
Hi @akashivskyy, thanks for reporting this issue.
In Carthage 0.21, the
copy-frameworkscommand now copies frameworks concurrently. I've been able to reproduce your issue by providing multiple identical input files to thecopy-frameworkscommand. For example, with four identical copies ofAFNetworkingas my input files, I receive an error that is identical to the one that you've provided.Is this the case with your inputs to
copy-frameworks?Regardless of whether this is the root cause of your issue, it sounds like Carthage should perhaps filter duplicate input files to prevent these types of errors from being possible.