Skip to content

Latest commit

 

History

History
185 lines (128 loc) · 6 KB

dependencies.md

File metadata and controls

185 lines (128 loc) · 6 KB

Dependencies {#DevDeps}

This page documents how to install necessary dependencies to work with the wire-server code base.

In addition to the information below, you can also consult the Dockerfiles for Alpine Linux, that could serve as inspiration:

General package dependencies (needed to compile Haskell services)

Fedora:

sudo dnf install -y pkgconfig haskell-platform libstdc++-devel libstdc++-static gcc-c++ libtool automake openssl-devel libsodium-devel ncurses-compat-libs libicu-devel GeoIP-devel libxml2-devel snappy-devel protobuf-compiler

Ubuntu / Debian:

Note: Debian is not recommended due to this issue when running local integration tests: #327. This issue does not occur with Ubuntu.

sudo apt install pkg-config libsodium-dev openssl-dev libtool automake build-essential libicu-dev libsnappy-dev libgeoip-dev protobuf-compiler libxml2-dev zlib1g-dev -y

If openssl-dev does not work for you, try libssl-dev.

Arch:

# You might also need 'sudo pacman -S base-devel' if you haven't
# installed the base-devel group already.
sudo pacman -S geoip snappy icu openssl

macOS:

brew install pkg-config libsodium openssl automake icu4c geoip snappy protobuf

Note: macOS users will need to make sure to link Haskell services against a more recent version of OpenSSL than what ships with the OS by default. Additionally, icu4c is installed in a non-standard location by homebrew. Add the following to your .stack/config.yaml:

extra-include-dirs:
- /usr/local/opt/openssl/include
- /usr/local/opt/icu4c/include

extra-lib-dirs:
- /usr/local/opt/openssl/lib
- /usr/local/opt/icu4c/lib

Note: if you're getting fatal error: 'libxml/parser.h' file not found and you're on macOS Mojave, try doing:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Haskell Stack

Please refer to Stack's installation instructions.

When you're done, ensure stack --version is recent, ideally the same as STACK_ALPINE_VERSION in build/alpine/Dockerfile.prebuilder.

Ubuntu / Debian

Note: The packaged versions of haskell-stack are too old. It is recommended to follow the generic instructions or to use stack to update stack (stack upgrade).

sudo apt install haskell-stack -y

Generic

curl -sSL https://get.haskellstack.org/ | sh
# or
wget -qO- https://get.haskellstack.org/ | sh

Rust

Ubuntu / Debian

sudo apt install rustc cargo -y

Generic

curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

Formatting Haskell files

You need ormolu on your PATH, get it with stack install ormolu

Generating license headers

We use headroom, get it with stack install headroom

makedeb

This is a tool to create debian-style binary packages. It is optional, and is only used if you want to install debian-style packages on your debian or ubuntu system.

Note: If you want to build debian-style packages of cryptobox-c and other wire utilities, execute this step. otherwise, make sure to execute the 'Generic' version of the cryptobox-c step.

git clone https://github.com/wireapp/wire-server && cd wire-server/tools/makedeb
export VERSION=0
make dist
dpkg -i ../../dist/makedeb*.deb

cryptobox-c

Ubuntu / Debian

git clone https://github.com/wireapp/cryptobox-c && cd cryptobox-c
make dist
dpkg -i target/release/cryptobox*.deb

Generic

export TARGET_LIB="$HOME/.wire-dev/lib"
export TARGET_INCLUDE="$HOME/.wire-dev/include"
mkdir -p "$TARGET_LIB"
mkdir -p "$TARGET_INCLUDE"
git clone https://github.com/wireapp/cryptobox-c && cd cryptobox-c
make install

# Add cryptobox-c to ldconfig
sudo bash -c "echo \"${TARGET_LIB}\" > /etc/ld.so.conf.d/cryptobox.conf"
sudo ldconfig

Make sure stack knows where to find it. In ~/.stack/config.yaml add:

(using ~ or $HOME doesn't work, needs full paths)

extra-include-dirs:
- /usr/local/include
- <YOUR_HOME_DIR>/.wire-dev/include

extra-lib-dirs:
- /usr/local/lib
- <YOUR_HOME_DIR>/.wire-dev/lib

Docker

Note: While it is possible to use non-docker solutions to set up and configure this software, we recommend using docker and our provided docker images to configure dependent services rapidly, and ensure a consistent environment for all potential developers.

Ubuntu / Debian Testing/Unstable:

sudo apt install docker.io docker-compose

After installing docker-io, add your user to the docker group, and restart your shell (usually involving a restart of your graphical environment).

once you've logged in again, if you would like to upload any docker images (optional):

docker login --username=<MY_DOCKER_USERNAME>

Generic:

Nix

Using Stack's Nix integration, Stack will take care of installing any system dependencies automatically - including cryptobox-c. If new system dependencies are needed, add them to the shell.nix file in the project root. Just type $ nix-shell and you will automatically have make, docker-compose and stack in PATH. You can then run all the builds, and the native dependencies will be automatically present.

We are currently on a snapshot that uses ghc863 but Nix only ships ghc864 as ghc863 is officially deprecated. The releases should be totally compatible, but we need to convince stack that this is true. Hence, we can add the following to our global stack config in ~/.stack/config.yaml

skip-ghc-check: true