title: Cross compile clang for Android arm
body: <p>I am trying to cross-compile llvm/clang for Android arm.</p>
  
  <p>I export the CC/CXX variables to the arm-linux-androideabi cross compilers, and then from my build folder I execute:</p>
  
  <pre><code>cmake -G "Unix Makefiles" --target arm-linux-androideabi --sysroot=$NDK/platforms/android-21/arch-arm/ ../llvm 
  </code></pre>
  
  <p>The build folder is in the same directory with the llvm source code.</p>
  
  <p>I get the error:</p>
  
  <pre><code>rm-linux-androideabi-g++: error: unrecognized command line option '-m32'
  </code></pre>
  
  <p>I know, it has something to do with g++ <code>multilib</code> for <code>arm-linux</code> but I cannot find it in the NDK.</p>
  
  <p>I have also tried all the steps that are listed <a href="http://llvm.org/docs/HowToCrossCompileLLVM.html" rel="nofollow">here</a>, and the guide found <a href="http://clang.llvm.org/docs/CrossCompilation.html" rel="nofollow">here</a>, with no luck.</p>
  
  <p>Any help would be greatly appreciated. Thanks!</p>
  
  <p>EDIT:
  NOw I am using the following command:</p>
  
  <blockquote>
    <p>cmake -G "Unix Makefiles" --prefix=../outarm --target
    arm-linux-androideabi --sysroot=$NDK/platforms/android-21/arch-arm/
    -DCMAKE_BUILD_TYPE=Release  -DLLVM_ENABLE_PIC=False -DCMAKE_CROSSCOMPILING=True -DLLVM_TABLEGEN=../osxbuild/bin/llvm-tblgen -DCLANG_TABLEGEN=../osxbuild/bin/clang-tblgen -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM ../llvm</p>
  </blockquote>
  
  <p>The compilation now begins, but it stops at 14% with the error:</p>
  
  <blockquote>
    <p>arm-linux-androideabi-g++: error: unrecognized command line option
    '-bundle'</p>
  </blockquote>
  
  <p>EDIT2:
  I removed all the relative paths to absolute ones.
  And changed the compiler from gcc to clang. Clang recognises <code>-bundle</code>, but it does not use it. The full command w/ the error now is:
  Command:</p>
  
  <blockquote>
    <p>cmake -G "Unix Makefiles"
    -DCMAKE_INSTALL_PREFIX=$HOME/Desktop/clang-compilation/outarm -DCMAKE_BUILD_TYPE=Release -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-androideabi --sysroot=$NDK/platforms/android-21/arch-arm/  -DLLVM_ENABLE_PIC=False -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DLLVM_TABLEGEN=$HOME/Desktop/clang-compilation/osxbuild/bin/llvm-tblgen
    -DCLANG_TABLEGEN=$HOME/Desktop/clang-compilation/osxbuild/bin/clang-tblgen
    -DCMAKE_CXX_FLAGS='-I$HOME/android/toolchains/gcc/include/c++/4.9/arm-linux-androideabi -I$HOME/android/toolchains/gcc/include/' $HOME/Desktop/clang-compilation/llvm </p>
    
    <p>make -j12</p>
  </blockquote>
  
  <p>Error message:
      clang36++: warning: argument unused during compilation: '-bundle'
      /Users/paschalis/android/toolchains/gcc/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: fatal error: -f/--auxiliary may not be used without -shared</p>