Closed tailsu closed 2 years ago
This doesn't seem possible to fix easily. A README suggestion is good though. I'll close this when I add that.
Maybe also add a check like this?
#ifdef __APPLE__
#include "TargetConditionals.h"
#if defined(TARGET_OS_IPHONE) && !defined(INCBIN_SILENCE_BITCODE_WARNING)
#warning "incbin is incompatible with bitcode. Using the library will break upload to App Store if you have bitcode enabled. Add `#define INCBIN_SILENCE_BITCODE_WARNING` before including this header to silence this warning."
#endif
#endif
Done
Starting with Xcode 14, bitcode is no longer required for watchOS and tvOS applications, and the App Store no longer accepts bitcode submissions from Xcode 14.
https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes
Bitcode is an Apple technology that basically allows Apple to recompile apps submitted to the App Store at will for optimization reasons.
https://developer.apple.com/documentation/xcode/reducing_your_app_s_size/doing_basic_optimization_to_reduce_your_app_s_size
One of the limitations of this technology is that the app must be 100% buildable from the bitcode embedded into the binary, which I assume is in fact the LLVM IR. This apparently disallows any sort of architecture-specific assembly in the source code.
As a result, when trying to upload an app with bitcode enabled, ITMS returns this error:
While looking for a workaround, I found that Xcode allows one to add LLVM assembly sources to a project. I wasn't able to find a directive equivalent to
.incbin
in the LLVM assembly manual, though, but maybe I simply missed it.Anyway, the workaround, of course, is to recode any binaries into C-array literal syntax and compile them as C code.
I suggest that this issue be mentioned in the README. It would also be helpful if the library emits a warning if targeting the iOS platform.