clang for Android,Cross compile clang for Android arm

I am trying to cross-compile llvm/clang for Android arm.

I export the CC/CXX variables to the arm-linux-androideabi cross compilers, and then from my build folder I execute:

cmake -G "Unix Makefiles" --target arm-linux-androideabi --sysroot=$NDK/platforms/android-21/arch-arm/ ../llvm

The build folder is in the same directory with the llvm source code.

I get the error:

rm-linux-androideabi-g++: error: unrecognized command line option '-m32'

I know, it has something to do with g++ multilib for arm-linux but I cannot find it in the NDK.

I have also tried all the steps that are listed here, and the guide found here, with no luck.

Any help would be greatly appreciated. Thanks!

EDIT:

NOw I am using the following command:

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

The compilation now begins, but it stops at 14% with the error:

arm-linux-androideabi-g++: error: unrecognized command line option

'-bundle'

EDIT2:

I removed all the relative paths to absolute ones.

And changed the compiler from gcc to clang. Clang recognises -bundle, but it does not use it. The full command w/ the error now is:

Command:

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

make -j12

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值