
How to compile and install Lua 5.3.3 and C modules from sources on Windows - alvil
https://github.com/is73/Lua-5.3-Portable-Batteries-Windows-10-32bit/blob/master/manual.md
======
red_admiral
> Some principles as far as I understand them

(on LUA_PATH/LUA_CPATH/PATH)

If it's a .lua file, it goes in LUA_PATH. Lua libraries with collections of
files usually have a main file and a folder, so libXXX might have a main file
XXX.lua and a folder XXX with auxiliary files. In this case, the main file and
folder go into the same directory on the LUA_PATH.

.dll (linux: .so) files that are lua module entry points, i.e. they are loaded
by the lua executable itself when you do a "require", go in LUA_CPATH.

You can see why by typing require"XXX" into the lua console - it'll say that
XXX was not found and print out a list of LUA_(C)PATH entries that it searched
for - note that .dll and .lua ones are looked for in different directories. So
require"lib" will find a lib.lua on the LUA_PATH or a lib.dll (lib.so) on the
LUA_CPATH.

If it's a dll that's not loaded through a require, but from one dll to another
- like the lua ssl library loads the openSSL ones (libssl32.dll) - then it
goes wherever the operating system looks for libraries, since it's the OS and
not lua that'll be doing the looking. On windows the PATH is a good place to
start, on linux I usually set LD_LIBRARY_PATH to pick up ones in non-standard
locations.

~~~
alvil
> If it's a dll that's not loaded through a require, but from one dll to
> another - like the lua ssl library loads the openSSL ones (libssl32.dll)

In this manual the task is to create _standalone_ distro so everything what
normally goes to OS PATH goes in Lua's \bin directory in this case. This means
if you copy this c:\work\lua folder on the freshly installed Windows it will
run out of the box. And that's cool.

------
Tomte
Building it with MS Visual Studio is pretty painless, so I'm not sure why they
are going the MinGW route. Just because of the libraries?

~~~
vvanders
Yeah, was going to say the same. I remember way back when you had to do some
hoops to turn off doubles by default. Even then building with VS was pretty
straightforward.

------
sdegutis
Soon this will be outdated, since Windows users will be able to use the same
instructions as on Linux, using Windows Subsystem for Linux.

~~~
boondaburrah
Windows developers might, but if I'm trying to create lua dependent software
that runs on Windows for other people, I can't mandate that they install WSfL
before they can run my program.

------
corysama
For anyone not familiar with Lua, this guide includes instructions for adding
on several bonus packages beyond the base Lua interpreter.

To just get Lua itself up and running, given a C compiler, the only step
that's necessary is 3.

------
creshal
It's sad how "compile something _on Windows_ " is something deserving
elaborate how-tos. How hard can it be to provide a sane development
environment?

~~~
wolfgke
> How hard can it be to provide a sane development environment?

There is a sane development available under Windows: It is called PowerShell +
Visual Studio Tools. But it's not UNIX.

~~~
creshal
Installing Visual Studio is enough of a russian roulette that it hardly
qualifies as sane.[1]

Having to troubleshoot compiler installation is something that just shouldn't
be necessary.

[1] ex.: [http://stackoverflow.com/questions/33855177/multiple-
errors-...](http://stackoverflow.com/questions/33855177/multiple-errors-
installing-visual-studio-2015-community-edition)

------
fritzy
Step one: Enable Linux Subsystem for Windows

Step two: Install "Bash for Windows aka Ubuntu root"

Step three: compile as normal

~~~
acqq
"The Windows Subsystem for Linux (WSL) is a new Windows 10 feature"

whereas with the solution here presented (and with the binaries provided on
the GitHub):

"At the end you will have standalone Lua distribution for Windows which:

\- runs on Windows 7, 8, 8.1, 10 ... 32/64 bit (if you can run it on XP let me
know :)

\- doesn't require from its user to install any additional libraries,
runtimes, frameworks into his operating system to run correctly

\- you can distribute to your friends, collegues or clients with your scripts
as a zip archive

\- you can take with you on USB key"

It's supercool, something that has been missing.

I've tested it, if the whole zip is unpacked to d:\t

Then in any directory on Windows where the test.lua is I can just invoke

    
    
        d:\t\lua_ok\bin\lua.exe test.lua
    

and everything works, even without any environment variables!

Great work. And to use this occasion, is73, thanks a lot! Consider making a
paypal donation page for you. Wow, now I see, you also make a portable PHP 7.

