Installation (Ubuntu 24.04 LTS)

From Project Skyfire
Jump to navigation Jump to search


Introduction

This page covers the Ubuntu 24.04 LTS prerequisites and build steps for the current SkyFire_548 source tree.

The current build requires GCC 14 or newer for C++23, Boost 1.91.0, OpenSSL 4.0.0 with the legacy provider module, and the MySQL client development headers. Ubuntu 24.04 ships older default compiler and OpenSSL development packages than SkyFire currently requires, so this guide installs GCC 14 explicitly and builds Boost/OpenSSL into /opt.

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

Prerequisites

Update Ubuntu and enable Universe

GCC 14 is available from the Ubuntu 24.04 package repositories, but it may require the Universe repository to be enabled.

sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository -y universe
sudo apt update

Install build tools and system libraries

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

sudo apt install -y \
  build-essential \
  gcc-14 \
  g++-14 \
  cmake \
  ninja-build \
  git \
  wget \
  ca-certificates \
  ccache \
  perl \
  pkg-config \
  bzip2 \
  libbz2-dev \
  libreadline-dev \
  zlib1g-dev \
  default-libmysqlclient-dev \
  default-mysql-client \
  mysql-server

Verify that GCC 14 is installed:

gcc-14 --version
g++-14 --version
cmake --version

SkyFire must be configured with gcc-14 and g++-14. The default gcc/g++ commands on Ubuntu 24.04 may still resolve to GCC 13.

Install Boost 1.91.0

Current SkyFire requires Boost 1.91.0. The current source tree only needs the Boost headers, so the install below matches the CI build.

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)"

Install OpenSSL 4.0.0

Ubuntu 24.04 system packages provide OpenSSL 3.x. SkyFire currently requires OpenSSL 4.0.0 and must be able to find the OpenSSL legacy provider module.

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 CC=gcc-14
export CXX=g++-14
export BOOST_ROOT=/opt/boost_1_91_0
export OPENSSL_ROOT_DIR=/opt/openssl-4.0.0
export LD_LIBRARY_PATH="$OPENSSL_ROOT_DIR/lib64:$OPENSSL_ROOT_DIR/lib:${LD_LIBRARY_PATH:-}"

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 for Ubuntu builds.

cmake -S . -B build/ubuntu -G Ninja \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_INSTALL_PREFIX=/usr/local/skyfire-server \
  -DCMAKE_C_COMPILER="$CC" \
  -DCMAKE_CXX_COMPILER="$CXX" \
  -DBOOST_ROOT="$BOOST_ROOT" \
  -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" \
  -DTOOLS=ON \
  -DNOPCH=1

The -DNOPCH=1 option disables precompiled headers. This is the recommended Ubuntu CI configuration while the Linux build is being stabilized.

Build

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

Install

sudo cmake --install build/ubuntu

If the installed binaries cannot find libssl.so or libcrypto.so at runtime, register the OpenSSL library directory with the dynamic linker:

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'

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. Reconfigure with gcc-14 and g++-14, and remove the old CMake cache first.

rm -rf build/ubuntu
export CC=gcc-14
export CXX=g++-14
cmake -S . -B build/ubuntu -G Ninja \
  -DCMAKE_C_COMPILER="$CC" \
  -DCMAKE_CXX_COMPILER="$CXX" \
  -DBOOST_ROOT=/opt/boost_1_91_0 \
  -DOPENSSL_ROOT_DIR=/opt/openssl-4.0.0 \
  -DTOOLS=ON \
  -DNOPCH=1

Boost was not found

Confirm that Boost 1.91.0 was installed and pass BOOST_ROOT to CMake.

find /opt/boost_1_91_0 -path '*Boost-1.91.0*' -print
cmake -S . -B build/ubuntu -G Ninja -DBOOST_ROOT=/opt/boost_1_91_0

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

SkyFire needs OpenSSL version 4.0.0

CMake found Ubuntu's system OpenSSL instead of /opt/openssl-4.0.0. Delete the build directory and configure with OPENSSL_ROOT_DIR set.

rm -rf build/ubuntu
export OPENSSL_ROOT_DIR=/opt/openssl-4.0.0
cmake -S . -B build/ubuntu -G Ninja \
  -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" \
  -DBOOST_ROOT=/opt/boost_1_91_0 \
  -DCMAKE_C_COMPILER=gcc-14 \
  -DCMAKE_CXX_COMPILER=g++-14 \
  -DTOOLS=ON \
  -DNOPCH=1

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.

MySQL headers or libraries were not found

Install the MySQL client development package:

sudo apt install -y default-libmysqlclient-dev

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

export MYSQL_HOME=/path/to/mysql

References