Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: App Store rejects app containing Rust with bitcode error #7

Merged
merged 1 commit into from
Feb 11, 2020

Conversation

thombles
Copy link
Member

There is a python program used by Apple (included inside the Xcode.app bundle) which verifies a program's bitcode as part of rebuilding it. It includes a check that each bitcode object has valid clang parameters included as part of its XML xar header.

The Rust compiler sensibly chooses not to emit any clang parameters, since it is not clang. Unfortunately this means any Rust-emitted bitcode will not pass app store verification.

Locally, it produces an error like this one:

error: Clang option verification failed for bitcode 0038
(argument -emit-obj is required)

Through App Connect, it produces an error like this one:

ITMS-90562: Invalid Bundle - The app cannot be processed because options not
allowed to be embedded in bitcode are detected in the submission

Solution: Patch Rust so that it will embed exactly the same clang cmdline that Xcode/clang will when emitting Bitcode.

This patch is relatively brittle and not upstreamable in this form, but it serves well to demonstrate the problem and is likely to be a workable solution for now for anyone who wants to ship code.

There is a python program used by Apple (included inside the Xcode.app bundle)
which verifies a program's bitcode as part of rebuilding it. It includes a
check that each bitcode object has valid clang parameters included as part of
its XML xar header.

The Rust compiler sensibly chooses not to emit any clang parameters, since it
is not clang. Unfortunately this means any Rust-emitted bitcode will not pass
app store verification.

Locally, it produces an error like this one:

```
error: Clang option verification failed for bitcode 0038 (argument -emit-obj is
required)
```

Through App Connect, it produces an error like this one:

```
ITMS-90562: Invalid Bundle - The app cannot be processed because options not
allowed to be embedded in bitcode are detected in the submission
```

Solution: Patch Rust so that it will embed exactly the same clang cmdline that
Xcode/clang will when emitting Bitcode.

This patch is relatively brittle and not upstreamable in this form, but it
serves well to demonstrate the problem and is likely to be a workable solution
for now for anyone who wants to ship code.
Copy link
Member

@hamchapman hamchapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@thombles thombles merged commit 6c48bfc into master Feb 11, 2020
@thombles thombles deleted the tk/llvm-cmdline branch February 11, 2020 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants