lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 04/08/2011 07:53 AM, Luiz Henrique de Figueiredo wrote:
- How would I build a statically-linked Lua interpreter binary?

That's what the standard Makefile does. If you mean *completely* static,
ie, containing all systems libraries, then add -static to the link flags.

- How could I build a library (in this case, luaposix) into the
interpreter such that it could be required without loading the extra .so?

Edit linit.c and add the library in Makefile.

- Would it still be possible to load shared libraries from such an
executable, or would I have to build everything into it?

You need to link the interpreter using -Wl,-E (or equivalent magic)
to export the Lua API symbols.


Thanks for the advice. It took me a couple of hours and probably at least thirty builds, but I got it working - you can download the tarball I made at http://dl.dropbox.com/u/5948578/lua-static-5.1.4.tar.gz.

I got lua-posix and the static building to work independently of each other, which is nice. The static has only been tested on Linux though. The only issues I encountered were a few warnings about some functions in lposix. (I included a README-STATIC describing what I did, so that anyone who tries this in the future would have an idea of what to do.) The next step is to use it for stuff ;-).
--
Regards, Matthew "LeafStorm" Frazier
http://leafstorm.us/