Building eLua in Linux

Building eLua in Linux

Important Starting with eLua 0.10, a new Lua-based build system replaces the previous Python based (scons) build system. You’ll need to update your machine environment accordingly, as per the instructions below.

Building eLua in Linux is fairly easy. This tutorial assumes that Ubuntu is used for building, however any distro should be fine, you just need to convert the "apt-get" calls to your distro’s package manager equivalent. You need a few packages installed to build eLua:

  • a toolchain: check the toolchains page for toolchain instructions. Please note that even if you already have a compiled toolchain, the differences in the Newlib configure flags (mainly the --disable-newlib-supplied-syscalls flags) might prevent eLua for building properly on your machine.

  • Lua: it should be already installed. If it’s not, use apt-get to install it:

    $ sudo apt-get install lua5.1
  • luarocks: a simple package manager for Lua. Again, use apt-get to install it:

    $ sudo apt-get install luarocks
  • luafilesystem, lpack, md5 - various Lua modules needed by the builder. Use luarocks to install them:

    $ sudo luarocks install luafilesystem
    $ sudo luarocks install lpack
    $ sudo luarocks install md5
  • your toolchain’s "bin" directory (this is generally something like /usr/local/cross-arm/bin, where /usr/local/cross-arm is the directory in which you installed your toolchain) must be in $PATH.

  • if you’re building for the i386 platform, you’ll also need "nasm":

    $ sudo apt-get install nasm
  • gcc: if you want to use the ROMFS precompile feature (see here for details) you need to build an image of the eLua cross compiler, and you need an i386 toolchain for this. It should be already installed, but if you want to be on the safe side do this:

    sudo apt-get install build-essential

    Then build the eLua cross compiler by executing this command:

    lua cross-lua.lua

After you setup your build environment as described above, follow this tutorial to build your eLua image.