Installation (Arch)

From Project Skyfire
Jump to navigation Jump to search


Introduction

This page covers the Arch Linux prerequisites and build steps for the current SkyFire_548 source tree. The same package names apply on Arch-based distributions such as CachyOS.

The current build requires GCC 14 or newer for C++23, Boost 1.91.0 or newer, OpenSSL 4.0.0 with the legacy provider module, and the MariaDB client development headers. Arch ships a current GCC and a current Boost, so those come from the package repositories. Arch's OpenSSL package is still the 3.x series, so this guide builds OpenSSL 4.0.0 into /opt and leaves the system OpenSSL in place.

The commands below assume a 64-bit Arch host and install SkyFire into /usr/local/skyfire-server.

Prerequisites

Install build tools and system libraries

Install the compiler, build tools, MariaDB client development files, and the Unix libraries used by the SkyFire CMake build.

sudo pacman -S --needed \
  base-devel \
  cmake \
  ninja \
  git \
  wget \
  ccache \
  perl \
  pkgconf \
  bzip2 \
  readline \
  zlib \
  boost \
  mariadb-libs \
  mariadb-clients \
  mariadb

base-devel provides GCC and G++. Use the default gcc and g++ commands. SkyFire accepts GCC 14 or newer, and the Arch gcc package is newer than that.

Verify the toolchain:

gcc --version
g++ --version
cmake --version
pacman -Q boost mariadb-libs

cmake must be 3.27.7 or newer. The boost package must be 1.91.0 or newer. mariadb-libs supplies mysql.h, mysql_config, and libmysqlclient.so. The current source tree compiles against that MariaDB client.

Prepare the MariaDB server

mariadb-libs is enough to compile SkyFire. The mariadb package is the database server used later for the auth, characters, and world databases. Arch does not initialize or start it during installation:

sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl enable --now mariadb

After the source tree is cloned, create the auth, characters, and world databases and the skyfire login. From the SkyFire_548 directory:

sudo mariadb < sql/create/create_mysql.sql

On Arch, the database root account authenticates through the local socket, so sudo mariadb runs that script as an administrator without a password prompt. The script creates user skyfire with password skyfire and grants that account full access to the auth, characters, and world databases. It creates the account for both localhost and 127.0.0.1, which matches the default database settings in authserver.conf.dist and worldserver.conf.dist.

Install OpenSSL 4.0.0

Arch system packages provide OpenSSL 3.x. SkyFire currently requires OpenSSL 4.0.0 and must be able to find the OpenSSL legacy provider module. Install this copy under /opt. Do not replace the distro openssl package. The MariaDB client remains linked to the system OpenSSL 3 libraries.

mkdir -p ~/skyfire-build-deps
cd ~/skyfire-build-deps

wget https://www.openssl.org/source/openssl-4.0.0.tar.gz
tar -xzf openssl-4.0.0.tar.gz
cd openssl-4.0.0

./Configure linux-x86_64 \
  --prefix=/opt/openssl-4.0.0 \
  --openssldir=/opt/openssl-4.0.0/ssl \
  shared \
  enable-legacy

make -j"$(nproc)"
sudo make install_sw install_ssldirs

Verify that the legacy provider exists:

find /opt/openssl-4.0.0 -name legacy.so -print

At least one path ending in ossl-modules/legacy.so should be printed.

Build environment variables

Set these variables before configuring SkyFire. They may also be added to ~/.profile or another shell startup file if this machine will build SkyFire regularly.

export OPENSSL_ROOT_DIR=/opt/openssl-4.0.0
export LD_LIBRARY_PATH="$OPENSSL_ROOT_DIR/lib64:$OPENSSL_ROOT_DIR/lib:${LD_LIBRARY_PATH:-}"

Leave CC, CXX, and BOOST_ROOT unset so CMake uses the system GCC and the boost package.

Compiling and Installing SkyFire 5.4.8

Clone the source

cd ~
git clone https://github.com/ProjectSkyfire/SkyFire_548.git
cd SkyFire_548

To build a specific branch, check it out before configuring:

git checkout main

Configure

Use an out-of-source build directory. Ninja is recommended.

cmake -S . -B build/arch -G Ninja \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_INSTALL_PREFIX=/usr/local/skyfire-server \
  -DCONF_DIR=/usr/local/skyfire-server/etc \
  -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" \
  -DTOOLS=ON

Build

cmake --build build/arch --parallel "$(nproc)"

Install

sudo cmake --install build/arch

Register the OpenSSL 4 library directory with the dynamic linker so the installed binaries can load libssl.so.4 and libcrypto.so.4:

echo /opt/openssl-4.0.0/lib64 | sudo tee /etc/ld.so.conf.d/skyfire-openssl.conf
echo /opt/openssl-4.0.0/lib | sudo tee -a /etc/ld.so.conf.d/skyfire-openssl.conf
sudo ldconfig

Confirm the binaries were installed

ls -lh /usr/local/skyfire-server/bin/authserver
ls -lh /usr/local/skyfire-server/bin/worldserver
ldd /usr/local/skyfire-server/bin/authserver | grep -E 'ssl|crypto|mysql|mariadb'

ldd should list libssl.so.4 and libcrypto.so.4 from /opt/openssl-4.0.0, plus libmariadb.so.3. It will also list libssl.so.3 and libcrypto.so.3 because the MariaDB client is built against the system OpenSSL. Those are different library names and can be loaded together.

Useful CMake Options

-DSERVERS=ON          Build worldserver and authserver. Enabled by default.
-DSCRIPTS=ON          Build core with scripts included. Enabled by default.
-DTOOLS=ON            Build map/vmap/mmap extraction and assembler tools.
-DNOPCH=1             Disable all precompiled headers.
-DUSE_COREPCH=ON      Use precompiled headers for core/server targets.
-DUSE_SCRIPTPCH=ON    Use precompiled headers for scripts.
-DWITH_WARNINGS=ON    Enable extra compiler warnings.
-DWITH_COREDEBUG=ON   Include additional core debug code.
-DWITHOUT_GIT=ON      Disable git revision detection.
-DAUTH_SERVER=ON      Build authserver. Enabled by default.
-DWITH_CXX_23_STD=ON  Use C++23. Enabled by default.
-DWITH_CXX_DRAFT_STD=ON Use the compiler draft standard mode.
-DCONF_DIR=/path      Set the installed configuration directory.
-DLIBSDIR=/path       Set the installed library directory.

Troubleshooting

GCC: Compiler doesnt support c++23

The build is using GCC 13 or another older compiler. Update the distro gcc package and remove the old CMake cache first.

sudo pacman -S gcc
rm -rf build/arch
cmake -S . -B build/arch -G Ninja \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_INSTALL_PREFIX=/usr/local/skyfire-server \
  -DCONF_DIR=/usr/local/skyfire-server/etc \
  -DOPENSSL_ROOT_DIR=/opt/openssl-4.0.0 \
  -DTOOLS=ON

Boost was not found

Install the boost headers and confirm the package is 1.91.0 or newer:

sudo pacman -S boost
pacman -Q boost

If CMake cached an incorrect Boost path, delete the build directory and configure again.

rm -rf build/arch

If the packaged Boost is older than 1.91.0, install Boost 1.91.0 headers into /opt and pass that prefix to CMake:

mkdir -p ~/skyfire-build-deps
cd ~/skyfire-build-deps

wget https://archives.boost.io/release/1.91.0/source/boost_1_91_0.tar.gz
tar -xzf boost_1_91_0.tar.gz
cd boost_1_91_0

./bootstrap.sh
sudo ./b2 install --prefix=/opt/boost_1_91_0 --with-headers -j"$(nproc)"
cmake -S . -B build/arch -G Ninja -DBOOST_ROOT=/opt/boost_1_91_0

SkyFire needs OpenSSL version 4.0.0

CMake found the system OpenSSL 3.x libraries instead of /opt/openssl-4.0.0. Delete the build directory and configure with OPENSSL_ROOT_DIR set.

rm -rf build/arch
export OPENSSL_ROOT_DIR=/opt/openssl-4.0.0
cmake -S . -B build/arch -G Ninja \
  -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" \
  -DTOOLS=ON

OpenSSL legacy provider was not found

OpenSSL was built without enable-legacy, or CMake is pointed at the wrong OpenSSL root.

find /opt/openssl-4.0.0 -name legacy.so -print

If nothing is printed, rebuild OpenSSL with enable-legacy.

libssl.so.3 may conflict with libssl.so.4

The link step can warn that libmariadb.so needs libssl.so.3 while SkyFire uses libssl.so.4. Keep both. SkyFire loads OpenSSL 4 from /opt/openssl-4.0.0, and the MariaDB client keeps using the system OpenSSL 3 libraries. Do not replace the distro openssl package with the /opt build.

MariaDB headers or libraries were not found

Install the MariaDB client development package:

sudo pacman -S mariadb-libs

Confirm mysql_config and the client header are present:

mysql_config --include
ls /usr/include/mysql/mysql.h

If MariaDB is installed in a custom location, set MYSQL_HOME, MYSQL_ROOT, or MYSQL_DIR before configuring.

export MYSQL_HOME=/path/to/mysql

References