Compiling Minetest

From Minetest Developer Wiki
Revision as of 20:41, 24 October 2022 by ROllerozxa (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page is about compiling Minetest for desktop platforms. For compiling Minetest for Android, see Android.

Compiling on GNU/Linux

Install the dependencies using the commands provided in the README.md file.

System-wide binary using default configuration

Build the game (the make command is set to automatically detect the number of CPU threads to use):

cd /path/to/minetest_code/
cmake .
make -j$(grep -c processor /proc/cpuinfo)
# Run in
minetest

Run-in-place binary using default configuration

This option will place user data in the same directory as the Minetest build (suitable for removable media).

cd /path/to/minetest_code/
cmake . -DRUN_IN_PLACE=1
cd bin/
./minetest
  • Use cmake . -LH to see all CMake options and their current state.
  • You can build a bare server or a bare client by specifying -DBUILD_CLIENT=0 or -DBUILD_SERVER=0.
  • You can select between a Release and Debug build by -DCMAKE_BUILD_TYPE=<Debug or Release>.
  • Debug build is slower, but gives much more useful output in a debugger.

Building without Irrlicht / X dependency

You can build the Minetest server without library dependencies to Irrlicht or any graphical stuff. You still need the Irrlicht headers for this, so first, download the irrlicht source to somewhere.

git clone minetest/minetest -b stable-5
git clone minetest/irrlicht -b 1.9.0mt7
cd minetest
cmake . -DRUN_IN_PLACE=0 -DBUILD_CLIENT=0 -DBUILD_SERVER=1 -DIRRLICHT_INCLUDE_DIR=../irrlicht/include
make -j7

See also

Compiling on Windows

Please see the Minetest README.

Cross-compilation

To compile a win32 version of Minetest in Linux with MinGW you can use the build script in utils/buildbot/buildwin32.sh.

To compile a win64 version of Minetest in Linux with MinGW you can use the build script in utils/buildbot/buildwin64.sh.

If you have errors during cross compilation related to std::thread and std::mutex, this is due to mingw-w64 being incorrectly configured for cross compilation.

To fix the errors, use the command:

For 64-bit builds: sudo update-alternatives --config x86_64-w64-mingw32-g++

For 32-bit Ubuntu Builds: sudo update-alternatives --config i686-w64-mingw32-g++

For 32-bit Debian Builds: sudo update-alternatives --config i586-w64-mingw32-g++

When provided with a prompt for which version to select, please choose "posix". Then retry the buildwin32.sh or buildwin64.sh