Re: Creating a statically linked executable for a LuaJIT+C program

  • From: Markus Walther <dr.marikos@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 26 Oct 2012 00:54:51 +0200

On Thu, Oct 25, 2012 at 11:35 PM, Mike Pall <mike-1210@xxxxxxxxxx> wrote:
> Luke Gorrie wrote:
>> I have an application written in LuaJIT + C that I would love to
>> convert into a single file statically linked executable. Is there a
>> good way to do this?
>
> Use embedded bytecode:
>   http://luajit.org/running.html#opt_b
>
> Take particular note of the last three paragraphs.

bash-3.2$ uname -prsv
Darwin 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT
2012; root:xnu-1699.32.7~1/RELEASE_X86_64 i386

bash-3.2$ luajit -b module.lua module.o
luajit: unknown luaJIT command or jit.* modules not installed

bash-3.2$ sudo luajit -b module.lua module.o
Password:
luajit: NYI: no support for writing OSX object files

Some questions arise from this (to Mike):
- why does luajit require root for some tasks on OS X, could the error
message be improved to indicate this?
- how high a priority is supporting MacOSX object files, any ETA?
- would creating a statically linked standalone executable for a pure
Lua file still involve a minimal C wrapper file
 that creates a new Lua state L, maybe opens standard libraries and
then ends in a luaL_dostring(L,"require('module')")?

--Markus

Other related posts: