-
Notifications
You must be signed in to change notification settings - Fork 1
WinLua Compiler Toolchain: llvm mingw
A long standing complaint of mine in the Lua/Windows ecosystem has been the difficulty with using a C toolchain on Windows. In unix-like environments, working with C based Lua modules is quite simple, especially with LuaRocks. Simply pull in a C compiler - some include a compiler by default.. cough FreeBSD - and use Luarocks to pull in your favorite modules. On Windows, using C requires either a very large installation of Visual Studio with all it's complexities (20 GB!), or the daunting setup of the GNU mingw C toolchain.
The WinLua project seeks to change that. The goal is to make developing C applications on Windows "easy", as well as present a C language environment tuned for Lua. WinLua Release 3 introduces the WinLua Compiler Toolchain, a complete C tool set for building executables on Windows 10. The full WinLua R3 installation is 552 MB and includes everything you need to build Lua modules, Lua C Modules and C/C++ applications that integrate Lua.
- Compiler - A program that converts a high level language - typically human readable - into constructs that can be executed by a computer. For this project, "compiler" refers to a program that converts C to Assembly.
- Standard Library - A software library that provides the basis of functionality for a given software language. In this case we are referring to the Windows C Runtime (CRT), and the Windows Universal C Runtime (uCRT).
- API - Application Programming Interface. The functions, structures and methods for interacting with a programming language or system.
- Toolchain - A collection of software tools used to achieve an expressed goal. In this case, we are referring to compiler tools for creating and manipulating application binaries.
The WinLua Compiler Toolchain is based on the following projects:
- LLVM - The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines. The name "LLVM" itself is not an acronym; it is the full name of the project.
- CLang - The LLVM C/C++ compiler toolchain.
- MINGW - Minimalist GNU for Windows. Mingw is a collection of compiler tools, header files and libraries that allow a developer to write C/C++ against the Microsoft Windows API without the Visual C++/Visual Studio tools.
- llvm-mingw - Martin Storsjo's project combines the clang (C Language) front end with the MinGW projects standard library (MingW64), creating a natural cross compiler toolchain for Windows binaries.
- WinLua Compiler (WLC) - A binary distribution of the llvm-mingw project with custom functionality tuned for the WinLua project. At this point the "tuning" is a fancy vanity-plate executable (wlc32.exe/wlc64.exe).
Lua by itself is less than 1 Mb in size. Lua is not necessarily a general scripting language when used alone, so is best used with the LuaRocks package manager. LuaRocks often needs to build C binaries so a C compiler is required to build some modules. Visual Studio - which includes Visual C++ - usually tips in at around 20 GB of disk space (so that's a ratio of 1:20480). The Visual Studio Tools for C++ toolchain - Microsoft's free download - is around 4 GB (1:4096). llvm-mingw is ~500 MB (1:512).
Don't miss understand me, I use Visual Studio all the time at work. WinLua is currently built using Visual Studio and I use Visual Studio to build the installer for this project. But why should I need to cart around and install twenty gigabytes of tools just to use Lua if I can use a 500 megabyte tool instead? Visual Studio takes hours to download and install. Winlua and the WLC tools takes 10 mintutes.