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

Archiving an iOS app that links against code built with 1.52-nightly yields an LLVM ld error #83106

Closed
dcow opened this issue Mar 14, 2021 · 8 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-ios Operating system: iOS

Comments

@dcow
Copy link

dcow commented Mar 14, 2021

Rust C-FFI libraries built with 1.52-nightly are not able to be archived into an iOS application using the Xcode Version 12.4 (12D4e):

ld: could not reparse object file in bitcode bundle: 'Unknown attribute kind (68) (Producer: 'LLVM12.0.0-rust-1.52.0-nightly' Reader: 'LLVM APPLE_1_1200.0.32.29_0')', using libLTO version 'LLVM version 12.0.0, (clang-1200.0.32.29)' for architecture arm64

For more detailed context and steps to reproduce, see discussion on: #79408. Building with the previous "release" nightly 2020-12-31 resolves the issue.

I'm not sure whether there's anything for rust to do here of if we just have to wait for Xcode to update.

@dcow
Copy link
Author

dcow commented Mar 14, 2021

Attempting to archive using Xcode Version 12.5 beta 3 (12E5244e):

ld: could not reparse object file in bitcode bundle: 'Unknown attribute kind (104) (Producer: 'LLVM12.0.0-rust-1.52.0-nightly' Reader: 'LLVM APPLE_1_1205.0.22.6_0')', using libLTO version 'LLVM version 12.0.5, (clang-1205.0.22.6)' for architecture arm64

@dcow
Copy link
Author

dcow commented Aug 24, 2021

I tested 1.55 nightly with the new Xcode 13 beta (which uses llvm 12+). I no longer have an issue building or archiving.

@dcow
Copy link
Author

dcow commented Aug 27, 2021

A similar error has reappeared with rust nightly 1.56 and Xcode 13 beta:

ld: Invalid value (Producer: 'LLVM13.0.0-rust-1.56.0-nightly' Reader: 'LLVM APPLE_1_1300.0.29.3_0') for architecture arm64

@dcow
Copy link
Author

dcow commented Aug 31, 2021

Just going to put a table here for reference

rust version llvm version Xcode version
1.51 11 12
1.52 12 13
1.53 12 13
1.54 12 13
1.55 12 13
1.56 13 (none)

@xcarpentier
Copy link

Also put a link with the match xcode / lvvm versions: https://en.wikipedia.org/wiki/Xcode#Xcode_11.x_-_13.x_(since_SwiftUI_framework)_2

@screenzen
Copy link

Hey, I'm getting this error still when trying to archive. Any ideas how to resolve? Thanks!
Invalid value (Producer: 'LLVM13.0.0-rust-1.57.0-stable' Reader: 'LLVM APPLE_1_1300.0.29.3_0') for architecture arm64

@Dylan-DPC Dylan-DPC added O-ios Operating system: iOS C-bug Category: This is a bug. labels Feb 21, 2023
@workingjubilee workingjubilee added the A-linkage Area: linking into static, shared libraries and binaries label Mar 4, 2023
@workingjubilee
Copy link
Member

Bitcode is now deprecated by Apple going forward, and this seems to be a bug related to bitcode, and was expressed as fixed by at least one person, so I am closing this on the assumption that this is not actually a problem today.

@dcow
Copy link
Author

dcow commented Mar 4, 2023

Bitcode is now deprecated by Apple going forward, and this seems to be a bug related to bitcode, and was expressed as fixed by at least one person, so I am closing this on the assumption that this is not actually a problem today.

I don't believe this was a bitcode error, strictly. I believe this is an unfortunate but probably unavoidable consequence of building with bleeding edge Rust and targeting Apple devices. Rust was generating binaries using llvm 13 and Xcode was trying to parse them with llvm 12. Essentially Rust was writing a newer format than Xcode thought it understood (in practice everything worked fine when executing, Xcode would just barf when running "validations" at the time of packaging and uploading to Apple). If this version miss-match is only limited to bitcode's binary format (I'm not 100% on the details of the mechanics here and what the scope of libLTO is) and not generally applicable to link-time optimizations, then yes it's more or less a bitcode error and hopefully won't pop up in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-ios Operating system: iOS
Projects
None yet
Development

No branches or pull requests

5 participants