Downloading and Compiling under Linux: Difference between revisions

From Arx Libertatis Wiki
Jump to navigation Jump to search
No edit summary
 
(82 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This page documents how to compile Arx Libertatis from https://github.com/arx/ArxLibertatis under linux.
{{DownloadAndCompileNotice|OS=Linux}}


Specific instructions are given for a cleanly installed Ubuntu 10.10 AMD64 system but the procedure should be similar for other distributions. Please update this page if something is missing.
{{LinuxInstallNotices}}


There is also a nice but possible outdated [http://linuxgamecast.com/2011/10/l-g-c-how-to-%E2%80%94-arx-fatalis/ video how-to] on [http://linuxgamecast.com/ linuxgamecast.com].
This page documents how to compile Arx Libertatis from https://github.com/arx/ArxLibertatis under {{Linux}} or {{FreeBSD}}.<br>
There are also instructions available for [[Downloading and Compiling under Windows|{{Windows}}]] and [[Downloading and Compiling under macOS|{{MacOSX}}]]


== Known upstream bugs ==
Specific instructions are given for a cleanly installed Ubuntu 12.04 amd64 system, but the procedure should be similar for other Linux distributions or FreeBSD. Please update this page if something is missing.


There is a [[Media:Mesa-7.11-r600g.jpg|known rendering bug]] with the r600g gallum3d driver in mesa 7.11. The classic non-gallium driver is not affected. The bug is not present in mesa 7.10.3 and is fixed in mesa's git master.
There is also a nice, but possibly outdated [https://linuxgamecast.com/2011/10/l-g-c-how-to-%E2%80%94-arx-fatalis/ video how-to] on [https://linuxgamecast.com/ linuxgamecast.com].


== Manual installation ==
== Setting Up the Build Environment ==
 
=== Setting Up the Build Enviroment ===


To download and compile Arx Libertatis you will need the following tools:
To download and compile Arx Libertatis you will need the following tools:
* <code>git</code>
* [https://git-scm.com/ <code>git</code>]
* <code>cmake</code> (version 2.8 or later)
* [https://cmake.org/ <code>CMake</code>] 2.8.3 or newer
* a <code>gcc</code> or <code>clang</code> toolchain
* A <code>C++17</code> compatible compiler like <code>GCC</code> or <code>Clang</code>


Your system must have the following dependencies installed, including headers / development versions:
Your system must have the following dependencies installed, including headers / development versions:
* <code>SDL</code> 1.2 (http://www.libsdl.org/)
* [https://libsdl.org/ <code>SDL</code>] 2 (recommended), or [https://libsdl.org/ <code>SDL</code>] 1.2.10 or newer
* <code>OpenGL</code> 1.5 or newer (http://www.opengl.org/)
* [https://www.opengl.org/ <code>OpenGL</code>] 1.5 or newer
* <code>GLEW</code> (http://glew.sourceforge.net/)
* [https://github.com/anholt/libepoxy <code>libepoxy</code>] 1.2 or newer (recommended), or [http://glew.sourceforge.net/ <code>GLEW</code>] 1.5.2 or newer
* <code>OpenAL</code> (http://kcat.strangesoft.net/openal.html)
* <code>OpenAL</code> ([https://openal-soft.org/ OpenAL Soft] is strongly recommended)
* <code>DevIL</code> (http://openil.sourceforge.net/)
* [https://zlib.net/ <code>zlib</code>]
* <code>zlib</code> (http://zlib.net/)
* [https://www.boost.org/ <code>Boost</code>] 1.50 or newer (headers only)
* <code>Boost</code> headers and program_options library (http://www.boost.org/)
* [https://glm.g-truc.net/ <code>GLM</code>] 0.9.9.4 or newer
* <code>Freetype</code> (http://www.freetype.org/)
* [https://www.freetype.org/ <code>FreeType</code>] 2.3.0 or newer
 
If both SDL 1.2 and SDL 2 are installed, arx will use SDL 2 - if you don't want this, pass <code>-DWITH_SDL=1</code> to <code>cmake</code>.
 
The optional crash reporter application also needs:
* [https://www.qt.io/ <code>Qt</code>] 4.7+ or 5: QtCore, QtConcurrent (Qt 5 only), QtGui and QtWidgets (Qt 5 only) libraries
* [https://curl.haxx.se/libcurl/ <code>libcurl</code>] 7.20.0+
* <code>GDB</code> (https://www.gnu.org/software/gdb/)


Your distribution's default repository might not have the DevIL package, so you may need to use a custom repository or build DevIL manually. See the project's [http://openil.sourceforge.net/ web site] for details about obtaining it.
If both Qt 4 and Qt 5 are installed, arx will use Qt5 - if you don't want this, pass <code>-DWITH_QT=4</code> to <code>cmake</code>.


==== Example for <code>apt</code>-Based Systems ====
The dependencies listed here are for the current development version of Arx Libertatis. For older versions refer to the README.md file in the respective source distribution.
 
=== Example for <code>apt</code>-based systems ===
On an <code>apt</code>-based system such as Debian or Ubuntu, use:
On an <code>apt</code>-based system such as Debian or Ubuntu, use:


<code>sudo apt-get install git cmake g++ zlib1g-dev libfreetype6-dev libdevil1c2 libdevil-dev libopenal1 libopenal-dev mesa-common-dev libgl1-mesa-dev libboost-all-dev libsdl-dev libglew-dev</code>
<code>sudo apt-get install git build-essential cmake zlib1g-dev libfreetype6-dev libopenal1 libopenal-dev mesa-common-dev libgl1-mesa-dev libboost-dev libsdl2-dev libepoxy-dev libglm-dev qtbase5-dev libcurl4-nss-dev libcppunit-dev gdb</code>


Your package manager will probably prompt you to install other packages, so just say yes to those.
On Ubuntu 12.04 be sure to install Boost 1.48:
<code>sudo apt-get install libboost1.48-dev</code>


=== Cloning the code repository ===
You may need to install <code>libglew-dev</code> instead of <code>libepoxy-dev</code> if the latter is not available for your Debian/Ubuntu version.


First, go to where you want the ArxLibertatis directory to be located.
Your package manager will probably prompt you to install other packages, so just say yes to those. qt-sdk is not needed for the game to run, but without it the crash reporter will be disabled, making it harder to report errors in case of a crash. gdb is used to generate detailed crash information and is not needed at compile-time.


cd ~/Code
=== Dependency versions in stable Linux distros ===


You are now ready to clone the repository, type:
{| class="wikitable center_1 center_2 center_3 center_4 center_5 center_6 center_7 center_8 center_9"
! Distro !! Compiler !! CMake !! Boost !! SDL !! GLM !! libepoxy !! GLEW !! FreeType || Qt || CURL
|-
! (required)
! GCC 4.3.0
! 2.8.3
! 1.50
! 1.2.10
! 0.9.9.4
! 1.2
! 1.5.2
! 2.3.0
! 4.7.0
! 7.20.0
|-
| Debian 10 (buster)
| {{Green|GCC 8.3.0}}
| {{Green|3.7.2}}
| {{Green|1.67}}
| {{Green|2.0.9}}
| {{Red|0.9.9.3}}
| {{Green|1.5.3}}
| {{Green|2.1.0}}
| {{Green|2.9.1}}
| {{Green|5.11.3}}
| {{Green|7.64.0}}
|-
| Ubuntu 17.10 (artful)
| {{Green|GCC 7.2.0}}
| {{Green|3.9.1}}
| {{Green|1.62}}
| {{Green|2.0.6}}
| {{Red|0.9.8.4}}
| {{Green|1.3.1}}
| {{Green|2.0.0}}
| {{Green|2.8}}
| {{Green|5.9.1}}
| {{Green|7.55.1}}
|-
| Fedora 24
| {{Green|GCC 6.2.1}}
| {{Green|3.5.2}}
| {{Green|1.60}}
| {{Green|2.0.4}}
| {{Red|0.9.7.3}}
| {{Green|1.4.1}}
| {{Green|1.13.0}}
| {{Green|2.6.3}}
| {{Green|5.6.1}}
| {{Green|7.47.1}}
|-
| Fedora 25
| {{Green|GCC 6.2.1}}
| {{Green|3.8.0}}
| {{Green|1.60}}
| {{Green|2.0.5}}
| {{Red|0.9.7.3}}
| {{Green|1.4.1}}
| {{Green|1.13.0}}
| {{Green|2.6.5}}
| {{Green|5.7.1}}
| {{Green|7.51.0}}
|-
| Fedora 26
| {{Green|GCC 7.2.1}}
| {{Green|3.10.0}}
| {{Green|1.63}}
| {{Green|2.0.7}}
| {{Red|0.9.8.4}}
| {{Green|1.4.3}}
| {{Green|2.0.0}}
| {{Green|2.7.1}}
| {{Green|5.8.0}}
| {{Green|7.53.1}}
|-
| Fedora 27
| {{Green|GCC 7.2.1}}
| {{Green|3.10.1}}
| {{Green|1.64}}
| {{Green|2.0.7}}
| {{Red|0.9.8.4}}
| {{Green|1.4.3}}
| {{Green|2.0.0}}
| {{Green|2.8}}
| {{Green|5.9.1}}
| {{Green|7.55.1}}
|-
| openSUSE 13.1
| {{Green|GCC 4.8}}
| {{Green|2.8.11}}
| {{Green|1.53}}
| {{Green|2.0.0}}
| {{Red|0.9.4.4}}
| {{Red|(missing)}}
| {{Green|1.9.0}}
| {{Green|2.5.0.1}}
| {{Green|5.1.1}}
| {{Green|7.42.1}}
|-
| openSUSE 13.2
| {{Green|GCC 4.8}}
| {{Green|3.0.2}}
| {{Green|1.54}}
| {{Green|2.0.3}}
| {{Red|0.9.5.3}}
| {{Green|1.2}}
| {{Green|1.10.0}}
| {{Green|2.5.3}}
| {{Green|5.4.2}}
| {{Green|7.42.1}}
|-
| openSUSE Leap 42.1
| {{Green|GCC 4.8}}
| {{Green|3.3.2}}
| {{Green|1.54}}
| {{Green|2.0.3}}
| {{Red|0.9.5.3}}
| {{Green|1.3.1}}
| {{Green|1.13.0}}
| {{Green|2.5.5}}
| {{Green|5.5.1}}
| {{Green|7.37.0}}
|-
| openSUSE Leap 42.2
| {{Green|GCC 4.8}}
| {{Green|3.5.2}}
| {{Green|1.54}}
| {{Green|2.0.3}}
| {{Red|0.9.5.3}}
| {{Green|1.3.1}}
| {{Green|1.13.0}}
| {{Green|2.6.3}}
| {{Green|5.6.1}}
| {{Green|7.37.0}}
|-
| openSUSE Leap 42.3
| {{Green|GCC 4.8}}
| {{Green|3.5.2}}
| {{Green|1.61}}
| {{Green|2.0.3}}
| {{Red|0.9.5.3}}
| {{Green|1.3.1}}
| {{Green|1.13.0}}
| {{Green|2.6.3}}
| {{Green|5.6.2}}
| {{Green|7.37.0}}
|}


git clone git://github.com/arx/ArxLibertatis.git
* {{Green|Green}}: Fully supported
* {{Yellow|Yellow}}: Supported, but not recommended (support may be removed soon)
* {{Red|Red}}: Unsupported


This creates a directory called ArxLibertatis and downloads the current source code from github.
== Getting the source code ==


cd ArxLibertatis
{{GetTheSourceCode}}


=== Compiling ===
== Compiling ==


Now you should be ready to configure and compile.  Run cmake:
=== Preparing the build directory ===


cmake .
First go to where you downloaded / extracted the AL source code (the directory containing the `CMakeLists.txt` file):


And now you should be able to compile with
cd ArxLibertatis
 
Then create a build directory that will contain compiled files.


  make -j`getconf _NPROCESSORS_ONLN`
  mkdir build
cd build


Alternatively, you can tell cmake to generate a unity build file, which might result in faster build times and better optimization depending on your machine configuration but will need more RAM to compile. Run cmake like this:
=== Using the data repository (git checkouts only) ===


cmake . -DARX_USE_UNITYBUILD=1
Next, tell the build system where to find the ArxLibertatisData repo (you can skip this if you want to generate the data files yourself or if you are building from a release source archive):


And make without the -j flag, since in effect there is only one file to build, named ub_arx.cpp
ln -s ../../ArxLibertatisData arx-libertatis-data


== Automatic installation ==
Replace <code>../../ArxLibertatisData</code> with the path to the ArxLibertatisData checkout. Alternatively you can pass the <code>-DDATA_FILES=../../ArxLibertatisData</code> option to the cmake command(s) below.


=== [[File:Arch_icon.png|16px|]] Arch Linux ===
=== Configuring ===


You need an [https://wiki.archlinux.org/index.php/AUR_Helpers AUR Helper] to install the [https://aur.archlinux.org/packages.php?ID=53821 arx-git] Package. For example packer.
Now you should be ready to configure and compile. Run cmake:


  packer -S arx-git
  cmake ..


=== [[File:Gentoo_icon.png|16px|]] Gentoo Linux ===
<font color=#666>If you plan on adding code, it might be a good idea to use the developer mode instead:</font>


You will need [http://layman.sourceforge.net layman] with <b>git</b> support, so install that first if you don't have it already:
<font color=#666>cmake .. -DDEVELOPER=1</font>
echo "app-portage/layman git" >> /etc/portage/package.use
emerge -N app-portage/layman


Next, you need to add the <b>arx-libertatis</b> overlay that contains the arx ebuild.
<font color=#666>This disables the unity build to allow for faster incremental builds and also enables runtime checks and debug output in the compiled binary.</font>
layman -f
layman -a arx-libertatis


For now, there is only a live ebuild: this will compile and install the [https://github.com/arx/ArxLibertatis current ArxLibertatis git master]. Like most gentoo live ebuilds, <b>games-rpg/arx-libertatis</b> needs to be unmasked before you can istall it:
=== Building ===
echo "games-rpg/arx-libertatis **" >> /etc/portage/package.keywords
emerge games-rpg/arx-libertatis


This will install /usr/games/bin/arx. Remember that you need to be in the <code>games</code> group to run games under gentoo.
And now you should be able to compile with


==== Updating ====
make -j`getconf _NPROCESSORS_ONLN`


Overlays added using layman won't be updated by <code>emerge --fetch</code>, you need to run
If you run out of RAM during the build, run make without the -j flag. If that is still not enough, disable the unity build by running cmake like this:
layman -S


Also, as <code>games-rpg/arx-libertatis-9999</code> is a live ebuild, it won't be updated automatically (the version never changes), you need to manually re-emerge it.
cmake .. -DUNITY_BUILD=0


== Running the executable ==
== Running the executable ==
Line 103: Line 256:
  ./arx
  ./arx


If you instaled arx through the package manager of your distro, just run <code>arx</code> in the directory containing the data files.
If you installed arx through the package manager of your distro, just run <code>arx</code>.


You will need to [[Getting the game data|obtain a copy of the data]] files from a commerical copy of Arx, or use the demo data files, put these in your bin directory and you are ready to go!
You will need to [[Getting the game data|obtain a copy of the data]] files from a commercial copy of Arx, or use the demo data files. Arx Libertatis comes with a [[Installing the game data under Linux|script to extract these and install the files in the correct location]].


The game will automatically change all used files to lowercase on the first start. If you want to run the game with read-only data you need to do this manually.
The game will automatically change all used files to lower-case on the first start. If you want to run the game with read-only data you need to do this manually.


For running arx in a debugger, see [[Debugging]]
For running arx in a debugger, see [[Debugging]]

Latest revision as of 05:27, 12 January 2022

ℹ️  This page describes compiling Arx Libertatis from source under Linux and assumes some familiarity with the command-line. If you just want to play the game, it might be easier to grab a binary release or snapshot if available.

ℹ️  Please see Installing the game data under Linux regarding where and how to install the game data.
Alternatively, configure Steam to use Arx Libertatis to play Arx Fatalis.

This page documents how to compile Arx Libertatis from https://github.com/arx/ArxLibertatis under Linux or FreeBSD.
There are also instructions available for Windows and macOS

Specific instructions are given for a cleanly installed Ubuntu 12.04 amd64 system, but the procedure should be similar for other Linux distributions or FreeBSD. Please update this page if something is missing.

There is also a nice, but possibly outdated video how-to on linuxgamecast.com.

Setting Up the Build Environment

To download and compile Arx Libertatis you will need the following tools:

  • git
  • CMake 2.8.3 or newer
  • A C++17 compatible compiler like GCC or Clang

Your system must have the following dependencies installed, including headers / development versions:

If both SDL 1.2 and SDL 2 are installed, arx will use SDL 2 - if you don't want this, pass -DWITH_SDL=1 to cmake.

The optional crash reporter application also needs:

If both Qt 4 and Qt 5 are installed, arx will use Qt5 - if you don't want this, pass -DWITH_QT=4 to cmake.

The dependencies listed here are for the current development version of Arx Libertatis. For older versions refer to the README.md file in the respective source distribution.

Example for apt-based systems

On an apt-based system such as Debian or Ubuntu, use:

sudo apt-get install git build-essential cmake zlib1g-dev libfreetype6-dev libopenal1 libopenal-dev mesa-common-dev libgl1-mesa-dev libboost-dev libsdl2-dev libepoxy-dev libglm-dev qtbase5-dev libcurl4-nss-dev libcppunit-dev gdb

On Ubuntu 12.04 be sure to install Boost 1.48: sudo apt-get install libboost1.48-dev

You may need to install libglew-dev instead of libepoxy-dev if the latter is not available for your Debian/Ubuntu version.

Your package manager will probably prompt you to install other packages, so just say yes to those. qt-sdk is not needed for the game to run, but without it the crash reporter will be disabled, making it harder to report errors in case of a crash. gdb is used to generate detailed crash information and is not needed at compile-time.

Dependency versions in stable Linux distros

Distro Compiler CMake Boost SDL GLM libepoxy GLEW FreeType Qt CURL
(required) GCC 4.3.0 2.8.3 1.50 1.2.10 0.9.9.4 1.2 1.5.2 2.3.0 4.7.0 7.20.0
Debian 10 (buster) GCC 8.3.0 3.7.2 1.67 2.0.9 0.9.9.3 1.5.3 2.1.0 2.9.1 5.11.3 7.64.0
Ubuntu 17.10 (artful) GCC 7.2.0 3.9.1 1.62 2.0.6 0.9.8.4 1.3.1 2.0.0 2.8 5.9.1 7.55.1
Fedora 24 GCC 6.2.1 3.5.2 1.60 2.0.4 0.9.7.3 1.4.1 1.13.0 2.6.3 5.6.1 7.47.1
Fedora 25 GCC 6.2.1 3.8.0 1.60 2.0.5 0.9.7.3 1.4.1 1.13.0 2.6.5 5.7.1 7.51.0
Fedora 26 GCC 7.2.1 3.10.0 1.63 2.0.7 0.9.8.4 1.4.3 2.0.0 2.7.1 5.8.0 7.53.1
Fedora 27 GCC 7.2.1 3.10.1 1.64 2.0.7 0.9.8.4 1.4.3 2.0.0 2.8 5.9.1 7.55.1
openSUSE 13.1 GCC 4.8 2.8.11 1.53 2.0.0 0.9.4.4 (missing) 1.9.0 2.5.0.1 5.1.1 7.42.1
openSUSE 13.2 GCC 4.8 3.0.2 1.54 2.0.3 0.9.5.3 1.2 1.10.0 2.5.3 5.4.2 7.42.1
openSUSE Leap 42.1 GCC 4.8 3.3.2 1.54 2.0.3 0.9.5.3 1.3.1 1.13.0 2.5.5 5.5.1 7.37.0
openSUSE Leap 42.2 GCC 4.8 3.5.2 1.54 2.0.3 0.9.5.3 1.3.1 1.13.0 2.6.3 5.6.1 7.37.0
openSUSE Leap 42.3 GCC 4.8 3.5.2 1.61 2.0.3 0.9.5.3 1.3.1 1.13.0 2.6.3 5.6.2 7.37.0
  • Green: Fully supported
  • Yellow: Supported, but not recommended (support may be removed soon)
  • Red: Unsupported

Getting the source code

There are several methods to get the Arx Libertatis source code - choose the one that suits you best:

Downloading a released version

The easiest way to get the AL source code is to download a versioned release. This will get you a reasonably up to date copy of the source code that has been tested to work.

Cloning the repository

If you want the absolute latest version of the Arx Libertatis development code and stay up to date, you can clone the AL source code repository. Beware that this will give you the current master development branch that we are actively working on. While the code in that branch should always work, it hasn't undergone any significant testing. If you just want to play the game, consider using a released version instead.

To clone the repository, type:

git clone git://github.com/arx/ArxLibertatis.git

This creates a directory called ArxLibertatis and downloads the current source code from github.

Later if you want to update your local copy of the source code, run

git pull

The git repository does not contain raster images for the icon and logo. These will be generated from scalable versions when building Arx Libertatis, but doing so requires additional dependencies (Inkscape, ImageMagick and OptiPNG). To avoid this, you can instead get the generated images from the ArxLibertatisData repo:

git clone --depth 1 git://github.com/arx/ArxLibertatisData.git

Downloading a snapshot

Alternatively you can download the current snapshot of the source code repository as a .zip or .tar.gz file and extract that:

This will give you the same code as cloning the repository, but won't let you update it without downloading everything again.

Compiling

Preparing the build directory

First go to where you downloaded / extracted the AL source code (the directory containing the `CMakeLists.txt` file):

cd ArxLibertatis

Then create a build directory that will contain compiled files.

mkdir build
cd build

Using the data repository (git checkouts only)

Next, tell the build system where to find the ArxLibertatisData repo (you can skip this if you want to generate the data files yourself or if you are building from a release source archive):

ln -s ../../ArxLibertatisData arx-libertatis-data

Replace ../../ArxLibertatisData with the path to the ArxLibertatisData checkout. Alternatively you can pass the -DDATA_FILES=../../ArxLibertatisData option to the cmake command(s) below.

Configuring

Now you should be ready to configure and compile. Run cmake:

cmake ..

If you plan on adding code, it might be a good idea to use the developer mode instead:

cmake .. -DDEVELOPER=1

This disables the unity build to allow for faster incremental builds and also enables runtime checks and debug output in the compiled binary.

Building

And now you should be able to compile with

make -j`getconf _NPROCESSORS_ONLN`

If you run out of RAM during the build, run make without the -j flag. If that is still not enough, disable the unity build by running cmake like this:

cmake .. -DUNITY_BUILD=0

Running the executable

For a manual installation, run arx by specifying a relative path to the arx executable:

./arx

If you installed arx through the package manager of your distro, just run arx.

You will need to obtain a copy of the data files from a commercial copy of Arx, or use the demo data files. Arx Libertatis comes with a script to extract these and install the files in the correct location.

The game will automatically change all used files to lower-case on the first start. If you want to run the game with read-only data you need to do this manually.

For running arx in a debugger, see Debugging