Skip to content

Project Setup (Linux)

kenner2 edited this page Feb 23, 2026 · 12 revisions

Important

Only the server programs can be built and run on Linux. The client and tools currently require Windows to build. Cross-platform support for the client is underway.

A client executable, compiled on Windows, can be run using Proton if you're solely focused on server development.


Contents


  1. Prerequisites
  2. Fork the Repository
  3. IDE Setup
  4. Database Setup
  5. ODBC Setup
  6. Server Configuration
  7. Client Setup

Prerequisites


This is the guide for the Linux-based project setup. If you're looking for Windows, see Project Setup (Windows).

You'll need the following to work with the project:

  • CLion
  • Dependency packages listed below

Install Dependency Packages

You'll need the following dependencies installed on your system:

package description
unixodbc ODBC tools (like odbcinst)
unixodbc-dev ODBC build headers and libraries
msodbcsql Microsoft MSSQL ODBC driver v18
docker Docker is an container management platform
git Git is a source code management tool

Below are the commands for a few popular package managers.

apt (Debian, Ubuntu, others)

sudo apt install unixodbc unixodbc-dev git
sudo ACCEPT_EULA=Y apt install msodbcsql18

pacman (Arch)

sudo pacman -S unixodbc msodbcsql docker git

yay (Arch AUR)

sudo yay -S unixodbc msodbcsql docker git

homebrew (Mac)

brew install unixodbc docker git
brew tap microsoft/mssql-release
brew install msodbcsql18


Fork the Repository


Fork the Knight Online repository then clone your fork to your machine. If you're unfamiliar with Git, see our Using Git page for help.


IDE Setup (CLion)


Our current IDE recommendation for Linux-based platforms is CLion. This IDE is free for non-commercial use, and this is a non-commercial project. Installation is left to the user to figure out as it varies by distribution.

Once installed, you should see the following welcome screen. Click the "Open" button and select the folder of your git repository (KnightOnline).

image

CLion should automatically detect the CMake build files used to build the Server projects. You should be able to just accept default configuration for the Debug profile:

image

It will take a moment for the project indexes and CMake caches to build. You'll know when this is complete when the progress bar in the lower-right goes away:

image
image

The CMake build configurations should now be loaded and available in the Run Configurations section (top-right corner of the IDE):

image

Build and run the servers in the typical order: AIServer > Ebenezer > Aujard > VersionManager

Compiled server files (and configuration) will be written to cmake-build-debug/bin/Debug. Default configuration files will be generated on first run. These do not need to be updated unless you're using an altered ODBC DSN.

If your SQL Server, ODBC, and server configuration files are setup correctly then you should see the program launch after a successful build:

image


Database Setup


It is recommended to use our docker image and scripts for development on Linux. See the Docker README.MD for guidance.

SQL Server does have support for some Linux distributions. If you want to attempt a manual setup, see SQL Server Manual Setup.


ODBC Setup


Note that this assumes you've either:

  • Successfully started the Docker database container, OR
  • Manually restored the database as "KN_online" (if you restored it as something else, be sure to use its new name appropriately).

Update ODBC configuration files

To find the location of your odbc configuration files, run the following in a terminal:

odbcinst -j

We're interested in location of the driver and system data source configuration files:

DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini

Edit these files to configure your ODBC connection:

  1. Edit odbcinst.ini and ensure that the following driver registration exists (your driver location may vary):

[ODBC Driver 18 for SQL Server]
Description=Microsoft ODBC Driver 18 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-18.5.so.1.1
UsageCount=1

  1. Edit odbc.ini and add the following entry (if you do not already have it). Update the Server and Database information to match your configuration.

[KN_online]
Description = Knight Online SQL Connection
# Driver must match the driver name (in brackets) from odbcinst.ini
Driver = ODBC Driver 18 for SQL Server
Server = localhost,1433
Database = KN_online
Port = 1433
UID = knight
PWD = knight
Encrypt = no
TrustServerCertificate = yes
ConnectionPooling = yes

Test your connection

Using unixodbc's isql tool, we can test our odbc connection to our database. The general syntax for the command is: isql -v (DSN Name) (User) (Password)

For an out-of-the-box solution, this will typically be: isql -v KN_online knight knight

This should open an interactive SQL prompt if your connection is successful. You can run a test query here, if desired: SELECT * FROM TB_USER

Enter quit to close the interactive SQL console.

Optional: Connect CLion to your database

To connect CLion to your development database, see CLion SQL Client Setup.


Server Configuration


The server applications will generate their default configuration the first time they are run. If new configuration is added, the server will add the default value to the file on the next run.

If you feel compelled to change the default configuration, you can edit the .ini file for the application.

Under cmake-build-debug/bin/Debug/:

Application Configuration File
AIServer server.ini
Ebenezer gameserver.ini
Aujard Aujard.ini
VersionManager Version.ini
ItemManager ItemManager.ini

Client Setup


The client does not natively compile/run on Linux as of this writing. This section will show you how to cross-compile the client code into an .exe using the Mingw compiler, then use Wine to run it.

Dependencies

In order to cross compile, you'll need to install the packages that include the mingw compilers x86_64-w64-mingw32-g++ (C++) and x86_64-w64-mingw32-gcc (C) for your distro. You should be able to use the which command to ensure that they are installed and available on your PATH.

Configure Cross-Compile Toolchain

Before configuring a CMake Build Profile for the client, we need to configure a cross-compile Toolchain for it to use.

  1. Open your IDE Settings with Ctrl+Alt+S
  2. Search for "toolchains" to filter the list, then select "Toolchains" under "Build, Execution, Deployment".
  3. Click the + Add icon, and add a new Toolchain configuration as follows:

  4. Name: Cross Compile
  5. CMake: Bundled
  6. Build Tool: Ninja
  7. C Compiler: x86_64-w64-mingw32-gcc (use which to find the path)
  8. C++ Compiler: x86_64-w64-mingw32-g++ (use which to find the path)
  9. Debugger: Bundled GDB
  10. Click Apply or OK to save

Configure CMake Client Build Profile

With our Toolchain configured, we can now set up the CMake Client Build Profile.

  1. Open your IDE Settings with Ctrl+Alt+S
  2. Search for "cmake" to filter the list, then select "CMake" under "Build, Execution, Deployment"
  3. Click the + Add icon, and add a new Profile as follows:

  4. Name: Debug (Client)
  5. Build type: Debug
  6. Toolchain: Cross Compile (or whatever you named it in the previous section)
  7. Generator: Ninja
  8. CMake Options: -DCMAKE_SYSTEM_NAME="Windows" -DOPENKO_BUILD_SERVERS=OFF -DCMAKE_BUILD_TYPE=Debug
  9. Build Directory: cmake-build-debug-client
  10. We keep this separate from the Default/Server build directory (cmake-build-debug) in order to prevent cross-cache contamination. Keep this in mind when looking for build artifacts and setting up run configs.
  11. Click Apply or OK to save

Switching to the Client Build Profile

In order to switch between the Client Build Profile and the Default, use the Profile Dropdown to the left of your run configurations dropdown:

Our Debug (Client) Profile is only set up to build Warfare. It will not be available if you attempt to switch profiles while a server application is the selected configuration. CLion should automatically pick the correct profile for Server/Client based on this. Server applications will be compiled into a native executable, the Client will cross-compile into a Windows executable.

If Client/WarFare does not appear in your run configuration list, right-click on the project-level CMakeLists.txt, and select Reload CMake Project.

Modify WarFare Run Configuration

In order to run the cross-compiled executable, the run configuration must be updated with a working directory that contains the client data, and optionally an Options.ini file.

You have two options for this:

  1. Set up a dedicated directory somewhere with the client data and your configuration.
  2. Set up under the CMake build directory: KnightOnline/cmake-build-debug-client/ClientData (Note: you'll need to grab the full absolute path to this folder)

Once you've decided, go to Edit Configurations..., select Client/WarFare, and set the Working Directory appropriately.

You should now be able to build/run the client.

Debugging the Cross-Compiled Client

It is possible to debug the cross compiled client using Wine's gdb-server integration, and a CLion remote debugger session.

The setup and operation of this debugging process is non-trival. We're exploring our options for a smoother debugging experience before giving an official recommendation.