[cfe-dev] Clang and related tools are for ARM too ?

Renato Golin renato.golin at linaro.org
Fri Aug 2 01:11:36 PDT 2013


On 1 August 2013 13:47, Arji Cot <arjicot at gmail.com> wrote:

> It's possible to run clang and all the other related compiler tools on an
> armv5 or armv7 device ?
>

Hi Arji,

You can download the ARMv7 binaries here:
http://llvm.org/releases/download.html

Or you can also use the x86 version, from your distro, or that download
page, which you can use to cross-compile (as Jeffrey said, it's faster).

However, for both cases, you'll still need the correct libraries, generally
provided by the GNU toolchain. There are several LLVM projects substituting
the GNU libraries, but they're not mature enough yet to completely replace
everything.

On ARM targets, you'll probably already have them, and on x86 hosts, you'll
have to install them. If you're using Debian-based distro you can "apt-get
install gcc-4.7-arm-linux-gnueabi" and point your clang (via -I and -L
flags) to the include and library directories of the ARM toolchain.


In other words: Can I use clang on an ARM device just like I'm used to on
> an X86 desktop machine ?
>

Yes. If you're running on the ARM board, it should be just as easy as
running on your x86 machine, because all the libraries and include headers
will be on the right spot.

Cross-compilation is a bit of a pain, for now, as Clang has some trouble
finding all tools (headers, libraries, binutils, etc) and it might end up
sending some cryptic messages when it tried to use the native (x86) linker,
for example. It's getting better, though, and it does know about most Linux
distributions' preferences.

On my Ubuntu machine, with gcc-4.7-multilib-arm-linux-gnueabihf installed,
I call:

$ clang -target arm-linux-gnueabihf -I /usr/arm-linux-gnueabihf/include
-mcpu=cortex-a9 -mfpu=neon -mthumb file.c

And it works a charm, because Clang knows where binutils is (inferred from
my target triple), however, it didn't infer my include path, which it could.

Feel free to post problems using Clang for ARM on this list and we'll
strive to help the best we can.

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130802/211848a9/attachment.html>


More information about the cfe-dev mailing list