Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 55 additions & 63 deletions docs/Compiling-on-Linux.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,121 @@
This page will guide you through all the required steps to compile the server core on Ubuntu or Arch. Compiling VMaNGOS on Linux is much easier than doing it on Windows, since you can install all dependencies through the terminal.
This page will guide you through all the required steps to compile the server core on Linux.

### Required software:
- g++ Compiler
- CMake
- Git

### Required dependencies:
- ACE
- TBB
- MySQL Connector/C or MariaDB
- OpenSSL
- MariaDB
- OpenSSL (if not on Arch)
- Zlib

## 1. Installing g++
## 1. Installing essential compiler packages

First we need to install the compiler.

### Ubuntu
### Debian, Ubuntu
```
sudo apt install g++
sudo apt install build-essential
```
### Arch
```
sudo pacman -S gcc
sudo pacman -S base-devel
```

## 2. Installing ACE

The ACE library is essential, since it's used for Networking, Threading and File System access.

### Ubuntu
```
sudo apt install -qq libace-dev
export ACE_ROOT=/usr/include/ace
```
### Arch
On Arch we have to use AUR
### Fedora
```
mkdir libace && cd libace
curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/ace.tar.gz
makepkg -si
cd .. && rm -rf libace
```

## 3. Installing TBB

The TBB library is used to provide better performance and scalability for memory allocation/deallocation operations in multithreaded applications, compared to the default allocator. This dependency is optional and can be skipped if you specify the USE_STD_MALLOC option when configuring with CMake.

### Ubuntu
```
sudo apt install -y libtbb-dev
export TBB_ROOT_DIR=/usr/include/tbb
```
### Arch
```
sudo pacman -S tbb
export TBB_ROOT_DIR=/usr/include/tbb
sudo dnf install make gcc g++
```

## 4. Installing Git

To download the source code for VMaNGOS, you should install Git. This can be avoided if you choose to manually download the zip archive from the website, but it's better to use Git, as it makes pulling updates from the main repository much easier.
### Ubuntu
### Debian, Ubuntu
```
sudo apt install git
```
### Arch
```
sudo pacman -S git
```
### Fedora
```
sudo dnf install git
```

## 5. Installing CMake

Since this is a cross-platform project, we use CMake to generate the appropriate solution files for every environment.
### Ubuntu
### Debian, Ubuntu
```
sudo apt install cmake
```
### Arch
```
sudo pacman -S cmake
```
### Fedora
```
sudo dnf install cmake
```

## 6 Installing MySQL Connector/C
## 6 Installing MariaDB

Account, character and game data is stored inside the database, so we need the MySQL connector library to read and write data to it.
### Ubuntu
Account, character and game data is stored inside the database, so we need MariaDB to read and write data to it.
### Debian, Ubuntu
```
sudo apt-get install libmysqlclient-dev
sudo apt-get install mariadb-server libmariadb-dev
systemctl enable --now mariadb.service
```
### Arch
On Arch good option is to use MariaDB instead of libmysqlclient since it is available in official repositories.
```
sudo pacman -S mariadb
sudo pacman -S mariadb mariadb-libs
systemctl enable --now mariadb.service
```
### Fedora
```
sudo dnf install mariadb-server mariadb-devel
systemctl enable --now mariadb.service
```

## 7. Installing OpenSSL

Communication between the game client and server needs to be encrypted, which requires a cryptography library.
### Ubuntu
### Debian, Ubuntu
```
sudo apt-get install openssl
sudo apt-get install libssl-dev
```
### Arch
OpenSSL is provided as part of coreutils and there is no need to install it.
### Fedora
```
sudo dnf install openssl
sudo dnf install openssl-devel
```

## 8. Installing Zlib

In order to reduce network traffic, a number of packets sent from the server are compressed, so we need a library for that too.
### Ubuntu
### Debian, Ubuntu
```
sudo apt install build-essential checkinstall zlib1g-dev -y
sudo apt install build-essential zlib1g-dev -y
```
### Arch
On arch we can use zlib-ng-compat, which is faster.
```
sudo pacman -S zlib-ng-compat
```
### Fedora
On Fedora we have to use zlib-ng-compat as zlib package has been deleted in Fedora 40+.
```
sudo pacman -S zlib
sudo dnf install zlib-ng-compat zlib-ng-compat-devel
```

## 9. Downloading the source code

Make a new folder called vmangos, and use Git to download the latest core revision:
Clone the latest core revision into a vmangos directory inside your home folder using Git:
```
mkdir vmangos
cd vmangos
mkdir ~/vmangos
cd ~/vmangos
git clone -b development https://github.com/vmangos/core
```

Expand All @@ -133,20 +125,20 @@ Now let's configure our project. Make another directory called `build` next to t
```
mkdir build
cd build
cmake ~/vmangos/core -DDEBUG=0 -DSUPPORTED_CLIENT_BUILD=5875 -DUSE_EXTRACTORS=0 -DCMAKE_INSTALL_PREFIX=~/vmangos
cmake ../core -DCMAKE_BUILD_TYPE=Release -DSUPPORTED_CLIENT_BUILD=5875 -DUSE_EXTRACTORS=0 -DCMAKE_INSTALL_PREFIX=~/vmangos
```

As you can see, you'll need to set a couple of settings when calling CMake. Here is what each of these means.

#### DEBUG=0
#### -DCMAKE_BUILD_TYPE=Release

This setting lets you choose if you want to compile in Debug or Release mode. The server will run much smoother in Release mode, so set Debug to 0.
This setting lets you choose if you want to compile in Debug or Release mode. The server will run much smoother in Release mode, so set -DCMAKE_BUILD_TYPE to Release.

#### SUPPORTED_CLIENT_BUILD=5875

Since this is a progressive emulator, you can specify the exact client version to support. The build number of the final Vanilla patch 1.12.1 is 5875. You can see your client's build number in the lower left corner of the login screen. Only the final version of each major patch is supported. That means you can play with 1.8.4, but not 1.8.0 for example.

#### USE_EXTRACTORS=1
#### USE_EXTRACTORS=0

The server needs the map terrain data in order to know where anything is located. This data is extracted from the game client using several tools, which you can choose to build with this setting. If you already have the map files from somewhere else, then you can set this to 0.

Expand All @@ -158,10 +150,10 @@ This setting lets you choose where to copy the binaries after compilation finish

Now that we have all the dependencies, and the project files have been properly configured, we can go ahead and compile the core. This can take quite a while, depending on the computer you are using.
```
make -j4
make -j(nproc)
make install
```

Congratulations! You should now be able to find the compiled binaries inside the `vmangos` directory.

Go to the [next tutorial](Getting-it-working.md) to learn how to setup your database.
Go to the [next tutorial](Getting-it-working-Linux.md) to learn how to setup your database and extract data files.