My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CrossCompile  
How to use llvm-lua to cross-compile Lua scripts to native code for target architecture like arm/powerpc from a different host architecture.
Featured
Updated Mar 28, 2012 by rjakabo...@gmail.com

Introduction

llvm-lua now has support for native cross-compiling support.

Required software

See this page for how to compile LLVM & Clang.

Compiling llvm-luac as a cross-compiler

1. Setup build folder for cmake:

2. Set the following cmake variables using the "ccmake" GUI:

  • CROSS_COMPILE=ON
  • CROSS_CPU=arm1136j-s
  • CROSS_ISYSTEM=/path/to/arm-target/system/includes
  • CROSS_TRIPLE=arm-linux
  • LLVM_CC=/opt/llvm-2.6/libexec/clang-cc

For good performance it is important to select the correct CROSS_CPU that matches the target cpu you will be compiling for. You can change this later in the "lua-cross-compiler" script, in case you need to compile for different arm cpus.

3. Compile llvm-luac

  • make
  • make install

You should now have the following files for llvm-luac: /usr/local/bin/arm-linux-llvm-luac /usr/local/bin/lua-cross-compiler

Cross compiling a Lua script.

To native compile a single Lua script into a standalone execute for the target architecture:

  • lua-cross-compiler script.lua

To native compile sub-modules into the same standalone execute:

  • lua-cross-compiler -L sub1.lua -L sub2 -L modules/sub3.lua script.lua

Comment by Vadimu...@gmail.com, May 27, 2010

"lua-cross-compiler" script doesn't exist.


Sign in to add a comment
Powered by Google Project Hosting