ipatool failed with an exception: #<CmdSpec::NonZeroExitException:

I've been stuck with this error when tried to archive ad-hoc ipa with specific scheme. We are using our own library and just changed the app and library to bitcode enabled with Xcode 12.0.1

{
code = 1061;
description = "ipatool failed with an exception: #<CmdSpec::NonZeroExitException: $ /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool -v -t /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin --sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk -o /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/ipatool20201007-38381-1ennko/thinned-out/arm64/Payload/xx.app/Frameworks/xx.framework/xx --generate-dsym /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/ipatool20201007-38381-1ennko/thinned-out/arm64/Payload/xx.app/Frameworks/xx.framework/xx.dSYM --strip-swift-symbols /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/ipatool20201007-38381-1ennko/thinned-in/arm64/Payload/xx.app/Frameworks/xx.framework/xx\nStatus: pid 38458 exit 1\nStdout:\n SDK path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk\n SDK version: 14.0\n PATH: ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin', '/Applications/Xcode.app/Contents/Developer/usr/bin']\n Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo\n MachoInfo: cd /\n ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo', '-info', '/var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/ipatool20201007-38381-1ennko/thinned-in/arm64/Payload/xx.app/Frameworks/xx.framework/xx']\n -= Output =-\n Non-fat file: /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/ipatool20201007-38381-1ennko/thinned-in/arm64/Payload/xx.app/Frameworks/xx.framework/xx is architecture: arm64\n Exited with 0\n \n Command took 0 seconds\n Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dwarfdump\n GetUUID: cd /\n ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dwarfdump', '-u', '/var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/ipatool20201007-38381-1ennko/thinned-in/arm64/Payload/xx.app/Frameworks/xx.framework/xx']\n -= Output =-\n UUID: 80ACB50C-1F60-366A-AD7F-D177C1D5D980 (arm64) /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/ipatool20201007-38381-1ennko/thinned-in/arm64/Payload/xx.app/Frameworks/xx.framework/xx\n Exited with 0\n \n Command took 0 seconds\n Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/segedit\n ExtractXAR: cd /\n ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/segedit', '/var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/ipatool20201007-38381-1ennko/thinned-in/arm64/Payload/xx.app/Frameworks/xx.framework/xx', '-extract', 'LLVM', 'bundle', '/var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/XXximju4v3/xx.arm64.xar']\n -= Output =-\n Exited with 0\n \n Command took 0 seconds\n Bitcode bundle version: 1.0\n Setting platform to: iOS\n Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld\n Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang\n Clang: cd /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/tempbsidgad2\n ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-cc1', '-triple', 'arm64-apple-ios10.0.0', '-emit-obj', '-disable-llvm-passes', '-faligned-alloc-unavailable', '-target-abi', 'darwinpcs', '-Os', '-x', 'ir', '001', '-o', '001.o']\n -= Output =-\n Exited with 0\n \n Command took 0 seconds\n Clang: cd /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/tempbsidgad2\n ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-cc1', '-triple', 'arm64-apple-ios10.0.0', '-emit-obj', '-disable-llvm-passes', '-faligned-alloc-unavailable', '-target-abi', 'darwinpcs', '-Os', '-x', 'ir', '002', '-o', '002.o']\n -= Output =-\n Exited with 0\n \n Command took 0 seconds\n Clang: cd /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/tempbsidgad2\n ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-cc1', '-triple', 'arm64-apple-ios10.0.0', '-emit-obj', '-disable-llvm-passes', '-faligned-alloc-unavailable', '-target-abi', 'darwinpcs', '-Os', '-x', 'ir', '003', '-o', '003.o']\n
........
  • = Output =-\n Exited with 0\n \n Command took 0 seconds\n Clang: cd /var/folders/yz/074h5nb178vgtx127858nxk40000gn/T/tempbsidgad2\n ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-cc1', '-triple', 'arm64-apple-ios8.0.0', '-emit-obj', '-disable-llvm-optzns', '-target-abi', 'darwinpcs', '-O3', '-x', 'ir', '456', '-o', '456.o']\n -= Output =-\n Exited with 0\n \n Command took 0 seconds\n\nStderr:\n\n>\n /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:373:in run'\n /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2808:in block in CompileOrStripBitcodeInBundle'\n /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2747:in each'\n /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2747:in CompileOrStripBitcodeInBundle'\n /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3016:in block in ProcessIPA'\n /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2978:in each'\n /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2978:in ProcessIPA'\n /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3928:in <main>'";

info = {
};
level = ERROR;
type = exception;
}
);

Any help is appreciated. Thanks!
Same problem
I also had this issue, but wasn't using my own library. My workaround was to turn off Bitcode in in Targets > Build Settings > Enable Bitcode. I'd like to know why it doesn't work for when Bitcode is enabled though.
I am also getting same issue, I can't disable bitcode as it is an mandate for me,

error logs -
                {

            code = 1061;

            description = "ipatool failed with an exception: #<CmdSpec::NonZeroExitException: $ /Applications/Xcode12.0.app/Contents/Developer/usr/bin/python3 /Applications/Xcode12.0.app/Contents/Developer/usr/bin/bitcode-build-tool -v -t /Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/AFNetworkActivityLogger.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/AFNetworking.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/MagicalRecord.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/NUI.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/NUIParse.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/PromiseKit.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/Reachability.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/SAMKeychain.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks/Tweaks.framework -L /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/Frameworks --sdk /Applications/Xcode12.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk -o /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/MyTestApp --generate-dsym /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-out/arm64/Payload/MyTestApp.app/MyTestApp.dSYM --strip-swift-symbols /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-in/arm64/Payload/MyTestApp.app/MyTestApp\nStatus: pid 24989 exit 1\nStdout:\n    SDK path: /Applications/Xcode12.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk\n    SDK version: 14.0\n    PATH: ['/Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin', '/Applications/Xcode12.0.app/Contents/Developer/usr/bin']\n    Using: /Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo\n    MachoInfo: cd /\n     ['/Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo', '-info', '/var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-in/arm64/Payload/MyTestApp.app/MyTestApp']\n    -= Output =-\n    Non-fat file: /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-in/arm64/Payload/MyTestApp.app/MyTestApp is architecture: arm64\n    Exited with 0\n    \n    Command took 0 seconds\n    Using: /Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dwarfdump\n    GetUUID: cd /\n     ['/Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dwarfdump', '-u', '/var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-in/arm64/Payload/MyTestApp.app/MyTestApp']\n    -= Output =-\n    UUID: 3F3E2EFA-8272-3259-BADC-18F8200552EF (arm64) /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-in/arm64/Payload/MyTestApp.app/MyTestApp\n    Exited with 0\n    \n    Command took 0 seconds\n    Using: /Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/segedit\n    ExtractXAR: cd /\n     ['/Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/segedit', '/var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/ipatool20201012-17914-kc2g4k/thinned-in/arm64/Payload/MyTestApp.app/MyTestApp', '-extract', 'LLVM', 'bundle', '/var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/MyTestAppaj1v9dpt/MyTestApp.arm64.xar']\n    -= Output =-\n    Exited with 0\n    \n    Command took 0 seconds\n    Bitcode bundle version: 1.0\n    Setting platform to: iOS\n    Using: /Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld\n    Using: /Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang\n    Using: /Applications/Xcode12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc\n    Clang: cd /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/tempiktd6ck2\n     ['/Applications/Xcode_12.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-cc1', '-triple', 'arm64-apple-ios10.0.0', '-emit-obj', '-disable-llvm-passes', '-faligned-alloc-unavailable', '-target-sdk-version=14.0', '-target-abi', 'darwinpcs', '-O0', '-x', 'ir', '0001', '-o', '0001.o']\n    -= Output =-\n    Exited with 0\n    \n    Command took 0 seconds\n    Clang: cd /var/folders/mk/swmr9l0934vct6yv0xfvykgwkb7kl1/T/tempiktd6ck2\n    
Any update on this, I am struggling on this
We observe this same error when exporting ad hoc or development builds in Xcode 12 with bitcode recompilation enabled. We suspected an issue with a third party framework, so we created a version of our project without any external dependencies (the only frameworks we import are Apple's own e.g., StoreKit, CoreImage...). The problem persisted.

There are no problems using Xcode 11 - we can export the archive with bitcode recompilation and App Store processing works fine. Of course, we can't use any iOS 14 APIs with Xcode 11.

Our only option appears to be to disable bitcode in our project if we want to use Xcode 12. Given that we see failure when using only Apple frameworks, we believe that this as a bug that Apple needs to fix.
We solved the problem by following advice from https://developer.apple.com/forums/thread/662947

There appears to be a bug in Xcode 12 where enabling code coverage support causes bitcode recompilation failure. We don't need the code coverage support anyway.

1) In Build Settings 'Apple Clang - Code Generation' set 'Enable Code Coverage Support' to NO in the project.
2) In Build Settings ensure that '-fprofile-instr-generate' is not set in 'Other Linker Flags'.

With those steps complete, archiving and exporting with bitcode recompilation worked under Xcode 12.

[Error Log - ipatool failed with an exception: #]



Few workarounds u can try in build settings:

BITCODEGENERATIONMODE = bitcode;
OTHERCFLAGS = "-fembed-bitcode";
OTHER
CPLUSPLUSFLAGS = "$(OTHERCFLAGS)";
SKIP
INSTALL = YES;
GCCENABLEBUILTINFUNCTIONS = NO;
GCC
NOCOMMONBLOCKS = NO;
GCCOPTIMIZATIONLEVEL = 3;

And don't forget to set 'Enable Code Coverage Support' to NO
Turn off Bitcode in Targets > Build Settings > Enable Bitcode.

This solution work for me. My Xcode version Version 11.4.1 (11E503a)
ipatool failed with an exception: #&lt;CmdSpec::NonZeroExitException:
 
 
Q