Skip to content

Compiling Cockatrice (Linux)

nbm edited this page May 22, 2020 · 116 revisions

  ← Back to Compiling Overview

Compiling On Linux

Arch | CentOS | Debian | Fedora | Gentoo | Raspberry Pi | Sabayon | Ubuntu


ToDo:


Note

All command lines indicated by $ are to be run as a normal user, while # requires root privilege, for example by prefacing it with sudo or executing through sudo sh -c 'command' or su -c 'command'.


Arch

NOTE: There is a binary release available in the community repo. It can be installed with pacman -S cockatrice

NOTE: VCS AUR packages are available for both the client (cockatrice-client-git) and the server (cockatrice-server-git), however the client package is currently missing qt5-websockets as a dependency. Additionally, you currently cannot install both at once because both packages try to own /usr/bin/dbconverter

Install the dependencies:

# pacman --sync --needed base-devel cmake git protobuf qt5-base qt5-multimedia qt5-svg qt5-tools qt5-websockets

Setup and compile:

$ git clone https://github.com/Cockatrice/Cockatrice
$ cd Cockatrice
$ mkdir build
$ cd build
$ cmake ..
$ make

Install:

# make install

CentOS

Install the dependencies:

CentOS 6:

# yum -y groupinstall "development tools"
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/${PROCARC}/epel-release-6-8.noarch.rpm
# yum -y install wget qt5* cmake28 libgcrypt-devel

CentOS 7:

# yum -y groupinstall "development tools"
# yum -y install epel-release
# yum -y install wget qt5* cmake3 libgcrypt-devel mariadb-devel --skip-broken

Download protobuf and compile:

$ git clone https://github.com/google/protobuf
$ cd protobuf
$ ./autogen.sh
$ ./configure
$ make -j 4

Install the protobuf components:

# make install

Configure your linked libraries to locate protobuf:

# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig

Download the Cockatrice source and compile:

On CentOS 6, replace cmake3 .. line below with cmake28 ..
If you would like to install the server along with the client replace the cmake3 .. line with cmake3 -DWITH_SERVER=1 ..

$ git clone https://github.com/Cockatrice/Cockatrice
$ cd Cockatrice
$ mkdir build
$ cd build
$ cmake3 ..
$ make -j 4

Install the client/server components:

# make install

The client will install to the /usr/local/bin/ folder.
Icons for the client should be created in your Gnome Menu as well.


Debian

Debian 9 (Stretch) Quick instructions for servers

# Installs necessary packages, clones the repo, makes the build directory, cmakes, compiles, installs on Debian 9
# Run the following as root:
apt-get update
apt-get upgrade
apt-get install  build-essential cmake git qt5-default qtbase5-dev qttools5-dev-tools libqt5websockets5 libqt5websockets5-dev libqt5svg5-dev protobuf-compiler libprotoc10 libprotobuf10 libprotobuf-dev
# If you want mysql support, also run the following as root:
apt-get install libmysqlclient-dev libqt5sql5-mysql
git clone https://github.com/Cockatrice/Cockatrice.git
mkdir /root/Cockatraice/build
cd /root/Cockatrice/build
cmake -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 -DWITH_DBCONVERTER=0 ..
make
make install

Debian Instructions

Install dependencies:

# apt install build-essential g++ cmake git
# apt install qt5-default qtbase5-dev-tools libprotobuf-dev protobuf-compiler

[optional] MySQL support:

# apt install libmysqlclient-dev libqt5sql5-mysql

On Debian Stretch and later you'll need 3 other packages:

# apt install qttools5-dev-tools {libqt5svg5,qtmultimedia5,libqt5websockets5}-dev

Download and build the sources:

$ git clone git://github.com/Cockatrice/Cockatrice
$ cd Cockatrice
$ mkdir build
$ cd build
$ cmake ..
$ make -j 4
# make install

NOTE: Cockatrice will require you to have a 3.10 or higher version of cmake. The Debian Jessie repository only has version 3.0.2 of cmake. The rest of the packages should work on their supported version of Debian stable, so you might want to install them first and install cmake separately after that (recommended).

You will need to enable the testing repository in order to install a cmake version that works with Cockatrice. Edit your /etc/apt/sources.list file and add the following lines.

deb http://ftp.us.debian.org/debian/ stretch main contrib 
deb-src http://ftp.us.debian.org/debian/ stretch main contrib 

Once you're done with that, update apt to download the package lists from testing repository.

# apt update

Now you can install a suitable version of the cmake package.

# apt install cmake

Fedora

Fedora includes Cockatrice packages in its official repositories (maintained by subpop).
They can be installed either through dnf or GNOME Software.

You can also compile with the instructions below:

Install the dependencies:

# dnf install @development-tools
# dnf install cmake protobuf-devel gcc-c++ wget desktop-file-utils
# dnf install {zlib,sqlite}-devel libappstream-glib hicolor-icon-theme
# dnf install qt5-{qttools,qtsvg,qtmultimedia,qtwebsockets}-devel

Download the Cockatrice source and compile:

$ git clone https://github.com/Cockatrice/Cockatrice
$ cd Cockatrice
$ mkdir build
$ cd build
$ cmake3 ..
$ make -j 4

Install the client/server components:

# make install

The client will install to the /usr/local/bin/ folder.
Icons for the client should be created in your Gnome Menu as well.

Note: Some of the debug logging functionality (qDebug() output) of the Debug builds (-DCMAKE_BUILD_TYPE=Debug) may not work immediately with Fedora. Qt logging is turned off system-wide, but cant be enabled by creating a qtlogging.ini file at ~/.config/QtProject/qtlogging.ini, and adding the following rules into it:

[Rules]
*.debug=true
qt.*.debug=false

https://brendanwhitfield.wordpress.com/2016/06/08/enabling-qdebug-on-fedora/

https://ask.fedoraproject.org/en/question/87522/qt-56-qdebug-and-qlog-no-longer-work/


Gentoo

Install dependencies:

# emerge -av protobuf qt{svg,multimedia}:5

If compiling servatrice, you'll also need qt{websockets,sql}:5.

Clone Cockatrice, create a build directory and run cmake inside that directory:

$ git clone git://github.com/Cockatrice/Cockatrice
$ cd Cockatrice
$ mkdir build
$ cd build
$ cmake [OPTIONS] ../

When cmake finishes, it's all downhill from there:

$ make -j 4
# make install

Void Linux

Install dependencies:

# xbps-install -Syu cmake qt5 qt5-devel qt5-tools qt5-tools-devel protobuf protobuf-devel
# xbps-install -yu qt5-multimedia qt5-multimedia-devel qt5-svg qt5-svg-devel
# xbps-install -yu qt5-websockets qt5-websockets-devel liblzma liblzma-devel

Compile:

$ git clone https://github.com/Cockatrice/Cockatrice ~/Cockatrice
$ mkdir -vp ~/Cockatrice/build
$ cmake -S ~/Cockatrice -B ~/Cockatrice/build
$ make -C ~/Cockatrice/build

Install Cockatrice:

# make -C ~/Cockatrice/build install

Raspberry Pi

In order to install Cockatrice (or Servatrice) on the Raspberry Pi you will need to be running Raspbian Stretch. Due to the amount of memory that is required in order to compile the application you will also need to make sure you have at least 2GB of swap space configured. If you are unfamiliar with how to increase your swap file size on the Raspberry Pi one decent article available is located at http://raspberrypimaker.com/adding-swap-to-the-raspberrypi.

Before installing:

The cards database has grown lately and Oracle needs now more memory. So to be sure to correctly update your database, you have to had swap on your Raspberry. So, to have dynamic swap, let's do that:

1- Edit the /etc/dphys-swapfile

$ sudo vi /etc/dphys-swapfile

2- Uncomment the CONF_SWAPFILE=/var/swap line.
3- Uncomment the CONF_SWAPFACTOR=2 line.
4- Check that the CONF_SWAPSIZE=100 line stays commented.
5- Restart the swap process.

$ sudo /etc/init.d/dphys-swapfile restart

Install dependencies:

# apt install build-essential g++ cmake git
# apt install libprotobuf-dev protobuf-compiler
# apt install qt5-default qtbase5-dev-tools libqt5websockets5 libqt5websockets5-dev
# apt install libmariadb-dev-compat qttools5-dev-tools libqt5svg5-dev qtmultimedia5-dev libqt5sql5-mysql

Download and build the sources:

$ git clone git://github.com/Cockatrice/Cockatrice
$ cd Cockatrice
$ mkdir build
$ cd build
$ cmake ..
$ make
# make install

Once completed, it is recommended to restart your Raspberry Pi. This will allow for the X Windows manager to shutdown properly and upon restart add the Cockatrice application shortcut to the Games menu.

NOTE: If you would like to install both cockatrice (client) and servatrice (server) run the command cmake -DWITH_SERVER=1 .. in place of cmake ..


Sabayon

Install dependencies:

Sabayon does not have gcc or cmake installed by default, so you'll need to install those as well.

# equo i -av dev-qt/qt{core,multimedia}:5 dev-libs/protobuf dev-util/cmake sys-devel/gcc

If compiling servatrice, you'll also need dev-qt/qt{websockets,sql}:5.

Clone Cockatrice, create build directory and run cmake inside that directory:

$ git clone git://github.com/Cockatrice/Cockatrice
$ cd Cockatrice
$ mkdir build
$ cd build
$ cmake ..

When cmake finishes, it's all downhill from there:

$ make -j 4
# make install

Ubuntu

Ubuntu 14.xx | Ubuntu 16.04 and later

Ubuntu 14.xx

These instructions have been tested on Ubuntu 14.04 LTS (Trusty Tahr).

You first need to install some prerequisite packages:

This repository contains a recent version of cmake:

# add-apt-repository -y ppa:smspillaz/cmake-master

Remove old cmake version:

# apt -y purge cmake

Update packages list:

# apt update

Install the needed prerequisites:

# apt install git build-essential g++ cmake
# apt install libprotobuf-dev protobuf-compiler
# apt install qt5-default qttools5-dev qttools5-dev-tools
# apt install qtmultimedia5-dev libqt5multimedia5-plugins libqt5svg5-dev libqt5sql5-mysql

Then, grab the cockatrice source code and create a directory to host the build:

$ git clone git://github.com/Cockatrice/Cockatrice
$ cd Cockatrice
$ mkdir build
$ cd build

Now, configure the build and create a deb package:

$ cmake .. -DWITH_SERVER=1

Alternatively, if you want to create a debug build to troubleshoot issues:

$ cmake .. -DWITH_SERVER=1 -DCMAKE_BUILD_TYPE=Debug -DWARNING_AS_ERROR=0

Compile Cockatrice and build a debian package:

$ make package

At last, install the package:

# dpkg -i Cockatrice*.deb

Alternatively, you can install Cockatrice directly:

# make install

Ubuntu 16.04 and later

These instructions have been tested on:

  • Ubuntu 16.04 LTS (Xenial Xerus)
  • Ubuntu 17.10 (Artful Aardvark)
  • Ubuntu 18.04 LTS (Bionic Beaver)
  • Ubuntu 19.04 (Disco Dingo)
  • Ubuntu 19.10 (Eoan)

These versions of Ubuntu are recent enough to provide up-to-date dependencies, so you won't need to add any external repository. Just ensure you installed all the prerequisite packages:

You first need to install some prerequisite packages.

Update packages list:

# apt update

Install the needed prerequisites:

# apt install git build-essential g++ cmake
# apt install libprotobuf-dev protobuf-compiler
# apt install qt5-default qttools5-dev qttools5-dev-tools
# apt install qtmultimedia5-dev libqt5multimedia5-plugins libqt5svg5-dev
# apt install libqt5sql5-mysql libqt5websockets5-dev

Then, grab the cockatrice source code and create a directory to host the build:

Get a copy of Cockatrice's source code:

$ git clone git://github.com/Cockatrice/Cockatrice

Create a directory to host the build process:

$ cd Cockatrice
$ mkdir build
$ cd build

Now, configure the build and create a deb package:

$ cmake .. -DWITH_SERVER=1

Alternatively, if you want to create a debug build to troubleshoot issues:

$ cmake .. -DWITH_SERVER=1 -DCMAKE_BUILD_TYPE=Debug

Compile Cockatrice and build a debian package:

$ make package

If you get the following error: /usr/lib/qt5/bin/lrelease: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory, you'll want to refer to these instructions. The tl;dr version is to run the following command, replacing the file path with whatever path contains your libQt5Core.so.5 file:

sudo strip --remove-section=.note.ABI-tag /usr/lib64/libQt5Core.so.5

At last, install the package:

# dpkg -i Cockatrice*.deb

Alternatively, you can install Cockatrice directly:

# make install

One final note: If you're building for Linux using WSL (Windows Subsystem for Linux) you'll need to install an X Server to be able to actually run the program. One option is Xming.

Clone this wiki locally