Trying to compile something like Minetest manually on Windows is about as easy as hearding cats with lasers strapped to their heads (very difficult). So today we're going to simplify the process, I'm going to borrow the work of some other people to create a buildscript you can use to create a Minetest build with LuaJIT, LuaSocket and LevelDB in one command.

Before we Start

What does this buildscript do?

It compiles Minetest 4.16 - 0.5 (tested, though will likely work outside this range) for 64bit Windows on Windows, you will need 64bit Windows (vista or greater).

Where else should I look?

The following guides were consulted in the making of my buildscript:

Installing the Required Software

Installing the software is the hardest part, which isn't to say it's hard... simply install MSYS2 from the MSYS2 website, following the instructions on the website, then go to Start > MSYS2 64bit > MSYS2 MinGW 64-bit and run the following command:

pacman -S base-devel git unzip zip mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake

This will install all of the required packages.

Setting up the Environment

All you need to do is create a folder to build in (say C:\minetest), and cd into it:

mkdir /c/minetest
cd /c/minetest

Now we need the buildscript, my modified buildscript is available in this repository, but of couse you could make your own as per Fixer's instructions, I've simply included mine for convinience (there are several things you will need to change, and mine behaves slightly differently to make it only require 1 command). Download a buildscript and the latest cmake toolchain file to this directory:


Now, get yourself a copy of Minetest:

git clone


And now comes the fun part. Build it:

./buildwin64 ./minetest # replace ./minetest with the build directory of your choice

And then the script will ask you... nothing.

It will first download all of the required items, then it will compile LuaJIT and LuaSocket, and then it will compile and package your build into a neat little zip file, the directory to which will be printed at the end.

The script will attempt to bypass CMake so you don't have to recompile the entire thing every single time, if you want to force CMake to run, delete the _build folder in your build directory.

Expected Output

If your command line output doesn't look similar to this, chances are something's not right and you should submit an issue on the github repo:

Chimney Swift@Swift MINGW64 /c/minetest
$ ./ ./minetest-master
Downloading packages...
Extracting packages...
Initiating build process...
Building luajit...
"Building LuaJIT 2.1.0-beta3"
C:/msys64/mingw64/bin/mingw32-make -C src amalg
mingw32-make[1]: Entering directory 'C:/minetest/minetest-master/libs/luajit/src'
| WARNING: Compiling the amalgamation needs a lot of virtual memory        |
| (around 300 MB with GCC 4.x)! If you don't have enough physical memory   |
| your machine will start swapping to disk and the compile will not finish |
| within a reasonable amount of time.                                      |
| So either compile on a bigger machine or use the non-amalgamated build.  |
C:/msys64/mingw64/bin/mingw32-make all "LJCORE_O=ljamalg.o"
mingw32-make[2]: Entering directory 'C:/minetest/minetest-master/libs/luajit/src'
mingw32-make[2]: Nothing to be done for 'all'.
mingw32-make[2]: Leaving directory 'C:/minetest/minetest-master/libs/luajit/src'
mingw32-make[1]: Leaving directory 'C:/minetest/minetest-master/libs/luajit/src'
Building luasocket...
C:/msys64/mingw64/bin/mingw32-make -C src mingw
mingw32-make[1]: Entering directory 'C:/minetest/minetest-master/libs/luasocket/src'
C:/msys64/mingw64/bin/mingw32-make all PLAT=mingw
mingw32-make[2]: Entering directory 'C:/minetest/minetest-master/libs/luasocket/src'
mingw32-make[2]: Nothing to be done for 'all'.
mingw32-make[2]: Leaving directory 'C:/minetest/minetest-master/libs/luasocket/src'
mingw32-make[1]: Leaving directory 'C:/minetest/minetest-master/libs/luasocket/src'
./ line 121: cd: _build: No such file or directory
Attempting to compile without running CMake first (faster)...
mingw32-make: *** No targets specified and no makefile found.  Stop.
Error running make or accessing makefile, (re)building make file...
mv: cannot stat 'C:/msys64/usr/bin/sh.exe': No such file or directory
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Configuring done
-- Generating done
-- Build files have been written to: C:/minetest/minetest-master/_build
Scanning dependencies of target GenerateVersion
Scanning dependencies of target translations
Scanning dependencies of target jsoncpp
Scanning dependencies of target gmp
[  1%] Building CXX object lib/jsoncpp/CMakeFiles/jsoncpp.dir/jsoncpp.cpp.obj
[  1%] mo-update [uk]: Creating locale directory.
[  1%] Building C object lib/gmp/CMakeFiles/gmp.dir/mini-gmp.c.obj
[  1%] mo-update [ca]: Creating locale directory.
[100%] Building CXX object src/CMakeFiles/minetest.dir/voxelalgorithms.cpp.obj
[100%] Building CXX object src/CMakeFiles/minetest.dir/wieldmesh.cpp.obj
[100%] Linking CXX executable ..\..\bin\minetest.exe
[100%] Built target minetest
Compilation successful!
Copying required DLL files to /bin...
Exporting package...
Deleting old package...
Creating new directory and copying built Minetest...
cp: cannot stat '/c/minetest/minetest-master/locale': No such file or directory
cp: cannot stat '/c/minetest/minetest-master/minetest.conf': No such file or directory
cp: cannot stat '/c/minetest/minetest-master/README.txt': No such file or directory
Creating .zip file...
All tasks finished and successful. Information:
Compiled package directory: /c/minetest/minetest-master/minetest--dev
Compiled zipped package location: /c/minetest/minetest-master/minetest--dev/
Minetest version: -dev