< All posts

March 27, 2021, 7:08 p.m.

Compiling Minetest-dev (Master branch) on Debian GNU/Linux

Compiling Minetest 5.5.0-dev (Master branch) on Debian GNU/Linux

The latest Minetest 5.4.0 was released last February 23, 2021. The bleeding edge Minetest on the official git repo is now on version 5.5 (at the time of this writing), the repo is updated almost daily. Here are the steps to try bleeding edge (development) version of minetest.

  1. Get the 5.5.0-dev source code on the Minetest Github
  2. Install Pre-requisite for compiling Minetest
  3. Compile Minetest
  4. Play Minetest

Getting the Minetest 5.5.0-dev Source Code

The official Minetest git repository can be found at: https://github.com/minetest/minetest.

$ wget 'https://github.com/minetest/minetest/archive/refs/heads/master.zip'
$ 7z x master.zip
$ mv minetest-master minetest
$ cd minetest-master

Alternatively you can git clone the master branch:

$ git clone https://github.com/minetest/minetest

Cloning into 'minetest'...
remote: Enumerating objects: 25, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 71127 (delta 8), reused 10 (delta 4), pack-reused 71102
Receiving objects: 100% (71127/71127), 77.69 MiB | 1.20 MiB/s, done.
Resolving deltas: 100% (51145/51145), done.

$ cd minetest

Installing Pre-requisites

$ sudo apt install g++ make libc6-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev

[sudo] password for user:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libbz2-dev is already the newest version (1.0.6-9.2~deb10u1).
libcurl4-gnutls-dev is already the newest version (7.64.0-4+deb10u1).
libfreetype6-dev is already the newest version (2.9.1-3+deb10u2).
g++ is already the newest version (4:8.3.0-1).
libc6-dev is already the newest version (2.28-10).
libgmp-dev is already the newest version (2:6.1.2+dfsg-4).
libjpeg-dev is already the newest version (1:1.5.2-2+deb10u1).
libjsoncpp-dev is already the newest version (1.7.4-3).
libogg-dev is already the newest version (1.3.2-1+b1).
libpng-dev is already the newest version (1.6.36-6).
libvorbis-dev is already the newest version (1.3.6-2).
libxxf86vm-dev is already the newest version (1:1.1.4-1+b2).
make is already the newest version (4.2.1-1.2).
libgl1-mesa-dev is already the newest version (18.3.6-2+deb10u1).
libopenal-dev is already the newest version (1:1.19.1-1).
libsqlite3-dev is already the newest version (3.27.2-3+deb10u1).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-1).
cmake is already the newest version (3.16.3-3~bpo10+1).

As you can see, the required packages are already installed on my system.

For the Minetest 5.5-dev. We need to compile the forked version of Irrlicht Engine tailored for use in Minetest.

$ git clone https://github.com/minetest/irrlicht
$ cd irrlicht
$ cmake . -DBUILD_SHARED_LIBS=OFF
$ make -j$(nproc)

Sample output:

$ git clone 'https://github.com/minetest/irrlicht'
Cloning into 'irrlicht'...
remote: Enumerating objects: 368, done.
remote: Counting objects: 100% (368/368), done.
remote: Compressing objects: 100% (222/222), done.
Receiving objects:  14% (1094/7810), 880.01 KiB | 875.00 KiB/s  
...

$ cd irrlicht
~/git/irrlicht$ cmake . -DBUILD_SHARED_LIBS=OFF
-- The CXX compiler identification is GNU 8.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- *** Building IrrlichtMt 1.9.0 ***
...
-- Build files have been written to: /home/user/git/irrlicht

Scanning dependencies of target IRRVIDEOOBJ
Scanning dependencies of target IRRIOOBJ
[  0%] Building CXX object source/Irrlicht/CMakeFiles/IRRIOOBJ.dir/CFileList.cpp.o
[  1%] Building CXX object source/Irrlicht/CMakeFiles/IRRVIDEOOBJ.dir/CVideoModeList.cpp.o
[  1%] Building CXX object source/Irrlicht/CMakeFiles/IRRVIDEOOBJ.dir/CFPSCounter.cpp.o
[  2%] Building CXX object source/Irrlicht/CMakeFiles/IRRVIDEOOBJ.dir/CNullDriver.cpp.o
...
[ 99%] Building CXX object source/Irrlicht/CMakeFiles/IRRGUIOBJ.dir/CGUIProfiler.cpp.o
[ 99%] Built target IRRGUIOBJ
Scanning dependencies of target IrrlichtMt
[100%] Linking CXX static library ../../lib/Linux/libIrrlichtMt.a
[100%] Built target IrrlichtMt

Compiling Minetest

Make sure you are in the minetest source code directoty:

$ cmake .  -DRUN_IN_PLACE=TRUE -DIRRLICHT_INCLUDE_DIR=/home/user/git/irrlicht/include -DIRRLICHT_LIBRARY=/home/user/git/irrlicht/lib/Linux/libIrrlichtMt.a -B build
$ cd build
$ make -j$(nproc)

RUN_IN_PLACE parameter will let Minetest to run directly in the source directory and the make parameter -j$(nproc) will utilize all your CPU to make the compilation faster.

IRRLICHT_INCLUDE_DIR parameter will specify the location of the irrlicht include directory. (ex. /home/user/git/irrlicht/include )

IRRLICHT_LIBRARY parameter will specify the compiled library of the minetest fork of irrlicht. (ex. /home/user/git/irrlicht/lib/Linux/libIrrlichtMt.a)

Sample output:

$ cmake -B build
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- *** Will build version 5.5.0 ***
-- Found Irrlicht: /home/user/git/irrlicht/lib/Linux/libIrrlichtMt.a  
-- Looking for IRRLICHT_VERSION_MT
-- Looking for IRRLICHT_VERSION_MT - found
-- Using GMP provided by system.
...
-- Configuring done
-- Generating done
-- Build files have been written to: ./build

Scanning dependencies of target lua
Scanning dependencies of target jsoncpp
[  0%] Building CXX object lib/jsoncpp/CMakeFiles/jsoncpp.dir/jsoncpp.cpp.o
[  1%] Building C object lib/lua/build/CMakeFiles/lua.dir/lapi.c.o
[  1%] Building C object lib/lua/build/CMakeFiles/lua.dir/lauxlib.c.o
...
[ 99%] Building CXX object src/CMakeFiles/minetest.dir/voxelalgorithms.cpp.o
[100%] Linking CXX executable ../../bin/minetest
[100%] Built target minetest

This took 15 minutes to complete on a 1.8G6Hz Intel Core 2 Duo Thinkpad Laptop.

Playing Minetest

Running the compiled Minetest:

$ ./bin/minetest

Note: The compiled Minetest does not contain the Minetest Game, it is only an engine.

To get the Minetest Game, just clone minetest_game (master branch) repository to the minetest/games folder.

$ cd minetest/games
$ git clone https://github.com/minetest/minetest_game

This will clone the master branch and not the stable branch version of the minetest_game.

References:

https://github.com/minetest/minetest
https://github.com/minetest/minetest_game
https://github.com/minetest/irrlicht
https://github.com/minetest/minetest/issues/11094

Except where otherwise noted, this work is licensed under Creative Commons Attribution-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-sa/4.0/).