1# Install Instructions
2- [Dependencies](#dependencies)
3- [Linux](#linux)
4  - [Simple install](#simple-install)
5    - [Arch](#arch-easy)
6    - [Fedora](#fedora-easy)
7    - [Gentoo](#gentoo-easy)
8    - [openSUSE](#opensuse-easy)
9    - [Slackware](#slackware-easy)
10    - [FreeBSD](#freebsd-easy)
11  - [Install git](#install-git)
12    - [Arch](#arch-git)
13    - [Debian](#debian-git)
14    - [Fedora](#fedora-git)
15    - [openSUSE](#opensuse-git)
16    - [Ubuntu](#ubuntu-git)
17  - [Clone qTox](#clone-qtox)
18  - [GCC, Qt, FFmpeg, OpenAL Soft and qrencode](#other-deps)
19    - [Arch](#arch-other-deps)
20    - [Debian](#debian-other-deps)
21    - [Fedora](#fedora-other-deps)
22    - [openSUSE](#opensuse-other-deps)
23    - [Slackware](#slackware-other-deps)
24    - [Ubuntu >=15.04](#ubuntu-other-deps)
25    - [Ubuntu >=16.04](#ubuntu-other-1604-deps)
26  - [sqlcipher](#sqlcipher)
27  - [Compile toxcore](#compile-toxcore)
28  - [Compile qTox](#compile-qtox)
29  - [Security hardening with AppArmor](#security-hardening-with-apparmor)
30- [OS X](#osx)
31- [Windows](#windows)
32  - [Cross-compile from Linux](#cross-compile-from-linux)
33  - [Native](#native)
34- [Compile-time switches](#compile-time-switches)
35
36## Dependencies
37
38| Name          | Version     | Modules                                                  |
39|---------------|-------------|----------------------------------------------------------|
40| [Qt]          | >= 5.5.0    | concurrent, core, gui, network, opengl, svg, widget, xml |
41| [GCC]/[MinGW] | >= 4.8      | C++11 enabled                                            |
42| [toxcore]     | >= 0.2.10   | core, av                                                 |
43| [FFmpeg]      | >= 2.6.0    | avformat, avdevice, avcodec, avutil, swscale             |
44| [CMake]       | >= 2.8.11   |                                                          |
45| [OpenAL Soft] | >= 1.16.0   |                                                          |
46| [qrencode]    | >= 3.0.3    |                                                          |
47| [sqlcipher]   | >= 3.2.0    |                                                          |
48| [pkg-config]  | >= 0.28     |                                                          |
49| [snorenotify] | >= 0.7.0    | optional dependency                                      |
50
51## Optional dependencies
52
53They can be disabled/enabled by passing arguments to `cmake` command when
54building qTox.
55
56If they are missing, qTox is built without support for the functionality.
57
58### Development dependencies
59
60Dependencies needed to run tests / code formatting, etc. Disabled if
61dependencies are missing.
62
63| Name    | Version |
64|---------|---------|
65| [Check] | >= 0.9  |
66
67### Spell checking support
68
69| Name     | Version |
70|----------|---------|
71| [sonnet] | >= 5.45 |
72
73Use `-DSPELL_CHECK=OFF` to disable it.
74
75**Note:** Specified version was tested and works well. You can try to use older
76version, but in this case you may have some errors (including a complete lack
77of spell check).
78
79### Linux
80
81#### Auto-away support
82
83| Name            | Version  |
84|-----------------|----------|
85| [libXScrnSaver] | >= 1.2   |
86| [libX11]        | >= 1.6.0 |
87
88Disabled if dependencies are missing during compilation.
89
90#### Snorenotify desktop notification backend
91
92Disabled by default
93
94| Name              | Version   |
95|-------------------|-----------|
96| [snorenotify]     | >= 0.7.0  |
97
98To enable: `-DDESKTOP_NOTIFICATIONS=True`
99
100
101## Linux
102### Simple install
103
104Easy qTox install is provided for variety of distributions:
105
106* [Arch](#arch)
107* [Fedora](#fedora)
108* [Gentoo](#gentoo)
109* [Slackware](#slackware)
110
111---
112
113<a name="arch-easy" />
114
115#### Arch
116
117PKGBUILD is available in the `community` repo, to install:
118
119```bash
120pacman -S qtox
121```
122
123<a name="fedora-easy" />
124
125#### Fedora
126
127qTox is available in the [RPMFusion](https://rpmfusion.org/) repo, to install:
128
129```bash
130dnf install qtox
131```
132
133<a name="gentoo-easy" />
134
135#### Gentoo
136
137qTox is available in Gentoo.
138
139To install:
140
141```bash
142emerge qtox
143```
144
145<a name="opensuse-easy" />
146
147#### openSUSE
148
149qTox is available in openSUSE Factory.
150
151To install in openSUSE 15.0 or newer:
152
153```bash
154zypper in qtox
155```
156
157To install in openSUSE 42.3:
158
159```bash
160zypper ar -f https://download.opensuse.org/repositories/server:/messaging/openSUSE_Leap_42.3 server:messaging
161zypper in qtox
162```
163
164<a name="slackware-easy" />
165
166#### Slackware
167
168qTox SlackBuild and all of its dependencies can be found here:
169http://slackbuilds.org/repository/14.2/network/qTox/
170
171<a name="freebsd-easy" />
172
173#### FreeBSD
174
175qTox is available as a binary package. To install the qTox package:
176
177```bash
178pkg install qTox
179```
180
181The qTox port is also available at ``net-im/qTox``. To build and install qTox
182from sources using the port:
183
184```bash
185cd /usr/ports/net-im/qTox
186make install clean
187```
188
189----
190
191If your distribution is not listed, or you want / need to compile qTox, there
192are provided instructions.
193
194
195----
196
197Most of the dependencies should be available through your package manager. You
198may either follow the directions below, or simply run `./simple_make.sh` after
199cloning this repository, which will attempt to automatically download
200dependencies followed by compilation.
201
202### Install git
203In order to clone the qTox repository you need Git.
204
205
206<a name="arch-git" />
207
208#### Arch Linux
209
210```bash
211sudo pacman -S --needed git
212```
213
214<a name="debian-git" />
215
216#### Debian
217
218```bash
219sudo apt-get install git
220```
221
222<a name="fedora-git" />
223
224#### Fedora
225
226```bash
227sudo dnf install git
228```
229
230<a name="opensuse-git" />
231
232#### openSUSE
233
234```bash
235sudo zypper install git
236```
237
238<a name="ubuntu-git" />
239
240#### Ubuntu
241
242```bash
243sudo apt-get install git
244```
245
246
247### Clone qTox
248
249Afterwards open a new terminal, change to a directory of your choice and clone
250the repository:
251
252```bash
253cd /home/$USER/qTox
254git clone https://github.com/qTox/qTox.git qTox
255```
256
257The following steps assumes that you cloned the repository at
258`/home/$USER/qTox`.  If you decided to choose another location, replace
259corresponding parts.
260
261
262<a name="other-deps" />
263
264### GCC, Qt, FFmpeg, OpenAL Soft and qrencode
265
266<a name="arch-other-deps" />
267
268#### Arch Linux
269
270```bash
271sudo pacman -S --needed base-devel qt5 openal libxss qrencode ffmpeg opus libvpx libsodium
272```
273
274
275<a name="debian-other-deps" />
276
277#### Debian
278
279**Note that only Debian >=9 stable (stretch) is supported.**
280
281```bash
282sudo apt-get install \
283    automake \
284    autotools-dev \
285    build-essential \
286    check \
287    checkinstall \
288    cmake \
289    ffmpeg \
290    libavcodec-dev \
291    libavdevice-dev \
292    libexif-dev \
293    libgdk-pixbuf2.0-dev \
294    libgtk2.0-dev \
295    libkdeui5 \
296    libopenal-dev \
297    libopus-dev \
298    libqrencode-dev \
299    libqt5opengl5-dev \
300    libqt5svg5-dev \
301    libsodium-dev \
302    libsqlcipher-dev \
303    libtool \
304    libvpx-dev \
305    libxss-dev \
306    pkg-config \
307    qrencode \
308    qt5-default \
309    qttools5-dev \
310    qttools5-dev-tools \
311    yasm
312```
313
314<a name="fedora-other-deps" />
315
316#### Fedora
317
318**Note that sqlcipher is not included in all versions of Fedora yet.**
319As of writing this section (November 2016), Fedora 25 ships sqlcipher, but
320Fedora 24 and older don't ship it yet.
321**This means that if you can't install sqlcipher from repositories, you'll
322have to compile it yourself, otherwise compiling qTox will fail.**
323
324```bash
325sudo dnf groupinstall "Development Tools" "C Development Tools and Libraries"
326# (can also use sudo dnf install @"Development Tools")
327sudo dnf install \
328    autoconf \
329    automake \
330    check \
331    check-devel \
332    ffmpeg-devel \
333    gtk2-devel \
334    kf5-sonnet \
335    libexif-devel \
336    libsodium-devel \
337    libtool \
338    libvpx-devel \
339    libXScrnSaver-devel \
340    openal-soft-devel \
341    openssl-devel \
342    opus-devel \
343    qrencode-devel \
344    qt5-linguist \
345    qt5-qtsvg \
346    qt5-qtsvg-devel \
347    qt-creator \
348    qt-devel \
349    qt-doc \
350    qtsingleapplication \
351    sqlcipher \
352    sqlcipher-devel
353```
354
355**Go to [sqlcipher](#sqlcipher) section to compile it if necessary.**
356
357<a name="opensuse-other-deps" />
358
359#### openSUSE
360
361```bash
362sudo zypper install \
363    libexif-devel \
364    libffmpeg-devel \
365    libopus-devel \
366    libQt5Concurrent-devel \
367    libqt5-linguist \
368    libQt5Network-devel \
369    libQt5OpenGL-devel \
370    libqt5-qtbase-common-devel \
371    libqt5-qtsvg-devel \
372    libQt5Xml-devel \
373    libsodium-devel \
374    libvpx-devel \
375    libXScrnSaver-devel \
376    openal-soft-devel \
377    patterns-openSUSE-devel_basis \
378    qrencode-devel \
379    sqlcipher-devel \
380    sonnet-devel
381```
382
383<a name="slackware-other-deps" />
384
385#### Slackware
386
387List of all the toxcore dependencies and their SlackBuilds can be found
388here: http://slackbuilds.org/repository/14.2/network/toxcore/
389
390List of all the qTox dependencies and their SlackBuilds can be found here:
391http://slackbuilds.org/repository/14.2/network/qTox/
392
393
394<a name="ubuntu-other-deps" />
395
396#### Ubuntu >=15.04
397
398```bash
399sudo apt-get install \
400    automake \
401    autotools-dev \
402    build-essential cmake \
403    check \
404    checkinstall \
405    libavcodec-ffmpeg-dev \
406    libavdevice-ffmpeg-dev \
407    libavfilter-ffmpeg-dev \
408    libavutil-ffmpeg-dev \
409    libexif-dev \
410    libgdk-pixbuf2.0-dev \
411    libglib2.0-dev \
412    libgtk2.0-dev \
413    libkdeui5 \
414    libopenal-dev \
415    libopus-dev \
416    libqrencode-dev \
417    libqt5opengl5-dev \
418    libqt5svg5-dev \
419    libsodium-dev \
420    libsqlcipher-dev \
421    libswresample-ffmpeg-dev \
422    libswscale-ffmpeg-dev \
423    libtool \
424    libvpx-dev \
425    libxss-dev \
426    qrencode \
427    qt5-default \
428    qttools5-dev-tools
429```
430
431<a name="ubuntu-other-1604-deps" />
432
433#### Ubuntu >=16.04:
434
435```bash
436sudo apt-get install \
437    build-essential \
438    cmake \
439    libavcodec-dev \
440    libavdevice-dev \
441    libavfilter-dev \
442    libavutil-dev \
443    libexif-dev \
444    libgdk-pixbuf2.0-dev \
445    libglib2.0-dev \
446    libgtk2.0-dev \
447    libkdeui5 \
448    libopenal-dev \
449    libopus-dev \
450    libqrencode-dev \
451    libqt5opengl5-dev \
452    libqt5svg5-dev \
453    libsodium-dev \
454    libsqlcipher-dev \
455    libswresample-dev \
456    libswscale-dev \
457    libvpx-dev \
458    libxss-dev \
459    qrencode \
460    qt5-default \
461    qttools5-dev-tools \
462    qttools5-dev
463```
464
465### sqlcipher
466
467If you are not using an old version of Fedora, skip this section, and go
468directly to compiling
469[**toxcore**](#compile-toxcore).
470
471```bash
472git clone https://github.com/sqlcipher/sqlcipher
473cd sqlcipher
474./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
475    LDFLAGS="-lcrypto"
476make
477sudo make install
478cd ..
479```
480
481### Compile toxcore
482
483Normally you don't want to do that, `bootstrap.sh` will do it for you.
484
485Provided that you have all required dependencies installed, you can simply run:
486
487```bash
488git clone https://github.com/toktok/c-toxcore.git toxcore
489cd toxcore
490git checkout v0.2.13
491cmake . -DBOOTSTRAP_DAEMON=OFF
492make -j$(nproc)
493sudo make install
494
495# we don't know what whether user runs 64 or 32 bits, and on some distros
496# (Fedora, openSUSE) lib/ doesn't link to lib64/, so add both
497echo '/usr/local/lib64/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
498echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
499sudo ldconfig
500```
501
502### Compile qTox
503
504**Make sure that all the dependencies are installed.**  If you experience
505problems with compiling, it's most likely due to missing dependencies, so please
506make sure that you did install *all of them*.
507
508If you are compiling on Fedora 25, you must add libtoxcore to the
509`PKG_CONFIG_PATH` environment variable manually:
510
511```
512# we don't know what whether user runs 64 or 32 bits, and on some distros
513# (Fedora, openSUSE) lib/ doesn't link to lib64/, so add both
514export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig"
515export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
516```
517
518Run in qTox directory to compile:
519
520```bash
521cmake .
522make -j$(nproc)
523```
524
525Now you can start compiled qTox with `./qtox`
526
527Congratulations, you've compiled qTox `:)`
528
529
530#### Debian / Ubuntu / Mint
531
532If the compiling process stops with a missing dependency like:
533`... libswscale/swscale.h missing` try:
534
535```bash
536apt-file search libswscale/swscale.h
537```
538
539And install the package that provides the missing file.
540Start make again. Repeat if necessary until all dependencies are installed. If
541you can, please note down all additional dependencies you had to install that
542aren't listed here, and let us know what is missing `;)`
543
544
545---
546
547### Building packages
548
549Alternately, qTox now has the experimental and probably-dodgy ability to package
550itself (in `.deb` form natively, and `.rpm` form with
551[alien](http://joeyh.name/code/alien/)).
552
553After installing the required dependencies, run `bootstrap.sh` and then run the
554`buildPackages.sh` script, found in the tools folder. It will automatically get
555the packages necessary for building `.deb`s, so be prepared to type your
556password for sudo.
557
558---
559
560### Security hardening with AppArmor
561
562See [AppArmor] to enable confinement for increased security.
563
564
565<a name="osx" />
566
567## OS X
568
569Supported OS X versions: >=10.8. (NOTE: only 10.13 is tested during CI)
570
571Compiling qTox on OS X for development requires 2 tools:
572[Xcode](https://developer.apple.com/xcode/) and [homebrew](https://brew.sh).
573
574### Automated Script
575
576You can now set up your OS X system to compile qTox automatically thanks to the
577script in: `./osx/qTox-Mac-Deployer-ULTIMATE.sh`
578
579This script can be run independently of the qTox repo and is all that's needed
580to build from scratch on OS X.
581
582To use this script you must launch terminal which can be found:
583`Applications > Utilities > Terminal.app`
584
585If you wish to lean more you can run `./qTox-Mac-Deployer-ULTIMATE.sh -h`
586
587Note that the script will revert any non-committed changes to qTox repository
588during the `update` phase.
589
590#### First Run / Install
591
592If you are running the script for the first time you will want to make sure your
593system is ready. To do this simply run `./qTox-Mac-Deployer-ULTIMATE.sh -i` to
594run you through the automated install set up.
595
596After running the installation setup you are now ready to build qTox from
597source, to do this simply run: `./qTox-Mac-Deployer-ULTIMATE.sh -b`
598
599If there aren't any errors then you'll find a locally working qTox application
600in your home folder under `~/qTox-Mac_Build`
601
602#### Updating
603
604If you want to update your application for testing purposes or you want to run a
605nightly build setup then run: `./qTox-Mac-Deployer-ULTIMATE.sh -u` and follow
606the prompts. (NOTE: If you know you updated the repos before running this hit Y)
607followed by `./qTox-Mac-Deployer-ULTIMATE.sh -b` to build the application once
608more. (NOTE: This will delete your previous build.)
609
610#### Deploying
611
612OS X requires an extra step to make the `qTox.app` file shareable on a system
613that doesn't have the required libraries installed already.
614
615If you want to share the build you've made with your other friends who use OS X
616then simply run: `./qTox-Mac-Deployer-ULTIMATE.sh -d`
617
618### Manual Compiling
619#### Required Libraries
620
621Install homebrew if you don't have it:
622
623```bash
624ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
625```
626
627First, let's install the dependencies available via `brew`.
628
629```bash
630brew install git ffmpeg qrencode libtool automake autoconf check qt5 libvpx \
631opus sqlcipher libsodium
632```
633
634Next, install
635[toxcore](https://github.com/toktok/c-toxcore/blob/master/INSTALL.md#osx)
636
637Then, clone qTox:
638
639```bash
640git clone https://github.com/qTox/qTox
641```
642
643Finally, copy all required files. Whenever you update your brew packages, you
644may skip all of the above steps and simply run the following commands:
645
646```bash
647cd ./git/qTox
648sudo bash bootstrap-osx.sh
649```
650
651#### Compiling
652
653You can build qTox with Qt Creator
654[seperate download](http://www.qt.io/download-open-source/#section-6) or
655manually with cmake
656
657With that; in your terminal you can compile qTox in the git dir:
658
659```bash
660cmake .
661make
662```
663
664Or a cleaner method would be to:
665
666```bash
667cd ./git/dir/qTox
668mkdir ./build
669cd build
670cmake ..
671```
672
673#### Deploying
674
675If you compiled qTox properly you can now deploy the `qTox.app` that's created
676where you built qTox so you can distribute the package.
677
678Using your qt5 homebrew installation from the build directory:
679
680```bash
681/usr/local/Cellar/qt5/5.5.1_2/bin/macdeployqt ./qTox.app
682```
683
684#### Running qTox
685
686You've got 2 choices, either click on the qTox app that suddenly exists, or do
687the following:
688
689```bash
690qtox.app/Contents/MacOS/qtox
691```
692
693Enjoy the snazzy CLI output as your friends and family congratulate you on
694becoming a hacker
695
696<a name="windows" />
697
698## Windows
699
700### Cross-compile from Linux
701
702See [`windows/cross-compile`](windows/cross-compile).
703
704### Native
705
706#### Qt
707
708Download the Qt online installer for Windows from
709[qt.io](https://www.qt.io/download-open-source/). While installation you have
710to assemble your Qt toolchain. Take the most recent version of Qt compiled with
711MinGW. Although the installer provides its own bundled MinGW compiler toolchain
712its recommend installing it separately because Qt is missing MSYS which is
713needed to compile and install OpenAL. Thus you can - if needed - deselect the
714tab `Tools`. The following steps assume that Qt is installed at `C:\Qt`. If you
715decided to choose another location, replace corresponding parts.
716
717#### MinGW
718
719Download the MinGW installer for Windows from
720[sourceforge.net](http://sourceforge.net/projects/mingw/files/Installer/). Make
721sure to install MSYS (a set of Unix tools for Windows). The following steps
722assume that MinGW is installed at `C:\MinGW`. If you decided to choose another
723location, replace corresponding parts. Select `mingw-developer-toolkit`,
724`mingw32-base`, `mingw32-gcc-g++`, `msys-base` and `mingw32-pthreads-w32`
725packages using MinGW Installation Manager (`mingw-get.exe`). Check that the
726version of MinGW, corresponds to the version of the QT component!
727
728#### Wget
729
730Download the Wget installer for Windows from
731http://gnuwin32.sourceforge.net/packages/wget.htm. Install them. The following
732steps assume that Wget is installed at `C:\Program Files (x86)\GnuWin32\`. If you
733decided to choose another location, replace corresponding parts.
734
735#### UnZip
736
737Download the UnZip installer for Windows from
738http://gnuwin32.sourceforge.net/packages/unzip.htm. Install it. The following
739steps assume that UnZip is installed at `C:\Program Files (x86)\GnuWin32\`. If you
740decided to choose another location, replace corresponding parts.
741
742#### Setting up Path
743
744Add MinGW/MSYS/CMake binaries to the system path to make them globally
745accessible. Open `Control Panel` -> `System and Security` -> `System` ->
746`Advanced system settings` -> `Environment Variables...` (or run `sysdm.cpl`
747select tab `Advanced system settings` -> button `Environment Variables`). In the
748second box search for the `PATH` variable and press `Edit...`. The input box
749`Variable value:` should already contain some directories. Each directory is
750separated with a semicolon. Extend the input box by adding
751`;C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\Program Files (x86)\CMake 2.8\bin;C:\Program Files (x86)\GnuWin32\bin`.
752The very first semicolon must only be added if it is missing. CMake may be added
753by installer automatically. Make sure that paths containing alternative `sh`,
754`bash` implementations such as `C:\Program Files\OpenSSH\bin` are at the end of
755`PATH` or build may fail.
756
757#### Cloning the Repository
758
759Clone the repository (https://github.com/qTox/qTox.git) with your preferred Git
760client. [SmartGit](http://www.syntevo.com/smartgit/) or
761[TorteiseGit](https://tortoisegit.org) are both very nice for this task
762(you may need to add `git.exe` to your `PATH` system variable). The
763following steps assume that you cloned the repository at `C:\qTox`. If you
764decided to choose another location, replace corresponding parts.
765
766#### Getting dependencies
767
768Run `bootstrap.bat` in the previously cloned `C:\qTox` repository. The script will
769download the other necessary dependencies, compile them and put them into their
770appropriate directories.
771
772Note that there have been detections of false positives by some anti virus software
773in the past within some of the libraries used. Please refer to the wiki page
774[problematic antiviruses](https://github.com/qTox/qTox/wiki/Problematic-antiviruses)
775for more information if you run into troubles on that front.
776
777## Compile-time switches
778
779They are passed as an argument to `cmake` command. E.g. with a switch `SWITCH`
780that has value `YES` it would be passed to `cmake` in a following manner:
781
782```bash
783cmake -DSWITCH=yes
784```
785
786Switches:
787
788- `SMILEYS`, values:
789  - if not defined or an unsupported value is passed, all emoticon packs are
790    included
791  - `DISABLED` – don't include any emoticon packs, custom ones are still loaded
792  - `MIN` – minimal support for emoticons, only a single emoticon pack is
793    included
794
795
796[AppArmor]: /security/apparmor/README.md
797[Atk]: https://wiki.gnome.org/Accessibility
798[Cairo]: https://www.cairographics.org/
799[Check]: https://libcheck.github.io/check/
800[CMake]: https://cmake.org/
801[DBus Menu]: https://launchpad.net/libdbusmenu
802[FFmpeg]: https://www.ffmpeg.org/
803[GCC]: https://gcc.gnu.org/
804[libX11]: https://www.x.org/wiki/
805[libXScrnSaver]: https://www.x.org/wiki/Releases/ModuleVersions/
806[MinGW]: http://www.mingw.org/
807[OpenAL Soft]: http://kcat.strangesoft.net/openal.html
808[Pango]: http://www.pango.org/
809[pkg-config]: https://www.freedesktop.org/wiki/Software/pkg-config/
810[qrencode]: https://fukuchi.org/works/qrencode/
811[Qt]: https://www.qt.io/
812[sqlcipher]: https://www.zetetic.net/sqlcipher/
813[toxcore]: https://github.com/TokTok/c-toxcore/
814[sonnet]: https://github.com/KDE/sonnet
815[snorenotify]: https://techbase.kde.org/Projects/Snorenotify
816