[llvm-dev] problems with cross-compiling ARM from x86 PC

Renato Golin via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 29 09:42:50 PDT 2016

On 28 April 2016 at 15:07, 李阳 via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> Since I need to cross compile LLVM to ARM from x86 PC, I follow the guide
> [HowToCrossCompileLLVM.rst], and I still suffer from some problems.

Hi Liyang,

I've added a task on my todo list to re-write those documents to a
more modern setting.

Now, specific to your questions...

> 1. About the Cmake option[-DLLVM_TABLEGEN], how do I replace the
> <path-to-host-bin>? Do I need to compile the LLVM for X86 on X86 PC first or
> install LLVM via apt-get on Ubuntu?

You can use whatever table-gen that works on your host. Though, you'll
need both LLVM and Clang TableGen tools, and I don't think packages
ship with both. If you have a built tree, that's the safer option.

> 2. As mentioned about the hacks, I don't get any available ARM library
> resources, such as "libinfo", "libxml2" . So could  anyone provide me with
> some links/ suggestions?

I believe Ubuntu has something called multilib or multiarch, and that
let's you install packages for alternative architectures.

If memory serves me well, multilib just need something like "apt-get
install libxml2-dev-arm" and multiarch needs you to add the arch,
something like "dpkg --add-arch arm".

Check the Ubuntu docs on multilib/arch to know more.

>      However when I compiling clang/llvm for ARM on x86, I specify the
> <path-to-host-bin> as the bin/llvm-tblgen in the directory I just compiled
> for x86. And the error shows "Host compiler appears to require libatomic,
> but cannot find it".

This is the same problem you have reported before. Have you used the
correct triple (arm-linux-gnueabihf)? Have you used --sysroot like
James asked? Have you made sure the tools Clang is picking are the ARM

If we don't know the answer to those questions, it's hard to know how
to help you.


More information about the llvm-dev mailing list