title: What toolchain do I need to cross-compile Clang for iOS
body: <p>OK, so first of all I know that this can be compiled on iOS (armv7) because I read the documentation. However, I can't find the right toolchain.</p>
  
  <p>So, now, what toolchains I've already tried:</p>
  
  <pre><code>i686-apple-darwin10-cpp-4.2.1
  i686-apple-darwin10-g++-4.2.1
  i686-apple-darwin10-gcc-4.2.1
  </code></pre>
  
  <p>The above cross-compiles to x86 (I'm on i386). Works fine. But I don't need it</p>
  
  <pre><code>arm-apple-darwin10-cpp-4.2.1
  arm-apple-darwin10-g++-4.2.1
  arm-apple-darwin10-gcc-4.2.1
  </code></pre>
  
  <p>The above compiles fine, but doesn't cross compile to arm as I would have expected, instead, it simply compiles to my current arch.</p>
  
  <p>I'm a real beginner in this matter, in fact this is my first attempt to cross-compile something.</p>
  
  <p>UPDATE:</p>
  
  <p>Here are the commands that I've tried(this is for armv6; armv7 is similar):</p>
  
  <p>configure:</p>
  
  <pre><code>../llvm/configure --host=arm-apple-darwin6 --target=arm-apple-darwin6 
  --build=i386-apple-darwin --enable-optimized --disable-debug  
  --disable-expensive-checks --disable-doxygen  --disable-threads
  </code></pre>
  
  <p>env vars:</p>
  
  <pre><code>    export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
  export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk
  
  export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
  
      export CPP="$DEVROOT/usr/bin/arm-apple-darwin10-cpp-4.2.1"
  export CXX="$DEVROOT/usr/bin/arm-apple-darwin10-g++-4.2.1"
  export CXXCPP="$DEVROOT/usr/bin/arm-apple-darwin10-cpp-4.2.1"
  export CC="$DEVROOT/usr/bin/arm-apple-darwin10-gcc-4.2.1"
  export LD=$DEVROOT/usr/bin/ld
  export AR=$DEVROOT/usr/bin/ar
  export AS=$DEVROOT/usr/bin/as
  export NM=$DEVROOT/usr/bin/nm
  export RANLIB=$DEVROOT/usr/bin/ranlib
  export LDFLAGS="-L$SDKROOT/usr/lib/"
  
  export CPPFLAGS=$CFLAGS
  export CXXFLAGS=$CFLAGS
  </code></pre>
  
  <p>UPDATE : The purpose of this cross compile is to make an armv7(armv6) library not a command line tool.</p>
  
  <p>YET ANOTHER UPDATE: I used the following:</p>
  
  <pre><code>CC="$DEVROOT/usr/bin/clang"
  CXX="$DEVROOT/usr/bin/clang++"
  
  ./llvm/configure --host=i386-apple-darwin --target=armv7-apple-darwin --build=armv7-apple-darwin --enable-optimized --disable-debug --disable-expensive-checks --disable-doxygen  --disable-threads --enable-targets=arm 
  </code></pre>
  
  <p>And I managed to get <code>checking whether we are cross compiling... yes</code> out of the <code>configure</code> tool. However, <code>make</code> still outputs a x86_64 binary:(</p>