Difference between revisions of "Compiling Luanti"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Clearly separate between official and unofficial instructions)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
''This page is about compiling Minetest for desktop platforms. For compiling Minetest for Android, see [[Android]].''
+
This page is about how to compile Luanti yourself.
  
== Compiling on GNU/Linux ==
+
== Official compilation instructions ==
Install the dependencies using the commands provided in the [https://github.com/minetest/minetest#compiling README.md file].
 
  
=== System-wide binary using default configuration ===
+
We strongly recommend you read the [https://github.com/minetest/minetest#compiling Luanti README file]. It covers most of the important platforms.
  
Build the game (the <code>make</code> command is set to automatically detect the number of CPU threads to use):
+
== Unofficial compilation instructions ==
<pre>
 
cd /path/to/minetest_code/
 
cmake .
 
make -j$(grep -c processor /proc/cpuinfo)
 
# Run in
 
minetest
 
</pre>
 
  
=== Run-in-place binary using default configuration ===
+
The community has written several unofficial guides to compile Luanti on unusual or rare platforms. Proceed only if the README was not enough.
  
This option will place user data in the same directory as the Minetest build (suitable for removable media).
+
'''Tread carefully from this point on.'''
<pre>
 
cd /path/to/minetest_code/
 
cmake . -DRUN_IN_PLACE=1
 
cd bin/
 
./minetest
 
</pre>
 
  
* Use <code>cmake . -LH</code> to see all CMake options and their current state.
+
=== GNU/Linux ===
* You can build a bare server or a bare client by specifying <code>-DBUILD_CLIENT=0</code> or <code>-DBUILD_SERVER=0</code>.
 
* You can select between a Release and Debug build by <code>-DCMAKE_BUILD_TYPE=<Debug or Release></code>.
 
:* Debug build is slower, but gives much more useful output in a debugger.
 
  
=== Building without Irrlicht / X dependency ===
+
[http://forum.minetest.net/viewtopic.php?f=3&t=3837 One-line script for installing/compiling Minetest Git, for Debian / Ubuntu / Mint]
  
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.
+
=== Windows ===
 +
For compiling Luanti on Windows using MSYS2, see [https://wiki.voxelmanip.se/Compiling_on_Windows_using_MSYS2 Compiling on Windows using MSYS2].
  
<pre>
+
For compiling Luanti on Windows using MSVC, see the [https://github.com/minetest/minetest#compiling-on-windows-using-msvc Luanti README].
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
 
</pre>
 
  
=== See also ===
+
=== Cross-compilation ===
* [http://forum.minetest.net/viewtopic.php?f=3&t=3837 One-line script for installing/compiling Minetest Git, for Debian / Ubuntu / Mint]
+
To compile a win32 version of Luanti in Linux with [https://en.wikipedia.org/wiki/MinGW MinGW] you can use the build script in <code>[https://github.com/minetest/minetest/blob/master/util/buildbot/buildwin32.sh utils/buildbot/buildwin32.sh]</code>.
  
== Compiling on Windows ==
+
To compile a win64 version of Luanti in Linux with [https://en.wikipedia.org/wiki/MinGW MinGW] you can use the build script in <code>[https://github.com/minetest/minetest/blob/master/util/buildbot/buildwin32.sh utils/buildbot/buildwin64.sh]</code>.
Please see the [https://github.com/minetest/minetest#compiling-on-windows-using-msvc Minetest README].
 
 
 
== Cross-compilation ==
 
To compile a win32 version of Minetest in Linux with [https://en.wikipedia.org/wiki/MinGW MinGW] you can use the build script in <code>[https://github.com/minetest/minetest/blob/master/util/buildbot/buildwin32.sh utils/buildbot/buildwin32.sh]</code>.
 
 
 
To compile a win64 version of Minetest in Linux with [https://en.wikipedia.org/wiki/MinGW MinGW] you can use the build script in <code>[https://github.com/minetest/minetest/blob/master/util/buildbot/buildwin32.sh utils/buildbot/buildwin64.sh]</code>.
 
  
 
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.  
 
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.  
Line 66: Line 38:
  
 
[[Category:Core Engine]]
 
[[Category:Core Engine]]
[[Category:Compiling Minetest]]
+
[[Category:Compiling Luanti]]

Latest revision as of 22:22, 22 October 2024

This page is about how to compile Luanti yourself.

Official compilation instructions

We strongly recommend you read the Luanti README file. It covers most of the important platforms.

Unofficial compilation instructions

The community has written several unofficial guides to compile Luanti on unusual or rare platforms. Proceed only if the README was not enough.

Tread carefully from this point on.

GNU/Linux

One-line script for installing/compiling Minetest Git, for Debian / Ubuntu / Mint

Windows

For compiling Luanti on Windows using MSYS2, see Compiling on Windows using MSYS2.

For compiling Luanti on Windows using MSVC, see the Luanti README.

Cross-compilation

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

To compile a win64 version of Luanti 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