[LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?

David Tweed david.tweed at arm.com
Thu Nov 22 01:08:37 PST 2012


Sorry for the delay, only just saw this message.

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Tim Northover
Sent: 21 November 2012 18:14
To: Negar Mir
Cc: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang
possible?

Hi Negar,

> In file included from ../../../../LLVM/project/file1.cpp:8:
>
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../include/c++/4.6/iostream:38:1
0:
> fatal error:
>       'bits/c++config.h' file not found
> #include <bits/c++config.h>
>          ^

| That's a compile-time error rather than link-time. Clang does its best
| to find all the bits of the cross-toolchain it needs, but it doesn't
| always succeed. The immediate error is it not knowing about the
| directory where c++config.h is stored, but in fact that path it's
| getting "iostream" from looks a little dodgy too. If I'm calculating
| my ..s correctly, it's "/usr/include/c++/4.6/iostream" which is
| probably the host's copy. It *may* be compatible, but then again it
| may not.

>From work on the pandaboard transition to hard float, I discovered the way
that this works is clang tries to find the gcc installation for the platform
you're compiling for, then locates headers relative to that with ..'s . The
idea is that natively it'll end up at "/usr/..." while you'd typically
install cross-compilers in a different place and this will end up at the
cross-compile targets. So the first thing to do is figure out which
bits/c++config.h file corresponds to the ARM cross compile environment, and
where it resides relative to the /usr/lib/gcc/arm-linux-gnueabi/4.6
directory. If it's not in the expected place then you may need, as Tim says,
to specify some files manually or go for a different cross-compiler
installation.

(Note: I explicitly disavow understanding this stuff, it's purely at the
level of "if you do this things work".)







More information about the llvm-dev mailing list