[Ubuntu] Compiling latest Minetest [Tutorial / Script]

Post Reply
User avatar
Gael de Sailly
Member
Posts: 805
Joined: Sun Jan 26, 2014 17:01
GitHub: Gael-de-Sailly
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly Ginkgoo
Location: France

[Ubuntu] Compiling latest Minetest [Tutorial / Script]

by Gael de Sailly » Post

Hi,

This was originally made to be an update of Calinou's 1-line script but I think there is a need to make a detailed tutorial about compilation on Linux, especially with the new Irrlicht fork.
See at the bottom for the 1-line script.

This procedure downloads and builds latest git Minetest in the directory you are in (change with cd), creating a portable install (all data is kept in the folder). I have tested it on my Ubuntu Mate 20.04, and it will probably work on others Debian-based systems. For the earlier or later versions, there is possibility that some package names differ.
In general, the concepts would be the same for every Linux-based systems, but equivalent libraries have to be found.


1. Install libraries

To install all recommended libraries:

Code: Select all

sudo apt-get install git g++ make cmake build-essential libjpeg8-dev libpng-dev zlib1g-dev libopengl-dev libglx-dev libgl1-mesa-dev libx11-dev libxxf86vm-dev libvorbis-dev libopenal-dev libsqlite3-dev libluajit-5.1-dev libjsoncpp-dev libgmp-dev libcurl4-gnutls-dev libfreetype6-dev
+ Details

2. Download Minetest, Minetest Game and Minetest's Irrlicht

Minetest is now based on a custom fork of Irrlicht (IrrlichtMt) that needs to be downloaded and compiled separately.

Code: Select all

git clone --depth=1 https://github.com/minetest/minetest
git clone --depth=1 https://github.com/minetest/irrlicht
Minetest Game also has to be download separately. Here I propose to install it as a symlink. This is a way to keep all 3 repos easily accessible in the same directory, while still having Minetest Game installed. Cloning minetest_game directly into minetest/games is possible too, of course.

Code: Select all

git clone --depth=1 https://github.com/minetest/minetest_game
ln -s ../../minetest_game minetest/games/minetest_game

3. Build Irrlicht

Code: Select all

cd irrlicht
cmake . -DBUILD_SHARED_LIBS=OFF
make -j$(nproc)
This should generate a library named libIrrlichtMt.a in lib/Linux.


4. Build Minetest

Minetest has to be linked to the IrrlightMt we just finished to build. Otherwise, compilation procedure is very similar.

Code: Select all

cd ../minetest
cmake . -DRUN_IN_PLACE=1 -DIRRLICHT_LIBRARY=../irrlicht/lib/Linux/libIrrlichtMt.a -DIRRLICHT_INCLUDE_DIR=../irrlicht/include
make -j$(nproc)

5. Run it and enjoy :)

Code: Select all

bin/minetest

TL;DR: All-in-one install script

This script should do all the above steps, and run Minetest at the end. Just copy-paste it in a terminal.

Code: Select all

echo -e "\nInstalling required packages\n" && sudo apt-get install -y git g++ make cmake build-essential libjpeg8-dev libpng-dev zlib1g-dev libopengl-dev libglx-dev libgl1-mesa-dev libx11-dev libxxf86vm-dev libvorbis-dev libopenal-dev libsqlite3-dev libluajit-5.1-dev libjsoncpp-dev libgmp-dev libcurl4-gnutls-dev libfreetype6-dev && echo -e "\nDownloading content\n" && git clone --depth=1 https://github.com/minetest/minetest && git clone --depth=1 https://github.com/minetest/minetest_game && git clone --depth=1 https://github.com/minetest/irrlicht && ln -s ../../minetest_game minetest/games/minetest_game && echo -e "\nBuilding IrrlichtMt\n" && cd irrlicht && cmake . -DBUILD_SHARED_LIBS=OFF && make -j$(nproc) && echo -e "\nBuilding Minetest\n" && cd ../minetest && cmake . -DRUN_IN_PLACE=1 -DIRRLICHT_LIBRARY=../irrlicht/lib/Linux/libIrrlichtMt.a -DIRRLICHT_INCLUDE_DIR=../irrlicht/include && make -j$(nproc) && echo -e "\nLaunching the game, just for you.\nEnjoy\n" && bin/minetest
That's it! I hope everything here is correct and will work for you too :) If you have any suggests, or things I may have forgotten, please tell me.
Last edited by Gael de Sailly on Sun Apr 04, 2021 11:25, edited 3 times in total.
Just realize how bored we would be if the world was perfect.

User avatar
Festus1965
Member
Posts: 2011
Joined: Sun Jan 03, 2016 11:58
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by Festus1965 » Post

Gael de Sailly wrote:
Sat Apr 03, 2021 16:30
This script should do all the above steps, and run Minetest at the end. Just copy-paste it in a terminal.

Code: Select all

echo -e "\nInstalling required packages\n" && sudo apt-get install -y git g++ make cmake build-essential libjpeg8-dev libpng-dev zlib1g-dev libopengl-dev libglx-dev libgl1-mesa-dev libx11-dev libxxf86vm-dev libvorbis-dev libopenal-dev libsqlite3-dev libluajit-5.1-dev libjsoncpp-dev libgmp-dev libcurl4-gnutls-dev libfreetype6-dev && echo -e "\nDownloading content\n" && git clone --depth=1 https://github.com/minetest/minetest && git clone --depth=1 https://github.com/minetest/minetest_game && git clone --depth=1 https://github.com/minetest/irrlicht && ln -s ../../minetest_game minetest/games/minetest_game && echo -e "\nBuilding IrrlichtMt\n" && cd irrlicht && cmake . -DBUILD_SHARED_LIBS=OFF && make -j$(nproc) && echo -e "\nBuilding Minetest\n" && cd ../minetest && cmake . -DRUN_IN_PLACE=1 -DIRRLICHT_LIBRARY=../irrlicht/lib/Linux/libIrrlichtMt.a -DIRRLICHT_INCLUDE_DIR=../irrlicht/include && make -j$(nproc) && echo -e "\nLaunching the game, just for you.\nEnjoy!\n" && bin/minetest
no, didn't:
+ Spoiler
"make -j$(nproc)" ment ...
+ Spoiler
at minetest ... "make -j$(nproc)"
+ Spoiler
got Minetest Client 5.5.0-dev-8878367

couldn't use spoiler at first as forum sometime (often) sooo slow, and better posted not nice then lost !
Last edited by Festus1965 on Tue Apr 20, 2021 01:46, edited 2 times in total.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

User avatar
Gael de Sailly
Member
Posts: 805
Joined: Sun Jan 26, 2014 17:01
GitHub: Gael-de-Sailly
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly Ginkgoo
Location: France

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by Gael de Sailly » Post

Festus1965 wrote:
Sun Apr 04, 2021 00:05
no, didn't:
thomas@intel-i74770-8x34-32GB:~$ echo -e "\nInstalling required packages\n" && sudo apt-get install -y git g++ make cmake build-essential libjpeg8-dev libpng-dev zlib1g-dev libopengl-dev libglx-dev libgl1-mesa-dev libx11-dev libxxf86vm-dev libvorbis-dev libopenal-dev libsqlite3-dev libluajit-5.1-dev libjsoncpp-dev libgmp-dev libcurl4-gnutls-dev libfreetype6-dev && echo -e "\nDownloading content\n" && git clone --depth=1 https://github.com/minetest/minetest && git clone --depth=1 https://github.com/minetest/minetest_game && git clone --depth=1 https://github.com/minetest/irrlicht && ln -s ../../minetest_game minetest/games/minetest_game && echo -e "\nBuilding IrrlichtMt\n" && cd irrlicht && cmake . -DBUILD_SHARED_LIBS=OFF && make -j$(nproc) && echo -e "\nBuilding Minetest\n" && cd ../minetest && cmake . -DRUN_IN_PLACE=1 -DIRRLICHT_LIBRARY=../irrlicht/lib/Linux/libIrrlichtMt.a -DIRRLICHT_INCLUDE_DIR=../irrlicht/include && make -j$(nproc) && echo -e "\nLaunching the game, just for you.\nEnjoy!\n" && bin/minetest
bash: !\n: event not found
thomas@intel-i74770-8x34-32GB:~$
Character escape mistake, should be fixed now.
Just realize how bored we would be if the world was perfect.

User avatar
runs
Member
Posts: 2213
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by runs » Post

Thanks it works OK. The new 5.5 plus Irlitch speed up the graphics a lot :-)
Ko-fi | 💬 Minetest Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

DoyleChris
Member
Posts: 257
Joined: Sat Jul 25, 2015 19:54
In-game: DoyleChris

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by DoyleChris » Post

Does this lock the directory, or does it make it portable. I want to be able to back up all my mods and worlds in one directory.

deleted c0a803ab

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by deleted c0a803ab » Post

Festus1965 wrote:
Sun Apr 04, 2021 00:05
[...]
Gee!
Use codeblocks!

User avatar
Nathan.S
Member
Posts: 1082
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by Nathan.S » Post

Thanks for this. My auto-update script broke, and I couldn't figure out how to tell cmake where to look for the fork of Irrlicht. Working perfectly now.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

SteveTeece
New member
Posts: 3
Joined: Thu Aug 29, 2019 05:41
GitHub: SteveTeece

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by SteveTeece » Post

Nathan.S wrote:
Wed May 05, 2021 14:26
Thanks for this. My auto-update script broke, and I couldn't figure out how to tell cmake where to look for the fork of Irrlicht. Working perfectly now.
Hi Nathan,

I've been trying to update the MineTest headless server I manage on an Ubuntu server, but have not had a lot of success.

Would you be willing to share your Update script so I can find out what I am doing wrong?

User avatar
Nathan.S
Member
Posts: 1082
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by Nathan.S » Post

I doubt if it will help you much, but here it is.

Code: Select all

#!/bin/bash
# Make script crontab friendly:
cd $(dirname $0)

git pull
cd games/minetest_game
git pull
cd ../..
#cmake . -DRUN_IN_PLACE=FALSE -DBUILD_CLIENT=1 -DBUILD_SERVER=1 -DIRRLICHT_LIBRARY=/home/nathan/Minetest_Builds/irrlicht/lib/Linux/libIrrlichtMt.a -DIRRLICHT_INCLUDE_DIR=/home/nathan/Minetest_Builds/irrlicht/include
make -j 10
It just pulls the code from git for the engine and game, and then runs make. The commented out line is only needed the first time.

You'll have to change /home/nathan/Minetest_Builds/ to whatever location you've compiled irrlicht in.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Eris
Member
Posts: 30
Joined: Thu Nov 19, 2020 23:12
IRC: Ovalo
In-game: Eris_still_crafts

Re: [Ubuntu] Compiling latest Minetest [Tutorial / Script]

by Eris » Post

Nathan.S wrote:
Mon May 10, 2021 03:28
I doubt if it will help you much, but here it is.
Hi,
I made 2 simple bash scripts with all steps covered (minus the dependencies, because they require root).

Upgrade script:

Code: Select all

#!/bin/bash
# Make script crontab friendly:
cd $(dirname $0)

# Clone & make IrrlichtMt
git clone https://github.com/minetest/irrlicht ~/PATH-TO-DIR/irrlicht
cd ~/PATH-TO-DIR/irrlicht/source/Irrlicht
make -j$(nproc)
cd ../..
cmake . -DBUILD_SHARED_LIBS=OFF
make -j$(nproc)

# Clone & make Minetest and MTG
git clone --depth 1 https://github.com/minetest/minetest.git ~/PATH-TO-DIR/minetest
git clone --depth 1 https://github.com/minetest/minetest_game.git ~/PATH-TO-DIR/minetest/games/minetest_game
cd ~/PATH-TO-DIR/minetest
cmake . -DRUN_IN_PLACE=TRUE -DIRRLICHT_LIBRARY=/PATH-TO-DIR/irrlicht/lib/Linux/libIrrlichtMt.so -DIRRLICHT_INCLUDE_DIR=/PATH-TO-DIR/irrlicht/include
make -j$(nproc)
Update script:

Code: Select all

#!/bin/bash
# Make script crontab friendly:
cd $(dirname $0)

# Pull & make IrrlichtMt
cd ~/PATH-TO-DIR/irrlicht
git pull
cd ~/PATH-TO-DIR/irrlicht/source/Irrlicht
make -j$(nproc)
cd ../..
make -j$(nproc)

# Pull & make Minetest and MTG
cd ~/PATH-TO-DIR/minetest
git pull
cd games/minetest_game
git pull
cd ../..
make -j$(nproc)
One compiles everything, and the other pulls changes; both include the irrlicht repo as well.
Ofc, be sure to change /PATH-TO-DIR/ to the right directories.

I hope it can be useful to the less tech-savvy folks like me. :)
APIONET is all.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest