[LLVMdev] Cross compile LLVM

Óscar Fuentes ofv at wanadoo.es
Thu Dec 13 15:03:00 PST 2012


Rami Jiossy <sramij at gmail.com> writes:

> I am trying to cross compile LLVM for Android-NDK;
> I am using CMake as a build system; hence, i have defined CMAKE_SYSTEM_NAME
> variable so to turn on CMAKE_CROSSCOMPILING flag, being used by LLVM.
>
> As far as i understand from the LLVM structure; when cross compiling,
> executable are generated with two versions; one goes under the target build
> directory ${CMAKE_BINARY_DIR} and the other goes into
> ${CMAKE_BINARY_DIR}/native/....
>
> We i do that, i get all the tblgen + clang executable generated like that.
>
> however, the tools under TOOLS don't; and they aren't runnable on the
> host-build system.
>
> why is that? any ideas are appreciated.

First of all, setting CMAKE_SYSTEM_NAME is not enough for
cross-compiling. Please see

http://www.llvm.org/docs/CMake.html#cross-compiling

for pointers to specific instructions about how to cross-compile with
CMake.

When LLVM is cross-compiled, a native tlbgen executable is generated for
using on the build process. Tools for the target platform are generated
in ${CMAKE_BINARY_DIR}. Dunno about clang.

If, after following the instructions linked above, you don't obtain the
tools for the target platform in ${CMAKE_BINARY_DIR}, there is a bug in
the LLVM CMake scripts.




More information about the llvm-dev mailing list