jami-docs/technical/Build-instructions.md

28 KiB

Jami relies on various components which interact together.

Ring-layers

They are divided into three main layers:

1. Daemon is the core of Jami. It does not interact with users but it is involved in every command.

2. LibRingClient (or LRC) is written in QtCore and facilitates clients' portability between operating systems. It does not interact with the Android client.

3. The Client layer formalizes the use-case on GNU/Linux (Gnome), Windows, Mac OS X and Android.

To fully build Jami, you must build each of these components in order, unless you choose to build Jami easily and quickly.

How to Build Jami Easily and Quickly (no cross compile)

We use a GIT repository to manage sources. On shell based platform you can fetch your private copy using following command:

git clone https://review.jami.net/ring-project

Jami installer uses python3. If it's not installed, please install it:

cd ring-project/
./make-ring.py --init

On GNU/Linux

Build and install all the dependencies: Your distro package manager will be used.

./make-ring.py --dependencies

Build and install locally

./make-ring.py --install

Run LibRing (daemon) and client that were installed locally

./make-ring.py --run

You can then stop the processes with CTRL-C. You can also run them in the background with the --background argument and then use the --stop command to stop them. Use Stdout and stderr to go to daemon.log and client-gnome.log.

Install globally for all users instead

./make-ring.py --install --global-install

Update sub-projects

One design choice that has been made is to not update the submodules of the ring-project very often due to high activity on the sub-projects. Therefore, you need to update them manually prior to rebuilding everything.

git submodule update --init daemon lrc client-gnome

Uninstall the global install

./make-ring.py --uninstall

On Mac OS X

  • You need to setup Homebrew since there is no built-in package manager on OSX.

Build and install all the dependencies

./make-ring.py --dependencies

Build and install locally

./make-ring.py --install

Output: You can find the .app file in the ./install/client-macosx folder.

On Android

Prepare environment

  • Install Java JDK 7 or 8 (Oracle or OpenJDK)

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

sudo apt install openjdk
  • Install Android Studio: https://developer.android.com/studio/index.html

    You can install all dependecies like ndk (side by side), lldb with android-studio in settings > appearance & behavior > system settings > android sdk > sdk tools

  • Install required tools
sudo apt install autoconf automake libtool autopoint swig python

Add these variables to your bash profile:

export JAVA_HOME=<path_to_java_JDK>
export ANDROID_HOME=<path_to_root_folder_sdk>
export ANDROID_SDK=$ANDROID_HOME
export ANDROID_NDK=<path_to_root_folder_ndk>
export ANDROID_NDK_ROOT=$ANDROID_NDK
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK:$JAVA_HOME/bin

ie for Ubuntu :

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/
export ANDROID_HOME=/home/{username}/Android/Sdk
export ANDROID_SDK=/home/{username}/Android/Sdk
export ANDROID_NDK_ROOT=/home/{username}/Android/Sdk/ndk-bundle/
export ANDROID_NDK=/home/{username}/Android/Sdk/ndk-bundle/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK:$JAVA_HOME/bin

Build and install locally

  • Clone whole project repository
git clone --recurse-submodules https://review.jami.net/ring-project
  • Initialize project
cd ring-project
./make-ring.py --init --distribution=Android
  • Compile
ANDROID_ABI="armeabi-v7a arm64-v8a" ./make-ring.py --install --distribution=Android

Output: You can find the .apk file in the ./client-android/ring-android/app/build/outputs folder.

Errors

  • configure: error: source directory already configured; run "make distclean" there first

    It means you build for another distro like x86_64-pc-linux-gnu and builds are conflicting. The simpliest solution is to make another ring-project only for Android to avoid this conflict.

Troubleshooting

  • Check case in your sdk path. Since api 26, /home/user/Android/sdk have become /home/user/Android/Sdk
  • You can check each path with echo. e.g : echo $JAVA_HOME
  • sudo will use root's bash profile. And you don't need it.
  • If build fails, you can try to clean contribs with:
cd ring-project/ && git clean -xdf
cd ../daemon && git clean -xdf
  • Makeinfo issue makeinfo: command not found WARNING: 'makeinfo' is missing on your system. Solution: Install texinfo package containing makeinfo dep.
  • Unable to locate tools.jar Solution: Your java installation is not pointing to a JDK. Install one, or make JAVA_HOME point to it.
  • When building the apk error in build-tools error while loading shared libraries: libstdc++.so.6 Solution: Install lib32stdc++6 lib32z1-dev
  • When compiling on Fedora error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory Solution*: sudo dnf install ncurses-compat-libs
  • When building, you may get a Gradle error. You should install Gradle 5.4.1 by running apt-get install or installing directly on android-studio.

On iOS

After installing Brew and Python3 (brew install python3):

git clone https://review.jami.net/ring-project
cd ring-project
./make-ring.py --init
./make-ring.py --dependencies --distribution iOS
./make-ring.py --install --distribution iOS
cd client-ios/Ring && ./fetch-dependencies.sh && cd ..
xcodebuild build -project Ring/Ring.xcodeproj/ -configuration "Release" -arch "x86_64" -destination "platform=iOS Simulator,name=iPhone $DATE,OS=11" -sdk iphonesimulator11.0 VALID_ARCHS="x86_64"


it could be useful to do this if an error occurs:

ln -s /usr/local/opt/gettext/bin/autopoint /usr/local/bin

if you get build errors linked to swift, you should upgrade swiftgen:

brew upgrade swiftgen

On Windows

Only 64-bit MSVC build can be compiled.

Note: command ./make-ring.py --init is not required on Windows build

Setup Before Building:

  • Download Qt (Open Source)

    • Install Qt version 5.15.0

  • Download Visual Studio (version >= 2019)

  • Install Visual Studio individual components :

    • Desktop development with C++
    • Windows 10 sdk 10.0.16299.0
    • MSBuild
    • MSVC v142 - VS 2019 C++ x64/x86 build tool
    • MFC for latest v142 build tool (x86/x64)

  • Install Qt Vs Tools under extensions, and configure msvc2019_64 path under Qt Options

  • Install WSL

  • Install cmake

    Qt Version SDK Toolset
    Minimum requirement: 5.15.0 10.0.16299.0 V142

Start Building

  • Using Command Prompt , starting at directory ring-project/
    git submodule update --init daemon lrc client-qt
    git submodule update --recursive --remote daemon lrc client-qt
  • Using Elevated Command Prompt
    python make-ring.py --dependencies

Note:

  1. This command will install chocolatey which may require you to restart the Command Prompt to be able to use it.
  2. This command will install msys2 (64 bit) by using chocolatey command which may cause issues below:
    a. Choco may require you to restart the Command Prompt after finishing installing msys2.
    b. Only if you have already installed msys2 (64 bit) under the default installation folder, we will use the existing one.
  3. This command will install strawberry perl by using chocolatey command which may fail if you have already installed it.
  4. This command will install cmake by using chocolatey command which will not add cmake into PATH (environment variable).

The issue 1, 2(a), 3 can be solved by restarting the Command Prompt under Administrator right and re-run the command.
The issue 3 can be solved by uninstalling your current strawberry perl and re-run the command.
The issue 4 can be solved by adding the location of the cmake.exe into PATH.

  • Using a new Non-Elevated Command Prompt
    python make-ring.py --install
  • Then you should be able to use the Visual Studio Solution file in client-windows folder (Configuration = Release, Platform = x64)

Note:
To control the toolset and the sdk version that are used by msbuild, you can use --toolset and --sdk options
To control which Qt version should be used (qmake, windeployqt), uou can use --qtver option
By default: toolset=v142, sdk=10.0.16299.0, qtver=5.15.0
For example:

    python make-ring.py --install --toolset v142 --sdk 10.0.16299.0 --qtver 5.15.0

How to Build LibRing (or Daemon)

First thing you need to do is buildind LibRing (or Daemon). Here are the instructions to build chapters for your platform.

Getting LibRing Source Code (all platforms)

We use a GIT repository to manage LibRing sources. On shell based platform you can fetch your private copy using following command:

git clone https://review.jami.net/ring-daemon

Notice that direct push are blocked. See below how to contribute to the daemon sending us patches.

How to Build LibRing (binary and SDK)

Following platforms are officialy supported : GNU/Linux | Windows | Mac OS X

On GNU/Linux

Build environment

  • Dependencies LibRing : Fedora
sudo yum groupinstall group "Development Tools" "Development Libraries"
sudo yum install gcc-c++ yasm intltool libyaml-devel alsa-lib-devel pulseaudio-libs-devel libsamplerate-devel dbus-c++-devel pcre-devel gsm-devel speex-devel speexdsp-devel expat-devel qttools5-dev libsndfile-devel gnutls-devel gettext-devel cmake libtool systemd-devel uuid-devel libXfixes-devel jsoncpp-devel autoconf-archive

For video support, you'll also need ffmpeg, which is only available in the RPMfusion repository as described here http://rpmfusion.org/Configuration

Then install ffmpeg:

sudo yum install ffmpeg-devel

To build and run the tests with make check, you'll also need

sudo yum install cppunit-devel cppcheck sipp dbus
  • Dependencies LibRing : Debian-based

Building dependencies/instructions for Debian, Ubuntu, Crunchbang Linux, etc.

sudo apt-get install autoconf autoconf-archive automake autopoint cmake libpulse-dev libsamplerate0-dev libgsm1-dev libspeex-dev libtool libdbus-1-dev libasound2-dev libopus-dev libspeexdsp-dev libexpat1-dev libpcre3-dev libyaml-cpp-dev libboost-dev libdbus-c++-dev qttools5-dev libsndfile1-dev libsrtp-dev libjack-dev libupnp-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev libudev-dev yasm uuid-dev libgnutls28-dev libjsoncpp-dev libvdpau-dev libva-dev

If you want to run tests (e.g. when setting up a new VM on Jenkins), you must install cppunit and sipp

sudo apt-get install libcppunit-dev sip-tester dbus

For H.264 support, you'll need

sudo apt-get install libavcodec-extra-*

Compile LibRing's dependencies

RING=$PWD/ring-daemon
cd $RING/contrib

mkdir native
cd native
../bootstrap
make
# That's all !

# Optionally, you may also type :
make list

# or

# make .packge?
# to force using downloaded packages, not system locally installed.
make .gnutls .upnp ...

Note: if compiling libav in contrib (you can see the list of dependencies which will be compiled by running 'make list' in $RING/contrib/build) on Linux, you will likely first need to install libx11-dev libxext-dev libxfixes-dev due to the '--enable-x11grab' configure option.

Build LibRing

cd $RING
# Now generate autotools configuration files
./autogen.sh
# Create Makefiles and config.h files for your build target
./configure --prefix=/usr --disable-shared
# Build
make
# Install
sudo make install

On native Windows

  • Make sure that dependencies is built by make-ring.py
  • On MSVC folder (ring-project\daemon\MSVC):
    cmake -DCMAKE_CONFIGURATION_TYPES="ReleaseLib_win32" -DCMAKE_VS_PLATFORM_NAME="x64" -G "Visual Studio 16 2019" -A x64 -T '$(DefaultPlatformToolset)' ..
    python winmake.py -iv -b daemon
  • --toolset, --sdk options are available, as well.
  • This will generate a .lib file in the path of ring-project\daemon\MSVC\x64\ReleaseLib_win32\bin

On Mac OS X

Build Tools: Use your favorite package manager to install the necessary tools (HomeBrew or MacPorts) automake, libtool, gettext, libtoolize, yasm, autoconf, pkg-config. If you don't use a package manager:

cd extras/tools
./bootstrap
make
export PATH=$PATH:$RING/extras/tools/build/bin

Compile LibRing's dependencies

cd contrib
mkdir build
cd build
../bootstrap
make -j3

Build LibRing: If you want to link against libringclient and native client, easiest way is to add --prefix to configure and then run make install

cd ../../
./autogen.sh
./configure  --without-dbus --prefix=<prefix_path>
make install

If you do not want to install LibRing, you will have to use -DRING_BUILD_DIR=<path_to_ring>/src as a cmake argument for LibRingClient.

Common Issues: "Autopoint not found" When using Homebrew, autopoint is not found even when gettext is installed, because symlinks are not created. To fixt it, run:

brew link --force gettext

Contributing to LibRing Source Code

First read our LibRing Coding Rules page before sending us any patches.

Gerrit is used as code review / integration tool. Register your ID (you need a Google/GitHUB OAuth2 account) on our public web gerrit service here:

https://review.jami.net

This service works for all Jami sub-projects (LibRing, LRC and clients).

How to Build LibRingClient (or LRC)

Getting the Source Code

git clone https://review.jami.net/ring-lrc

LIBRINGLIENT=`pwd`/ring-lrc
RING=`pwd`/ring-daemon

How to Build LibRingClient from Sources

Dependencies

  • Qt5core
    • Debian/Ubuntu: qtbase5-dev
    • Fedora: qt5-qtbase-devel
  • Qt5Linguist Tools are needed to enable compiling of translations
    • Debian/Ubuntu: qttools5-dev and qttools5-dev-tools
    • Fedora: qt5-qttools-devel

GNU/Linux & Mac OS X

cd $LIBRINGLIENT
mkdir build
cd build
cmake .. -DRING_BUILD_DIR=$RING/src -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

For debug symbols add the appropriate cmake option to the cmake configure line, like so:

cmake .. -DRING_BUILD_DIR=$RING/src -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug

Native Windows

  • Make sure that daemon is built first
    cd lrc
    python make-lrc.py -gb
  • --toolset, --sdk options are available, as well.

Developper

KDE Coding Guidelines

Rapport de projet de fin d'études (French - 54,866 Mo) Emmanuel Lepage, 2015/04/23

How to Build a Client

In most of cases you want a client to control the daemon. We provide ready to use clients for major platforms.

Choose your client build instructions below

Gnome Client for Jami

Getting the Source Code

git clone https://review.jami.net/ring-client-gnome

Dependencies

Building Environment
  • cmake
  • C++11 compiler (eg: gcc/g++ >= 8)
  • GTK+ >= 3.10
  • clutter and clutter-gtk
  • libRingClient
  • Qt5Core
  • gnome-icon-theme-symbolic
  • X11
  • libebook1.2 >= 3.10 or evolution-data-server >= 3.10

Some distros (Debian/Ubuntu) have separated the EDS APIs into its different client and server components, while others (Fedora) have put everything in one EDS package)

  • libnotify (optional for desktop notifications)
  • gettext (optional for compiling translations)

Debian/Ubuntu

sudo apt-get install g++ cmake libgtk-3-dev qtbase5-dev libclutter-gtk-1.0-dev gnome-icon-theme-symbolic libebook1.2-19 libnotify-dev gettext

Fedora

sudo yum install gcc-c++ cmake gtk3-devel qt5-qtbase-devel clutter-gtk-devel gnome-icon-theme-symbolic evolution-data-server-devel libnotify-devel gettext-devel

Documentation

You may optionally install doxygen to be able to build the documentation via 'make doc'

Run-time Environment
  • GTK+ >= 3.10
  • clutter and clutter-gtk
  • the Jami daemon and libRingClient
  • Qt5Core (libRingClient uses the Core module of Qt5, thus Qt5Core is required to properly interface between it and GTK)
  • gnome-icon-theme-symbolic, for the use of certain symbolic icons (this dependency may be dropped in the future)
  • X11 (this is currently needed for screen area selection during screen sharing, a Wayland (or otherwise) alternative is not currently supported)
  • libebook1.2 >= 3.10 or evolution-data-server >= 3.10

Some distros (Debian/Ubuntu) have separated the EDS APIs into its different client and server components, while others (Fedora) have put everything in one EDS package)

  • libnotify (optional for desktop notifications)

Debian/Ubuntu

sudo apt-get install libgtk-3-0 libqt5core5a libclutter-gtk-1.0-0 gnome-icon-theme-symbolic libebook-1.2-19 libnotify4

Note: for Debian 9 replace libebook-1.2-14 with libebook-1.2-16

Fedora

sudo yum install gtk3 qt5-qtbase clutter-gtk gnome-icon-theme-symbolic evolution-data-server libnotify

Build Instructions

If LibRing and LibRingClient are already installed on the system (eg: /usr/) in the gnome-ring project root dir:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

Building without installing LibRing and LibRingClient

This allows you to build every component separately and to run them from their location without having to install them. To do this, you must first build LibRing and then tell LibRingClient where it is located. Then, you build the LibRingClient and tell client-gnome where LibRingClient it is located. Finally, you build client-gnome.

  1. Build the daemon as explained above.

  2. Configure the build of LibRingClient by specifying the location of the (non-installed) daemon with e.g.: cd build && cmake .. -DRING_BUILD_DIR=$HOME/ring-project/daemon/src -DCMAKE_BUILD_TYPE=Debug

  3. Build LibRingClient by running "make".

  4. Configure the build of client-gnome by specifying the location of LibRingClient using the specific variable designed for it: cd build && cmake .. -DLibRingClient_PROJECT_DIR=$HOME/ring-project/lrc -DCMAKE_BUILD_TYPE=Debug

  5. Build client-gnome by running "make".

To run an install-less Jami, you must manually start the daemon and then the client, e.g.:

term1: $HOME/ring-project/daemon/bin/dring -cdp
term2: $HOME/ring-project/client-gnome/jami-gnome --debug

KDE Client for Jami

{width="30"} LibRing and LibRingClient must be installed first. If you have not already done so, go to the How to Build LibRing (or Daemon) and How to Build LibRingClient (or LRC) sections.

Getting the Source Code

git clone git://anongit.kde.org/ring-kde

Installing Build Dependencies

Debian/Ubuntu

sudo apt-get install cmake git-core qtbase5-dev extra-cmake-modules libqt5svg5-dev libkf5attica-dev libkf5attica-dev libkf5config-dev libkf5guiaddons-dev libkf5dbusaddons-dev libkf5i18n-dev  libkf5windowsystem-dev libkf5xmlgui-dev libkf5iconthemes-dev kinit-dev kio-dev libkf5completion-dev libkf5crash-dev kdelibs5-dev libkf5notifications-dev

Building Ring-KDE from Sources

cd $RING-KDE
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug
make
sudo make install

If LibRing isn't installed, you can use:

`-DRING_BUILD_DIR=$RING`

Client Qt for Jami

On GNU/Linux

cmake -DQT5_VER=5.15.0 -DQT5_PATH=/home/<username>/Qt/5.15.0/gcc_64 -DRING_BUILD_DIR=<daemon-source-path> -DCMAKE_INSTALL_PREFIX=<lrc-installation-path> -DRING_XML_INTERFACES_DIR=<daemon-source-path>/bin/dbus ..

Installing Build Dependencies

  • For Debian based:
qtmultimedia5-dev libqt5svg5-dev qtwebengine5-dev qtdeclarative5-dev qtquickcontrols2-5-dev qml-module-qtquick2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-layouts qml-module-qtquick-privatewidgets qml-module-qtquick-shapes qml-module-qtquick-window2 qml-module-qtquick-templates2 qml-module-qt-labs-platform qml-module-qtwebengine qml-module-qtwebchannel libqrencode-dev libnm-dev
  • For Fedora:
sudo dnf install qt5-qtsvg-devel qt5-qtwebengine-devel qt5-qtmultimedia-devel qt5-qtdeclarative-devel qt5-qtquickcontrols2-devel qt5-qtquickcontrols qrencode-devel NetworkManager-libnm-devel

Build Instructions

Once LibRingClient is built you can compile the client:

cd client-qt
mkdir build
cd build
cmake .. -DQT5_VER=5.15.0 -DQT5_PATH=/home/<username>/Qt/5.15.0/gcc_64 -DLRC=<path_to_lrc> -DCMAKE_INSTALL_PREFIX=<installation_path>
make

Variables QT5_VER and QT5_PATH are used to specify version and path for a custom installation of Qt.

If lrc library is installed in a custom directory you can set its path with the variable LRC. Additionally you can specify built library location with LRCLIB (otherwise it will seach inside LRC with the suffixes /lib, /build and /build-local).

Then, you are finally ready to launch jami-qt in your build directory.

If you want to install it to the path provided by CMAKE_INSTALL_PREFIX you can run:

make install

Debugging

Compile the client and LibRingClient with -DCMAKE_BUILD_TYPE=Debug

Known linker issues

With Ubuntu 20.04, even if the build process finish with success, the linker might give you the following message:

/usr/bin/ld: /home/<username>/Qt/5.15.0/gcc_64/lib/libQt5WebEngineCore.so: .dynsym local symbol at index 3 (>= sh_info of 3)
(...)

This has been solved by switching to gold linker:

sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld

On native Windows

  • Make sure that daemon, lrc are built first
    cd client-windows
    python make-client.py -d
    python make-client.py -b
    powershell -ExecutionPolicy Unrestricted -File copy-runtime-files.ps1
  • --toolset, --sdk options are available, as well.
  • To control the version of qmake.exe, --qtver option can be used

Packaging on native Windows

  • To be able to generate a msi package, first download and install Wixtoolset.
  • In Visual Studio, download WiX Toolset Visual Studio Extension.
  • Build client-windows project first, then the JamiInstaller project, msi package should be stored in ring-project\client-windows\JamiInstaller\bin\Release

Mac OS X Client for Jami

Other Requirements

  • Qt5 (we link against Qt5Core, Qt5Widgets, Qt5Gui)
  • Cocoa framework and Xcode toolchains

Getting the Source Code

git clone https://review.jami.net/ring-client-macosx

Build Instructions

mkdir build && cd build
export CMAKE_PREFIX_PATH=<dir_to_qt5>
Setting up Compilation with XCode

Generate an Xcode project with CMake:

cmake ../ -DCMAKE_INSTALL_PREFIX=<libringclient_install_path> -G Xcode
open Ring.xcodeproj/

Build and run it from Xcode.

Setting up Compilation by Command Line
cmake ../ -DCMAKE_INSTALL_PREFIX=<libringclient_install_path>
make
open Ring.app/
  • The app built using 'make' contains only links to required libraries. To fully build and package as a standalone Bundle, see the Packaging section.
Debugging

For now, the build type of the client is "Debug" by default. However it is useful to also have the debug symbols of LibRingClient. To do this, specify -DCMAKE_BUILD_TYPE=Debug when compiling LibRingClient in the cmake options.

Packaging

To make a standalone Bundle we use a cmake module: BundleUtilities. All dependencies are copied inside the Bundle and links are fixed.

We can then generate a "DragNDrop" dmg file with CPack.

cmake ../ -DCMAKE_INSTALL_PREFIX=<libringclient_install_path>
make install -j
cpack -G DragNDrop Ring