title: Bitcode error packaging ipa using xcodebuild
body: <p>First off, I want to state that without bitcode , <strong>everything is working perfectly.</strong> The problems start when I turn on the "bitcode" flag in the app.</p>
  
  <p>Also, all of the builds are through a CI flow (not manually inside xcode->archive et.al).</p>
  
  <p>The framework is built in a separate flow from the app itself (The app embeds the compiled framework)</p>
  
  <p>I'm getting this error when I try to package the ipa:</p>
  
  <blockquote>
    <p>❌  ld: bitcode bundle could not be generated because
    '..../Framework.framework/Framework' was built without full bitcode.
    All frameworks and dylibs for bitcode must be generated from Xcode
    Archive or Install build for architecture armv7</p>
    
    <p>❌  clang: error: linker command failed with exit code 1 (use -v to see
    invocation)</p>
  </blockquote>
  
  <p><strong>Regarding the Framework:</strong></p>
  
  <p>I'm building the framework using the following command: (omitting technical details)</p>
  
  <pre><code># iphone (arm)
  xcodebuild -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
  
  # iphone (simulator)
  xcodebuild -configuration Release -sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
  </code></pre>
  
  <p>and then lipo (FAT binary)</p>
  
  <pre><code>lipo -create /Release-iphonesimulator/Framework.framework/Framework -output /Universal/Framework.framework/Framework
  </code></pre>
  
  <p>I've added the compiler flag to the framework to "embed bitcode"</p>
  
  <p><a href="https://i.stack.imgur.com/qG5Pu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qG5Pu.png" alt="enter image description here"></a></p>
  
  <p>And I even "validated" it has bitcode per other S.O. questions: (<a href="https://stackoverflow.com/questions/32868297/compiling-ios-library-with-bitcode-enabled">Compiling iOS library with bitcode enabled</a>)</p>
  
  <blockquote>
    <p>Also, the easiest way to check if the binary contains bitcode is to
    use otool and grep:</p>
    
    <p>otool -l binary_name | grep __LLVM</p>
    
    <p>you will see one or more segname __LLVM entries if it does have
    bitcode or empty output if does not.</p>
  </blockquote>
  
  <pre><code>otool -arch arm64 -l Frameworks/Framework.framework/Framework  | grep __LL
  segname __LLVM
  segname __LLVM
  </code></pre>
  
  <p>I've also tried the other variation of added a compile flag </p>
  
  <pre><code>xcodebuild OTHER_CFLAGS="-fembed-bitcode"
  </code></pre>
  
  <p>and had identical error reported to me</p>