Xcode 12.5 bitcode error with static library bazel xcodebuil.

Xcode 12.5 bitcode error with static library bazel xcodebuil.
I am a third-party technology provider. Our output product is a static library, built with Bazel, supports bitcode, and the built IDE is XCode11.
It is normal to use static libraries in Xcode 12.4, but after IDE upgrade to 12.5, bitcode is no longer supported, and an error is always reported:This is an LLVM bug.
Code Block
"Wrong number of operands
!124 = !{!"branch_weights", i32 1, i32 2001, i32 2001, i32 2001, i32 2000}
Wrong number of operands
!124 = !{!"branch_weights", i32 1, i32 2001, i32 2001, i32 2001, i32 2000}
Wrong number of operands
!124 = !{!"branch_weights", i32 1, i32 2001, i32 2001, i32 2001, i32 2000}
Wrong number of operands
!124 = !{!"branch_weights", i32 1, i32 2001, i32 2001, i32 2001, i32 2000}
Wrong number of operands
!124 = !{!"branch_weights", i32 1, i32 2001, i32 2001, i32 2001, i32 2000}
Wrong number of operands
!124 = !{!"branch_weights", i32 1, i32 2001, i32 2001, i32 2001, i32 2000}
Wrong number of operands
!124 = !{!"branch_weights", i32 1, i32 2001, i32 2001, i32 2001, i32 2000}
LLVM ERROR: Broken module found, compilation aborted!
clang: error: unable to execute command: Abort trap: 6
clang: error: linker command failed due to signal (use -v to see invocation)
Command Ld failed with a nonzero exit code"


If I switch the build IDE from XCode11 to XCode12.5, it will cause all IDEs not using XCode12.5 to support bitcode. Error log:
Code Block
"ld: could not reparse object file in bitcode bundle: 'Invalid bitcode version (Producer: '1205.0.22.9.0_0' Reader: '1200.0.32.28_0')', using libLTO version 'LLVM version 12.0.0, (clang-1200.0.32.28)' for architecture armv7"

I have the similar issue, but I got this error from appcenter builds.

Settings the ENABLE_BITCODE=no will successfully run the build but this is NOT a good workaround.

I'm still investigating this issue and what lib/pod is triggering this error.
btw, did you managed to find a fix?
I found out what was causing this issue:
  • a library that was updated 5-6 days ago, compiled with Xcode 12.5 for M1 chip support

  • the library used is RealmJS

My suggestion is to find out which library was updated and try to downgrade it to a lower version.
Xcode 12.5 bitcode error with static library bazel xcodebuil.
 
 
Q