title: Apple Command Line Tool: Force Universal Binary with a Single Arch?
body: <p>I'm porting a C/C++ library using the library's makefile. The library includes a test suite and I'm having some trouble getting the EXE to work as expected when only using a single architecture. Below is a sample produced by the makefile's recipe (formatting added for readability):</p>
  
  <pre><code>$ export IOS_PLATFORM=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
  $ make static dynamic cryptest.exe
  clang++ -DNDEBUG -g -Os -pipe -fPIC -arch armv7
    --sysroot $(IOS_PLATFORM)/Developer/SDKs/iPhoneOS6.1.sdk
    -miphoneos-version-min=5.0 -DCRYPTOPP_DISABLE_ASM=1 -c 3way.cpp
  clang++ -DNDEBUG -g -Os -pipe -fPIC -arch armv7
    --sysroot $(IOS_PLATFORM)/Developer/SDKs/iPhoneOS6.1.sdk
    -miphoneos-version-min=5.0 -DCRYPTOPP_DISABLE_ASM=1 -c adler32.cpp
  ...
  </code></pre>
  
  <p><em>IF</em> I build the EXE with a single architecture (<code>armv7</code>) as above, then running the executable results in "Bad CPU Type In Executable." <code>file</code> tells me its a Mach-O but not Universal:</p>
  
  <pre><code>$ file cryptest.exe
  cryptest.exe: Mach-O executable arm
  </code></pre>
  
  <p><em>IF</em> I build for multiple architectures (<code>armv7</code> and <code>armv7s</code>), then the program runs as expected.</p>
  
  <p><em>IF</em> I build for multiple architectures (<code>armv7</code> and <code>armv7s</code>) and strip an architecture, then the program runs as expected:</p>
  
  <pre><code>$ mv cryptest.exe cryptest.exe.bu
  $ xcrun -sdk iphoneos lipo cryptest.exe.bu -remove armv7s -output cryptest.exe
  $ codesign -fs "Jeffrey Walton" cryptest.exe
  cryptest.exe: replacing existing signature
  $ file cryptest.exe.bu
  cryptest.exe.bu: Mach-O universal binary with 2 architectures
  cryptest.exe.bu (for architecture armv7):   Mach-O executable arm
  cryptest.exe.bu (for architecture armv7s):  Mach-O executable arm
  $ file cryptest.exe
  cryptest.exe: Mach-O universal binary with 1 architecture
  cryptest.exe (for architecture armv7):  Mach-O executable arm
  </code></pre>
  
  <p>Is it possible to instruct Apple's command line tools to build a binary with the extra universal headers even though its only single arch (to save the extra work of removing the unused architecture)?</p>