Skip to content

[EN] How to build and setup on Linux

D G Turner edited this page Jan 17, 2021 · 17 revisions

How to build and setup OpenXRay on Linux

Stage 1 - Installing dependencies and getting sources.

Currently only GCC8, GCC9, GCC10 compilers are supported.

It also requires your system supports OpenGL 4.1.

Make sure you are using S.T.A.L.K.E.R.: Call Of Pripyat 1.6.02.

The following packages need to be installed: git, cmake, GLEW, FreeImage, FreeImagePlus, Lockfile, OpenAL, TBB, Crypto++, Theora, Ogg, SDL2, LZO, Jpeg.

To install all the necessary packages for building the engine, run:

For Debian / Ubuntu, and their derivatives

sudo apt install git cmake make libglew-dev libfreeimage-dev liblockfile-dev libopenal-dev libtbb-dev libcrypto ++ - dev libogg-dev libtheora-dev libvorbis-dev libsdl2-dev liblzo2-dev libjpeg-dev libncurses5-dev libreadline-dev gcc libfreeimageplus-dev libfreeimageplus3 dpkg-dev

For Fedora / CentOS

sudo dnf install git cmake make gcc gcc-c ++ glew-devel pcre-devel pcre2 freeimage-devel freeimage-plus-devel liblockfile-devel openal-devel tbb-devel cryptopp-devel libogg-devel libtheora-devel libvorbis-devel SDL2-devel lzo -devel libjpeg-turbo-devel readline-devel

For ArchLinux / Manjaro

sudo pacman -S gcc git cmake make libglvnd libjpeg6-turbo ncurses pcre2 pcre glew sdl2 openal intel-tbb crypto ++ liblockfile freeimage libogg libtheora libvorbis lzo lzop libjpeg-turbo

For Gentoo

sudo emerge --ask gcc git cmake make libglvnd libjpeg-turbo ncurses libpcre2 libpcre glew libsdl2 media-libs/openal tbb crypto++ liblockfile freeimage libogg libtheora libvorbis lzo lzop

To get the sources, run:

bash git clone https://github.com/OpenXRay/xray-16.git --recurse-submodules

Stage 2 - Project setup

After this, the xray-16 directory should appear in the working directory.

You need to create the build directory and change to it. This directory can have any reasonable name such as "build", but the following command assumes it is called "bin":

cd xray-16 && mkdir bin && cd bin

Next, configure the build directory by running the following cmake command. Please pay attention to its output. It will contain errors if some of the requirements were not properly installed.

cmake ..

You can customize the build by adding options to the configuration command. The following are suggested to set the correct installation directory for each Linux distribution.

For Debian / Ubuntu

cmake .. -DCMAKE_INSTALL_PREFIX = / usr -DCMAKE_INSTALL_BINDIR = / usr / games

For Fedora / CentOS

cmake .. -DCMAKE_INSTALL_LIBDIR = lib64 -DCMAKE_INSTALL_PREFIX = / usr

For ArchLinux / Manjaro

cmake .. -DCMAKE_INSTALL_PREFIX = / usr

! If you plan to build a package skip to ** Installation **

  • ** Portable (portable) installation **

! If you do not plan to install the engine on the system

cmake ..

** Additional parameters that can be specified during configuration **

! Check your distribution's documentation for more details.

** DCMAKE_BUILD_TYPE ** - Build type can be:

  • Release - Release (default value, recommended for players)
  • Debug - Debug
  • Mixed - Mixed
  • RelWithDebInfo - Release with debug symbols

** DCMAKE_INSTALL_PREFIX ** - Installation directory, / usr recommended.

** DCMAKE_INSTALL_LIBDIR ** - Library location directory. Determined automatically, usually INSTALL_PREFIX / lib. If necessary, you can set:

  • lib Most distributions (Default value)
  • lib64 Distributions in which 32x and 64x libraries are strictly separated (Fedora, CentOS ...)

** DCMAKE_INSTALL_BINDIR ** - Executable file location directory:

  • By default, most distributions are bin
  • Recommended games for Ubuntu
  • Recommended for Gentoo games / bin

** DMEMORY_ALLOCATOR ** - Select memory allocator, can be equal to:

  • mimalloc (Default)
  • tbb
  • standard

To enable debugging:

cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo

Or

cmake .. -DCMAKE_BUILD_TYPE=Debug

To use clang: Clang is not supported, but feel free to try it:

CC=clang CXX=clang++ cmake ..

To include all optimizations for your machine:

CFLAGS="-march=native" CXXFLAGS="-march=native" cmake ..

Compilation

To build the project, run this command:

make -jX

Replace X with the number of your processor's cores

To put the log and errors to different files:

make -jX >out.log 2>error.log

If everything ended without errors, then you can continue!

Stage 3 - Installation

! Preferably build a package for your distribution

  • If you are unable to build a package for your distribution, you can run sudo make install to install it at the root of the system. To uninstall in the build directory, you need to run sudo make uninstall.

** ArchLinux / Manjaro **

  • In the directory xray-16 / ArchLinux / there is a ready PKGBUILD for building the package, go toxray-16 / ArchLinux /and execute makepkg after building the package, you can install sudo pacman -U openxray-dev ... x86_64.pkg.tar.xz

** DEB Debian / Ubuntu package ... ** At the moment it is possible to build a deb package for Debian / Ubuntu using the checkinstall or make utility, if you are an Ubuntu user we recommend building a deb package.

! To correctly generate a list of dependencies for a deb package, the package dpkg-dev must be installed

  • ** build deb package using make ** in folder xray-16 / bin execute command make package

  • ** build a deb package using checkinstall ** in the xray-16 / bin folder execute the command sudo checkinstall -D and answer a few questions.

This will build a deb package that can be installed with sudo sudo dpkg -i * .deb

** RPM package Fedora / CentOS ... ** To build the rpm package in the xray-16 / bin folder, execute the command make package

As a result, an rpm package will be compiled, which can be installed using sudo rpm -i * .rpm

Custom Repositories

Community repositories created by users

** Ubuntu 18.04 **

[Launchpad.net] (https://launchpad.net/~eagleivg/+archive/ubuntu/openxray)

add repository and install

sudo add-apt-repository ppa: eagleivg / openxray
sudo apt-get update

** ArchLinux / Manjaro **

AUR has ready-made packages

** OpenSUSE **

[Build.opensuse.org] (https://build.opensuse.org/package/show/games/openxray)

Install in one click [OpenSUSE Install] (https://software.opensuse.org/package/openxray?search_term=openxray) or add repository and install

sudo zypper ar obs: // games games
sudo zypper ref
sudo zypper in openxray

** Gentoo **

Portage [Ebuild] (https://github.com/nightloli/NightLoliRepo/blob/master/games-fps/openxrayx16/openxrayx16-9999.ebuild)

Stage 4 - Install game datafile resources

  • To run the game, you need the original resources of the licensed copy of S.T.A.L.K.E.R. Call of Pripyat. and / or S.T.A.L.K.E.R. - Clear sky. Place the directories levels, localization, mp, patches, resources from the S.T.A.L.K.E.R. Call of Pripyat in ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Call of Pripyat / and / or in ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Clear Sky from distribution S.T.A.L.K.E.R. - Clear sky.

** !!! Attention ** directory ~ /.../ GSC Game World / S.T.A.L.K.E.R. -... must be created by yourself

mkdir -p ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Call of Pripyat

mkdir -p ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Clear Sky

If you have a digital copy of the game on Steam, then the resources can be copied from ~ / .local / share / Steam / steamapps / common / Stalker ... (Default installation directory for Steam games on Linux) or via steamcmd:

steamcmd "+@sSteamCmdForcePlatformType windows" +login <your_steam_username> \
    +force_install_dir ~/.local/share/GSC Game World/S.T.A.L.K.E.R. - Call of Pripyat/ +app_update 41700 +quit

If you have a physical copy of the game or a copy from GoG, then it can be unpacked using the console utility innoextract, most likely it is in the repository of your distribution and you can install it:

** ArchLinux / Manjaro ** sudo pacman -S innoextract

** Debian / Ubuntu ** sudo apt install innoextract

** Fedora ** sudo dnf install innoextract

If this is not possible, you can run wine setup.exe to start the installation. You may have issues if you're installing to a path that has spaces, so we recommend you to install it to c:\cop (it's usually ~/.wine/drive_c/cop in linux).

To unpack the distribution using innoextract, run:

  1. Copy the contents of the CD to your home directory e.g. ~ / CoP
  2. Open a terminal, go to the game distribution directory cd ~ / CoP and execute innoextract setup.exe -L

_ switch -L converts the name of all files and directories to lowercase_

_ the -d switch specifies the directory where the unpacked files will be placed e.g. -d CoP_unpack_

_ the --gog switch is required to unpack the gog installer_

  1. Wait until the unpacking is completed, upon completion in the ~ / CoP directory there will be an app or game directory from which you can copy levels, localization, mp, patches, resources

** Unpacked CD distribution ** ! [CD] (https://i112.fastpic.ru/big/2020/0606/59/736b56028ac9ddb84bee85b261a36a59.png)

** Unpacked GOG distribution ** ! [GOG] (https://i112.fastpic.ru/big/2020/0606/71/c77d8ca5f5050577a40c58135d28f871.png)

** Attention !!! ** the names of the directories levels, localization, mp, patches, resources and the files in them must be in lowercase, that is, in small letters relevant for a copy of the game from GOG. This can cause issue #684 otherwise.

If you are using Russian version, you need to install patch 1.6.02. You can download it from the official page.

  • If for some reason you do not want to take up additional space in your home directory but already have the game installed on Windows or Steam, then you can create symbolic links to directories with resources levels, localization, mp, patches, resources Below is an example of creating symbolic links STALKER Call of Pripyat installed on Steam:
mkdir -p ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Call of Pripyat
ln -s ~ / .local / share / Steam / steamapps / common / Stalker Call of Pripyat / levels ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Call of Pripyat / levels
ln -s ~ / .local / share / Steam / steamapps / common / Stalker Call of Pripyat / localization ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Call of Pripyat / localization
ln -s ~ / .local / share / Steam / steamapps / common / Stalker Call of Pripyat / mp ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Call of Pripyat / mp
ln -s ~ / .local / share / Steam / steamapps / common / Stalker Call of Pripyat / patches ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Call of Pripyat / patches
ln -s ~ / .local / share / Steam / steamapps / common / Stalker Call of Pripyat / resources ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Call of Pripyat / resources
  • Now the game can be launched by selecting the item S.T.A.L.K.E.R .: Call of Pripyat (OpenXRay) or S.T.A.L.K.E.R .: - Clear Sky (OpenXRay) from the application menu or by executing in the terminal xr_3da to launch S.T.A.L.K.E.R. Call of Pripyat or xr_3da -cs to run S.T.A.L.K.E.R. - Clear sky

** Attention !!! ** work to support S.T.A.L.K.E.R. - Clear Sky not completed. Bugs and errors are possible.

Portable installation

If you are unable to create a package for your system and (or) do not want to install the engine on your system, then you can use this method.

  • In your home directory, create a directory for the game for example S.T.A.L.K.E.R.
  • Do ** Step 1 ** and ** Step 2 ** of this tutorial (in Step 2, you can leave the project unconfigured by running cmake .. -DCMAKE_BUILD_TYPE = Release).
  • After compilation, copy the contents of the directory xray-16 / bin / x64 / Release / to ~ / S.T.A.L.K.E.R. / bin /
  • Copy the gamedata directory and the fsgame.ltx file from the xray-16 / res directory to~ / S.T.A.L.K.E.R. /
  • From xray-16 / src / xr_3da / copy the script xr_3da.sh to ~ / S.T.A.L.K.E.R.CoP / bin.
  • In ~ / S.T.A.L.K.E.R.CoP / put game resources levels, localization, mp, patches, resources. It should look something like this: ! [S.T.A.L.K.E.R.CoP] (https://i89.fastpic.ru/big/2019/0831/87/2ff0a5afec0df4bf8f02f30df8e7ce87.png) ! [bin] (https://i89.fastpic.ru/big/2019/0831/37/049f06ae69129020ac90e8d4835b5937.png) To start, open a terminal, go to the directory ~ / S.T.A.L.K.E.R. / bin and run the command
./xr_3da.sh -fsltx / home / Username / S.T.A.L.K.E.R. / fsgame.ltx

You can do the same with the resources of S.T.A.L.K.E.R .: Clear Sky, but to start it, add the -cs switch

./xr_3da.sh -cs -fsltx / home / Username / S.T.A.L.K.E.R. / fsgame.ltx

** !!! At the moment, the path to fsgame.ltx must be absolute starting from the system root **

If you want to debug with gdb:

DEBUGGER="gdb --ex=r --args" xr_3da

Possible problems

  • Installed engine does not start.

Open a terminal and enter the command xr_3da if you receive a message like: bash: xr_3da: command not found the location of the executable file may not be configured correctly at the project configuration stage, as a rule, the default value of the variable DCMAKE_INSTALL_BINDIR should be / usr / bin in some distributions, it may differ. If you see a message like:

./xr_3da: error while loading shared libraries: xrEngine.so: cannot open shared object file: No such file or directory

It is possible that at the stage of project setup, one of the variables (or both at once) were incorrectly defined

DCMAKE_INSTALL_PREFIX must be / usr, and DCMAKE_INSTALL_LIBDIR must be lib or lib64.

If if initialization occurs after which the engine terminates abnormally with the message

FATAL ERROR

[error] Expression: setupSelectedRenderer
[error] Function: InitializeRenderers
[error] File: /home/chip/OpenXray/xray-16/src/xrEngine/EngineAPI.cpp
[error] Line: 128
[error] Description: Can't setup renderer

In the case of a portable installation, most likely you did not copy the shaders from the xray-16 / res / directory, copy the xray-16 / res / gamedata directory to the game resources directory

Known bugs and errors.

  1. When exiting the game, the process may freeze (as of May 2020, this problem is observed when building using gcc9)
  2. Saves and logs do not support UTF-8
  3. Bugs with SSAO enabled on AMD video cards, so it is recommended to disable it completely.
  4. Previews are not created for saving
  5. At the first start, the screen resolution settings in your DE may get lost

** I have low FPS **

The limitations of some advanced graphics settings have been significantly increased compared to the original game. Be careful with the following graphics settings:

  • Detailing of objects. This option has a significant impact on performance.
  • Range of drawing grass. This option simply was not in the original engine and its meaning was "hardcoded" right into the engine.
  • The density of the grass. The limit for this option has been increased two to three times.
  • The quality of shadow maps. This option was also not present in the original engine, the values ​​were "hardcoded" and the only change method was the launch keys, but even through the launch key the maximum value was 4096, while our maximum was 16384.

** Can't build GCC version error **

  • Some users are faced with the problem of incompatibility of the GCC version, since in a number of distributions GCC version 7 is provided by default, it is recommended to use GCC version 8 and higher for assembly.To solve this problem, you can install GCC 8 using the standard tools of your distribution kit and at the configuration stage run `` `cmake -DCMAKE_C_COMPILER = gcc-8 -DCMAKE_CXX_COMPILER = g ++ - 8 -DCMAKE_BUILD_TYPE = Debug -w ..```
  • It is not recommended to fix it in the CMakeLists.txt file, but if your distribution does not have GCC 8 in the repository, then change the line CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0 to your GCC for example CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.4.0. However, problems are possible.

** Sound is poorly positioned **

You need to force HRTF to be enabled in OpenAL: echo" hrtf = true ">> ~ / .alsoftrc

If it doesn't work, check that the files default-44100.mhr and default-48000.mhr are present on the system (In Ubuntu, this is the libopenal-data package)

If it still doesn't work, start the game with the variables ALSOFT_LOGLEVEL = 3 ALSOFT_LOGFILE = / tmp / openallog.txt. / Xr_3da and analyze the log for HRTF.

** Saves S.T.A.L.K.E.R .: Clear Sky from the original game does not load **

There is no backward compatibility with the S.T.A.L.K.E.R. : Clear Sky save format.

** S.T.A.L.K.E.R. does not start: Shadow of Chernobyl **

I installed the engine and copied S.T.A.L.K.E.R .: Shadow of Chernobyl game assets to ~ / .local / share / GSC Game World / S.T.A.L.K.E.R. - Shadow of Chernobyl / but it won't start for me.

At the moment, work to support S.T.A.L.K.E.R .: Shadow of Chernobyl has just begun.

** The game starts in English. How can I switch the language to Russian? **

This problem is observed for a copy of the game from GOG to solve it go to ... / S.T.A.L.K.E.R ... / localization it should contain only the files base_sounds.db, xefis_movies.db, xrussian.db everything else needs to be deleted

! [] (https://i112.fastpic.ru/big/2020/0606/47/5c2659a6d4675cd33aaebd6f43a7f747.png)

** The game crashes with the mod installed **

Unfortunately, compatibility with some modifications is incomplete, this is due to the following:

  1. When developing mods, many developers make their own changes to the engine that are not in OpenXRay, such a mod is completely incompatible. Even if the mod developer used OpenXRay, it is possible that he made his changes to his branch.
  2. Mod developers often use different case (Upper and lower case letters) in the paths and names of game resources files. The Linux file system is arranged differently: if in Windows the files named A.dds and a.dds are considered the same file, then in Linux they are different files and in this case you can get a crash associated with the absence of a file.

In order for the modification to start, several conditions must be met:

  1. The modification should not affect the engine itself
  2. Paths and filenames in scripts must be correctly spelled out
Clone this wiki locally