luac does what precisely?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

luac does what precisely?

Meer, H. van der
A question about luac. Do I understand correctly that luac precompiles the given lua file only and does not include the modules called in by a require statement inside? More precisely, that it does not generate something functioning as a 'fully linked standalone binary'?
And if I am right in this, is it possible to generate such a 'standalone binary', allowing one to call one file with all necessary precompiled code inside?

Hans van der Meer





Reply | Threaded
Open this post in threaded view
|

Re: luac does what precisely?

Charles Heywood

Perhaps you should look into srlua. Also, no, it doesn't link or include any external files.


On Wed, Oct 5, 2016, 3:51 AM Meer, Hans van der <[hidden email]> wrote:
A question about luac. Do I understand correctly that luac precompiles the given lua file only and does not include the modules called in by a require statement inside? More precisely, that it does not generate something functioning as a 'fully linked standalone binary'?
And if I am right in this, is it possible to generate such a 'standalone binary', allowing one to call one file with all necessary precompiled code inside?

Hans van der Meer





--

Reply | Threaded
Open this post in threaded view
|

Re: luac does what precisely?

steve donovan
On Wed, Oct 5, 2016 at 10:58 AM, Charles Heywood <[hidden email]> wrote:
> Perhaps you should look into srlua. Also, no, it doesn't link or include any
> external files.

Charles, you are correct - it will make the bytecode, but you need to
attach a Lua executable stub, which is what srlua does.

My luabuild project assists with using srlua (creates custom
executable stubs with extra binary extensions) although it packs in
the collected scripts as an archive, not as Lua bytecode.

Reply | Threaded
Open this post in threaded view
|

Re: luac does what precisely?

Samir Tine-2
In reply to this post by Charles Heywood

Hi,

On the Windows platform, you can have a look at ljc to produce standalone executables with all required modules. Http:\\www.ljcompiler.com\


Le mer. 5 oct. 2016 10:58, Charles Heywood <[hidden email]> a écrit :

Perhaps you should look into srlua. Also, no, it doesn't link or include any external files.


On Wed, Oct 5, 2016, 3:51 AM Meer, Hans van der <[hidden email]> wrote:
A question about luac. Do I understand correctly that luac precompiles the given lua file only and does not include the modules called in by a require statement inside? More precisely, that it does not generate something functioning as a 'fully linked standalone binary'?
And if I am right in this, is it possible to generate such a 'standalone binary', allowing one to call one file with all necessary precompiled code inside?

Hans van der Meer





--

Reply | Threaded
Open this post in threaded view
|

Re: luac does what precisely?

Nagaev Boris
In reply to this post by Meer, H. van der
On Wed, Oct 5, 2016 at 9:51 AM, Meer, Hans van der <[hidden email]> wrote:
> A question about luac. Do I understand correctly that luac precompiles the given lua file only and does not include the modules called in by a require statement inside? More precisely, that it does not generate something functioning as a 'fully linked standalone binary'?
> And if I am right in this, is it possible to generate such a 'standalone binary', allowing one to call one file with all necessary precompiled code inside?
>
> Hans van der Meer
>

Steps to produce a runnable static binary from Lua file:

1. Combine all Lua dependencies into one runnable Lua file:
https://github.com/starius/single-dir.lua
2. Convert it into C char string
https://github.com/starius/config/blob/master/.bin/file2cstring.lua
3. Write main() function which runs that C char string with Lua and
compile the file with C compiler linking with Lua library.

--


Best regards,
Boris Nagaev

Reply | Threaded
Open this post in threaded view
|

Re: luac does what precisely?

Tony Papadimitriou
In reply to this post by Meer, H. van der
luac only compiles a single file.  It does not follow dependencies.

If it helps, I have written a small Lua 5.3 script that unites all
'require'ments into a single file, and then you can compile this to get a
stand-alone Lua executable.
However, it will only work with pure Lua modules.  It will not work with
binary modules (DLL, etc.)

You can get it here: https://www.dropbox.com/s/ls0aku48u2ybgud/one.luac?dl=0
You give as parameter the main Lua file, and redirect its output to the
single file.  Example: lua one.luac main.lua > united.lua

(I haven't found any Lua source that fails to work with this.  However, if
you notice problems, let me know.  Maybe I can fix it.)

-----Original Message-----
From: Meer, Hans van der
Sent: Wednesday, October 05, 2016 11:51 AM
To: Lua mailing list
Subject: luac does what precisely?

A question about luac. Do I understand correctly that luac precompiles the
given lua file only and does not include the modules called in by a require
statement inside? More precisely, that it does not generate something
functioning as a 'fully linked standalone binary'?
And if I am right in this, is it possible to generate such a 'standalone
binary', allowing one to call one file with all necessary precompiled code
inside?

Hans van der Meer






Reply | Threaded
Open this post in threaded view
|

Re: luac does what precisely?

Eduardo Tongson
In reply to this post by Meer, H. van der
On Wed, Oct 5, 2016 at 4:51 PM, Meer, Hans van der <[hidden email]> wrote:
> A question about luac. Do I understand correctly that luac precompiles the given lua file only and does not include the modules called in by a require statement inside? More precisely, that it does not generate something functioning as a 'fully linked standalone binary'?
> And if I am right in this, is it possible to generate such a 'standalone binary', allowing one to call one file with all necessary precompiled code inside?
>
> Hans van der Meer
>
>
>
>
>

This thread is turning out to be a list of ways to build standalone
Lua applications so please allow me to chime in.

My tool [1] allows building standalone binaries from MoonScript, plain
Lua and C modules. Just follow the instructions in the README.

[1] https://github.com/tongson/omnia

Cheers!

Reply | Threaded
Open this post in threaded view
|

Re: luac does what precisely?

Russell Haley
In reply to this post by Nagaev Boris
Ha! Brilliant sir!

Russ

Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
  Original Message  
From: Nagaev Boris
Sent: Wednesday, October 5, 2016 2:53 AM
To: Lua mailing list
Reply To: Lua mailing list
Subject: Re: luac does what precisely?

On Wed, Oct 5, 2016 at 9:51 AM, Meer, Hans van der <[hidden email]> wrote:
> A question about luac. Do I understand correctly that luac precompiles the given lua file only and does not include the modules called in by a require statement inside? More precisely, that it does not generate something functioning as a 'fully linked standalone binary'?
> And if I am right in this, is it possible to generate such a 'standalone binary', allowing one to call one file with all necessary precompiled code inside?
>
> Hans van der Meer
>

Steps to produce a runnable static binary from Lua file:

1. Combine all Lua dependencies into one runnable Lua file:
https://github.com/starius/single-dir.lua
2. Convert it into C char string
https://github.com/starius/config/blob/master/.bin/file2cstring.lua
3. Write main() function which runs that C char string with Lua and
compile the file with C compiler linking with Lua library.

--


Best regards,
Boris Nagaev


Reply | Threaded
Open this post in threaded view
|

Re: luac does what precisely?

Bulat Ziganshin
In reply to this post by Tony Papadimitriou
Hello Tony,

Wednesday, October 5, 2016, 1:58:37 PM, you wrote:

can you please publish sources of your utility?

> If it helps, I have written a small Lua 5.3 script that unites all
> 'require'ments into a single file, and then you can compile this to get a
> stand-alone Lua executable.
> However, it will only work with pure Lua modules.  It will not work with
> binary modules (DLL, etc.)

> You can get it here:
> https://www.dropbox.com/s/ls0aku48u2ybgud/one.luac?dl=0
> You give as parameter the main Lua file, and redirect its output to the
> single file.  Example: lua one.luac main.lua > united.lua

> (I haven't found any Lua source that fails to work with this.  However, if
> you notice problems, let me know.  Maybe I can fix it.)

> -----Original Message-----
> From: Meer, Hans van der
> Sent: Wednesday, October 05, 2016 11:51 AM
> To: Lua mailing list
> Subject: luac does what precisely?

> A question about luac. Do I understand correctly that luac precompiles the
> given lua file only and does not include the modules called in by a require
> statement inside? More precisely, that it does not generate something
> functioning as a 'fully linked standalone binary'?
> And if I am right in this, is it possible to generate such a 'standalone
> binary', allowing one to call one file with all necessary precompiled code
> inside?

> Hans van der Meer









--
Best regards,
 Bulat                            mailto:[hidden email]