10

I'm under Ubuntu 12.04 x86 64 bit, I have compiled a 32 bit version of llvm/clang from the official svn repository successfully.

I'm now trying to compile c++ code for ARM, at this point i don't care about platform versions like armv5 vs armv7a, I'm focusing on how the platform switch works for clang:

llvm-config --targets-built
ARM CellSPU CppBackend Hexagon Mips MBlaze MSP430 NVPTX PowerPC Sparc X86 XCore

but the following command doesn't work

clang++ -arch arm soft.cpp -o soft_ARM

the output is

clang-3: warning: argument unused during compilation: '-arch arm'

I have also tried gcc-like variants or other combinations like -arch=arm, -arch=armv7a, -march=armv5 but nothing seems to work.

After reading some docs i noticed that clang works for ARM only under MAC OS X / Darwin and it's not supposed to work for ARM under other OS.

How i can compile for ARM with clang and what the output of llvm-config --targets-built is really about ?

4

1 回答 1

9

-arch 是达尔文独有的功能。您应该在非达尔文平台上使用 -target。或者,编译 llvm/target 指定目标三元组或创建从 clang 到 -clang 的链接。在您的情况下,目标三元组将是 arm-none-linux-gnueabi

于 2012-11-05T02:08:39.193 回答