title: Building FFMPEG library for iOS6.0 ARMv7 Processor
body: <p><strong>WARNING:</strong></p>
  
  <p>I was just informed by another user that there are some legal issues revolving around using FFMPEG for iOS, leaving the link here <a href="http://multinc.com/2009/08/24/compatibility-between-the-iphone-app-store-and-the-lgpl/" rel="nofollow">http://multinc.com/2009/08/24/compatibility-between-the-iphone-app-store-and-the-lgpl/</a></p>
  
  <p>I cleaned up my question a little bit, when I wrote it the first time I was flustered. Now I can be more clear after taking a small break.</p>
  
  <blockquote>
    <p>Edit: learned that you have to build for ARMv7, ARMv7s and iOS6.0</p>
  </blockquote>
  
  <p>I'm trying to use the FFMPEG library in an XCode 4.5.1 project. And I'm trying to build it for ARMv7. What I'm looking for is the exact process, and some explanation. I understand that this is not a well documented problem. But I know that other pople have had the same problem as me.</p>
  
  <p><strong>What I have been able to do.</strong></p>
  
  <p>I have been able to build the library for testing.</p>
  
  <p>1) I have been able to clone ffmpeg. For beginners this will get you started by creating a directory with the ffmpeg source. (Kudos to the guys who wrote it)</p>
  
  <blockquote>
    <p>git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg</p>
  </blockquote>
  
  <p>2) I have been able to write a  config file that doesn't have any errors. We will go back to this part later. This is the command I attach to ./configure</p>
  
  <blockquote>
    <p>./configure 
    --disable-doc 
    --disable-ffmpeg 
    --disable-ffplay 
    --disable-ffserver 
    --enable-cross-compile 
    --arch=arm 
    --target-os=darwin 
    --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2</p>
    
    <p>--as='gas-preprocessor/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2'</p>
    
    <p>--sysroot=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk</p>
    
    <p>--cpu=cortex-a8 
    --extra-ldflags='-arch=armv7 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk'
    --enable-pic --disable-bzlib --disable-gpl --disable-shared --enable-static --disable-mmx --disable-debug --disable-neon --extra-cflags='-pipe -Os -gdwarf-2 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
    -m${thumb_opt:-no-thumb} -mthumb-interwork'</p>
  </blockquote>
  
  <p>These are some things to note.</p>
  
  <ul>
  <li>I had to download ( <a href="https://github.com/yuvi/gas-preprocessor" rel="nofollow">https://github.com/yuvi/gas-preprocessor</a> ) copy the file gas-preprocessor.pl at /usr/local/bin. Set permissions to read write (777)</li>
  <li>Make sure I'm using the right GCC compiler: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2</li>
  <li>Make sure I'm using the right SDK: /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk</li>
  <li>--extra-cflags="-arch armv7" causes: error: unrecognized command line option “-arch”</li>
  </ul>
  
  <p><strong>Here in lies the problem.</strong></p>
  
  <p>I can include the library like so</p>
  
  <blockquote>
    <p>libavcodec/avcodec.h</p>
  </blockquote>
  
  <p>But when I started to write the encoder. I received this warning, and countless errors.</p>
  
  <blockquote>
    <p>ignoring file /Users/Jimmy/Development/source.ffmpeg/Library/libavutil.a, file was built for archive which is not the architecture being linked (armv7s): /Users/Jimmy/Development/source.ffmpeg/Library/libavutil.a</p>
  </blockquote>
  
  <p>That means that I didn't build the right binary.</p>
  
  <p><strong>What I'm looking for is someone whose done it before, to walk all of us through the process of building FFMPEG for iOS6.0 and ARMv7 and the majority of things to look out for.</strong> Thanks a ton.</p>