altool --upload-package bitcode-build-tool internal error (iOS app)

On: MacBook M1, MacOS 12.4, Xcode 13.4.1 (the issue was present in the previous Xcode version too).

When executing (for an iOS app): "xcrun altool --upload-package ...", I've started getting (it didn't happen before) this error sequentially 28 times:

2022-06-07 07:58:57.740 *** Error: /Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool, terminated with status: 2 2022-06-07 07:58:57.740 *** Error: /Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool (2): bitcode-build-tool internal error Traceback (most recent call last):  File "/Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool", line 10, in   bitcode_build_tool_main(sys.argv)  File "/Applications/Xcode.app/Contents/Developer/usr/bin/../lib/bitcode_build_tool/main.py", line 65, in main   env.initState(args)  File "/Applications/Xcode.app/Contents/Developer/usr/bin/../lib/bitcode_build_tool/buildenv.py", line 160, in initState   self.logger.debug("SDK path: {}".format(self.sdk)) AttributeError: 'BuildEnvironment' object has no attribute 'sdk'

After the errors are printed the upload-package starts the upload – though it no longer will show the upload progress – and eventually finishes without issue. I added some debug prints in buildenv.py and sure enough the args has "sdk_path=None".

Anyone else experiencing this? Any ideas on how to fix it?

Post not yet marked as solved Up vote post of sesingh Down vote post of sesingh
1.2k views

Replies

Yes we're experiencing exactly the same error since a while.

Same here!

Same here after going to Monterey

Hey @sesingh,

What version of the Command Line Tools are you using with Xcode?

Are you modifying your IPA file after archiving in any capacity? What are you export options set as? The Xcode verbose logs contain tons of errors that have not been resolved over the years so the Bitcode errors could be legit or misleading.

What is the exit code of altool when you get the error? You can get it by running the below command.

echo $?

Hopefully we can find a clue to correct the issue.

Happy coding!

  • version: "xcode-select version 2395".

    And no, I'm not modifying the IPA whatsoever. All I do is "xcodebuild -exportArchive ..." and once that is completed I do "xcrun altool --upload-package ...".

    The altool doesn't actually exit with an error, it just prints a bunch of python errors and then continues.

Add a Comment
2022-06-14 19:06:41.060 *** Error: /Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool (2): bitcode-build-tool internal error
Traceback (most recent call last):

  File "/Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool", line 10, in <module>

    bitcode_build_tool_main(sys.argv)

  File "/Applications/Xcode.app/Contents/Developer/usr/bin/../lib/bitcode_build_tool/main.py", line 65, in main

    env.initState(args)

  File "/Applications/Xcode.app/Contents/Developer/usr/bin/../lib/bitcode_build_tool/buildenv.py", line 159, in initState

    self.logger.debug("SDK path: {}".format(self.sdk))

AttributeError: 'BuildEnvironment' object has no attribute 'sdk'

same error. When I just call altool there is no any erroneous output.

Experiencing same issue, any solutions?

Issue solved, try to update command line tools by typing softwareupdate --install -a

  • That didn't fix it for me. My command line tools are current. "softwareupdate --install -a" outputs: "No updates are available.".

Add a Comment

No change in my status: % softwareupdate --install -a Software Update Tool

Finding available software No updates are available.

Same here any update or fix ?

softwareupdate didn't help me either. Anybody?

I experienced the same thing, but after killing altool process by using Activity Monitor, the problem disappears.

I reinstalled Command Line Tools for Xcode 13.4 and it worked, the link is here: https://developer.apple.com/download/all/?q=Command%20Line%20Tools%20for%20Xcode%2013.4