< All posts

March 5, 2021, 2:16 p.m.

Compiling Minetest on Debian GNU/Linux

The latest Minetest 5.4.0 was released last February 23, 2021. But the latest Minetest version that is on the Debian Backports repository is 4 5.3.0, and on the Debian Stable repo is 0.4.17. They are… old. I decided to compile the latest Minetest, here are the steps that I did:

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

Getting the Minetest 5.4.0 Source Code

The official Minetest git repository can be found at: https://github.com/minetest/minetest. I just grabbed a compressed source code at the Releases page: https://github.com/minetest/minetest/archive/5.4.0.tar.gz.
To extract the tar.gz: tar -xf 5.4.0.tar.gz

$ wget 'https://github.com/minetest/minetest/archive/5.4.0.tar.gz'
$ tar -xf 5.4.0.tar.gz
$ cd minetest-5.4.0

Alternatively you can git clone the stable-5 branch:

$ git clone --branch stable-5 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 libirrlicht-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).
libirrlicht-dev is already the newest version (1.8.4+dfsg1-1.1).
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.

Compiling Minetest

Make sure you are in the minetest source code directoty:

$ cmake . -DRUN_IN_PLACE=TRUE -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.

Sample output:

$ cmake -B build
CMake Deprecation Warning at CMakeLists.txt:3 (cmake_policy):
  The OLD behavior for policy CMP0025 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- 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
-- *** Will build version 5.4.0 ***
...
-- 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
...
[ 96%] Building CXX object src/CMakeFiles/minetest.dir/serverlist.cpp.o
[ 96%] Building CXX object src/CMakeFiles/minetest.dir/settings.cpp.o
[ 97%] Building CXX object src/CMakeFiles/minetest.dir/staticobject.cpp.o
[ 97%] Building CXX object src/CMakeFiles/minetest.dir/terminal_chat_console.cpp.o
[ 97%] Building CXX object src/CMakeFiles/minetest.dir/texture_override.cpp.o
[ 98%] Building CXX object src/CMakeFiles/minetest.dir/tileanimation.cpp.o
[ 98%] Building CXX object src/CMakeFiles/minetest.dir/tool.cpp.o
[ 98%] Building CXX object src/CMakeFiles/minetest.dir/translation.cpp.o
[ 99%] Building CXX object src/CMakeFiles/minetest.dir/version.cpp.o
[ 99%] Building CXX object src/CMakeFiles/minetest.dir/voxel.cpp.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.

References:

https://github.com/minetest/minetest

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/).