iOS / Xcode Archive fails with: “Touch” and then “ARCHIVE FAILED”, but no other error in the log

#1

Bitrise Build Issue Report template

Description of the issue

iOS / Xcode Archive fails with: “Touch” and then “ARCHIVE FAILED”, but no other error in the log

Environment:

Bitrise.io @ osx-vs4mac-stable

Which build Step causes the issue and which version of the step?

xcode-archive
version: 2.4.5

ipa export configs:
- ExportMethod: app-store
- UploadBitcode: yes
- CompileBitcode: yes
- TeamID: ***
- UseDeprecatedExport: no
- CustomExportOptionsPlistContent:
xcodebuild configs:
- OutputTool: xcpretty
- Workdir: /Users/vagrant/git
- ProjectPath: ios/eyr.xcworkspace
- Scheme: productName
- Configuration: Release
- OutputDir: /Users/vagrant/deploy
- IsCleanBuild: no
- XcodebuildOptions: 
- ForceTeamID: 
- ForceProvisioningProfileSpecifier: 
- ForceProvisioningProfile: 
- ForceCodeSignIdentity: 
step output configs:
- IsExportXcarchiveZip: no
- ExportAllDsyms: yes
- ArtifactName: eyr
- VerboseLog: yes
step determined configs:
- xcodebuildVersion: 9.2.0 (9C40b)
- xcprettyVersion: 0.2.8

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO (no caches in pipeline yet)
  • Does the issue happen sporadically, or every time? : sporadically
  • Does upgrading the build Step to the latest version help? : NO (using latest)
  • When did the issue start? : yesterday

Local reproduction

_Can it be reproduced on your own Mac/PC by following our local debug guide? NO. But it fails later with Code Signing issue due to certificate-and-profile-installer Run-If .IsCI with the same exit code 65

  • Testing with a full clean git clone +
  • Test with the Bitrise CLI (1-4) +

Build log

0 Likes

#2

Thanks for filling out the whole report, it helped a lot!

Found the issue in the raw-xcodebuild-output.log. You can find this file on the build’s page, in the Apps & Artifacts section/tab:

This error is one of the rare cases when the error is not at the end of the Xcode build log, but somewhere a bit above that. Around its end but like 100 lines before its end, that’s why you can’t see that in the bitrise.io build log directly (usually the error is in the last couple of lines, so to not to make the build logs even more verbose we only print the last 10 lines in the Xcode Archive step).

Anyway, so in a case like yours, when the bitrise.io build log does not include the Xcode error:

  1. Go to the Build’s page
  2. Into Apps & Artifacts section
  3. Locate and download the raw-xcodebuild-output.log (if the file’s not there please make sure you have the Deploy to Bitrise.io step in the workflow, as that’s the step which attaches this file to the build -> more info: Xcode exit code 65 / exit code 66 / raw-xcodebuild-output.log )
  4. Then search for error: in the raw xcodebuild output log (e.g. with grep : $ grep 'error:' ~/Downloads/raw-xcodebuild-output.log)

In your case:

$ grep 'error:' ~/Downloads/raw-xcodebuild-output.log

While reading /Users/vagrant/git/ios/eyr/Images.xcassets/AppIcon.appiconset/AppIcon40@3x.png pngcrush caught libpng error:

The lines around this:

CopyPNGFile /Users/vagrant/Library/Developer/Xcode/DerivedData/eyr-aovrweneodzgtabgzxwvaqvvrcvp/Build/Intermediates.noindex/ArchiveIntermediates/eyr/InstallationBuildProductsLocation/Applications/eyr.app/AppIcon40@3x.png eyr/Images.xcassets/AppIcon.appiconset/AppIcon40@3x.png
    cd /Users/vagrant/git/ios
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/vagrant/.bitrise/tools:/usr/local/bin:/usr/local/sbin:~/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/usr/local/opt/go/libexec/bin:/Users/vagrant/go/bin:/Users/vagrant/bitrise/tools/cmd-bridge/bin/osx:/Users/vagrant/Library/Developer/Xamarin/android-sdk-macosx/tools:/Users/vagrant/Library/Developer/Xamarin/android-sdk-macosx/tools/bin:/Users/vagrant/Library/Developer/Xamarin/android-sdk-macosx/platform-tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands"
    export TOOLCHAINS=
    /Applications/Xcode.app/Contents/Developer/usr/bin/copypng -compress -strip-PNG-text /Users/vagrant/git/ios/eyr/Images.xcassets/AppIcon.appiconset/AppIcon40@3x.png /Users/vagrant/Library/Developer/Xcode/DerivedData/eyr-aovrweneodzgtabgzxwvaqvvrcvp/Build/Intermediates.noindex/ArchiveIntermediates/eyr/InstallationBuildProductsLocation/Applications/eyr.app/AppIcon40@3x.png

While reading /Users/vagrant/git/ios/eyr/Images.xcassets/AppIcon.appiconset/AppIcon40@3x.png pngcrush caught libpng error:
   \2478p\247Zv\241\270\333\367\277\343v\241\374~\247\370u\2479


Command /Applications/Xcode.app/Contents/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure

This means that there’s some issue with that image. The most common issue is that the .png file is not a PNG file actually, e.g. it’s actually a JPG saved with .png extension (Xcode can’t handle this).

Fix the image, commit & push and it should be fine again :wink:

If you’d have any questions just let us know!
Happy Building! :slight_smile:

0 Likes

#3

Yeah, but still can’t understand how xcodebuild works locally and in addition images look just OK according to pngcheck

pngcheck *.png           
OK: AppIcon1024.png (1024x1024, 32-bit RGB+alpha, non-interlaced, 99.0%).
OK: AppIcon167.png (167x167, 32-bit RGB+alpha, non-interlaced, 96.6%).
OK: AppIcon20@2x.png (40x40, 32-bit RGB+alpha, non-interlaced, 85.5%).
OK: AppIcon20@3x.png (60x60, 32-bit RGB+alpha, non-interlaced, 90.9%).
OK: AppIcon20.png (20x20, 32-bit RGB+alpha, non-interlaced, 71.3%).
OK: AppIcon29@2x.png (58x58, 32-bit RGB+alpha, non-interlaced, 90.5%).
OK: AppIcon29@3x.png (87x87, 32-bit RGB+alpha, non-interlaced, 93.9%).
OK: AppIcon29.png (29x29, 32-bit RGB+alpha, non-interlaced, 80.9%).
OK: AppIcon40@2x.png (80x80, 32-bit RGB+alpha, non-interlaced, 93.1%).
OK: AppIcon40@3x.png (120x120, 32-bit RGB+alpha, non-interlaced, 95.5%).
OK: AppIcon40.png (40x40, 32-bit RGB+alpha, non-interlaced, 85.5%).
OK: AppIcon60@2x.png (120x120, 32-bit RGB+alpha, non-interlaced, 95.5%).
OK: AppIcon60@3x.png (180x180, 32-bit RGB+alpha, non-interlaced, 96.8%).
OK: AppIcon60.png (60x60, 32-bit RGB+alpha, non-interlaced, 90.9%).
OK: AppIcon76@2x.png (152x152, 32-bit RGB+alpha, non-interlaced, 96.2%).
OK: AppIcon76@3x.png (228x228, 32-bit RGB+alpha, non-interlaced, 97.4%).
OK: AppIcon76.png (76x76, 32-bit RGB+alpha, non-interlaced, 92.7%).
OK: icon_camera_back.png (512x512, 8-bit palette+trns, non-interlaced, 98.7%).
OK: icon_camera_front.png (512x512, 8-bit palette+trns, non-interlaced, 98.8%).
OK: icon_mic_disabled.png (512x512, 8-bit palette+trns, non-interlaced, 97.1%).
OK: icon_mic_enabled.png (512x512, 8-bit palette+trns, non-interlaced, 98.5%).
OK: phone_hangup@2x.png (100x100, 32-bit RGB+alpha, non-interlaced, 92.2%).
OK: phone_hangup@3x.png (150x150, 32-bit RGB+alpha, non-interlaced, 94.4%).
OK: phone_hangup.png (50x50, 32-bit RGB+alpha, non-interlaced, 85.5%).

No errors were detected in 24 of the 24 files tested.
0 Likes

#4

Also with local

bitrise run workflow-id

it’s not the case

0 Likes

#5

Previous build intermediates on your own Mac might include a previous version of the image, in which case Xcode might not attempt to copy it again.

0 Likes