title: "Bad system call: 12" crashes when using a static framework on iOS with IPA-deployment (not Xcode run)
body: <p>I'm working with a static framework I've created (built with the help of Karl Stenerud's <a href="https://github.com/kstenerud/iOS-Universal-Framework" rel="nofollow">iOS-Universal-Framework</a> toolchain), which I intend to distribute. A static framework's a bit more convenient than simply using a static lib + headers - I like the ability to just drop a framework in and begin using it immediately, instead of needing to do things like set up appropriate header search paths.</p>
  
  <p>However, I'm seeing some downright bizarre behaviour. Several test/sample apps that I have built with the framework are crashing with either "<em>Bad system call: 12</em>" or "<em>Job appears to have crashed: Illegal instruction: 4</em>" when run on iOS devices to which the app has been deployed <em>via an ipa</em>.</p>
  
  <p>The code itself is fine. The crash does not occur when a static library is used instead of a framework. It also doesn't crash if the app is deployed via the debugger in Xcode, even when the Release build configuration is used.</p>
  
  <p>The crash <em>only</em> happens when deployed via an ipa, and when the library is linked as a static framework.</p>
  
  <p>Interestingly, the corresponding crash log's stack trace entries leading up to the crash (which is EXC_CRASH or EXC_BAD_INSTRUCTION) cannot be symbolicated.</p>
  
  <p>In one instance, I was able to track the crash down to the point where a static C function is called. By removing the "static" keyword on a whim, I was able to stop the crash happening.</p>
  
  <p>Unfortunately, this doesn't appear to be the silver bullet - I'm also seeing a crash on a non-static C function call.</p>
  
  <p>But in all cases, the crash occurs when a C function is being called.</p>
  
  <p>So, my question is this: Has anyone else seen this before? Any theories? Is this likely to be an LLVM bug? Some magical compiler/linker flag I'm missing?  Have Apple deliberately only half-supported static frameworks because there are issues? Do I just need to abandon my plan to distribute a framework, instead of a static library and assorted detritus?</p>
  
  <p>Many thanks in advance,</p>
  
  <p>Michael</p>