summaryrefslogtreecommitdiff
path: root/INSTALL.md
diff options
context:
space:
mode:
authorMaxim Biro <nurupo.contributions@gmail.com>2017-02-16 05:16:23 -0500
committerMaxim Biro <nurupo.contributions@gmail.com>2018-01-25 16:04:53 -0500
commit29cd93a49c4ea30105e861e2b6b5fc41e329efef (patch)
tree34d39b477d4d6ae5ad9e56670f9540a7a1b37a37 /INSTALL.md
parent54a1ccf8cec39bfa7019659afef3db5e192fb4a8 (diff)
Update install instructions to use CMake
Diffstat (limited to 'INSTALL.md')
-rw-r--r--INSTALL.md646
1 files changed, 162 insertions, 484 deletions
diff --git a/INSTALL.md b/INSTALL.md
index bd2f02ef..a79fcd53 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -1,556 +1,234 @@
1# Install Instructions 1# Installation instructions
2
3- [Installation](#installation)
4 - [Unix like](#most-unix-like-oses)
5 - [Quick install](#quick-install)
6 - [Build manually](#build-manually)
7 - [Compile toxcore](#compile-toxcore)
8 - [OS X](#os-x)
9 - [Homebrew](#homebrew)
10 - [Non-Homebrew](#non-homebrew)
11 - [Windows](#windows)
12 - [Cross-Compile](#cross-compile)
13 - [Setting up a VM](#setting-up-a-vm)
14 - [Setting up the environment](#setting-up-the-environment)
15 - [Compiling](#compiling)
16 - [Native](#native)
17- [Additional](#additional)
18 - [Advanced configure options](#advanced-configure-options)
19 - [A/V support](#av-support)
20 - [libtoxav](#libtoxav)
21 - [Bootstrap daemon](#bootstrap-daemon)
22
23## Installation
24
25### Most Unix like OSes:
26
27#### Quick install:
28
29On Gentoo:
30```
31# emerge net-libs/tox
32```
33
34And you're done `:)`</br>
35If you happen to run some other distro which isn't made for compiling, there are steps below:
36
37#### Build manually
38 2
39Build dependencies: 3These instructions will guide you through the process of building and installing the toxcore library and its components, as well as getting already pre-built binaries.
40 4
41Note: package fetching commands may vary by OS. 5## Table of contents
42 6
43On Ubuntu `< 15.04` / Debian `< 8`: 7- [Overview](#overview)
8 - [Components](#components)
9 - [Main](#main)
10 - [Secondary](#secondary)
11- [Building](#building)
12 - [Requirements](#requirements)
13 - [Library dependencies](#library-dependencies)
14 - [Compiler requirements](#compiler-requirements)
15 - [Build system requirements](#build-system-requirements)
16 - [CMake options](#cmake-options)
17 - [Build process](#build-process)
18 - [Unix-like](#unix-like)
19 - [Windows](#windows)
20 - [Building on Windows host](#building-on-windows-host)
21 - [Microsoft Visual Studio's Developer Command Prompt](#microsoft-visual-studios-developer-command-prompt)
22 - [MSYS/Cygwin](#msyscygwin)
23 - [Cross-compiling from Linux](#cross-compiling-from-linux)
24- [Pre-built binaries](#pre-built-binaries)
25 - [Linux](#linux)
26 - [Windows](#windows-1)
44 27
45```bash 28## Overview
46sudo apt-get install build-essential libtool autotools-dev automake checkinstall check git yasm
47```
48 29
49On Ubuntu `>= 15.04` / Debian `>= 8`: 30### Components
50```bash
51sudo apt-get install build-essential libtool autotools-dev automake checkinstall check git yasm libsodium13 libsodium-dev
52```
53 31
54On Fedora: 32#### Main
55 33
56```bash 34This repository, although called `toxcore`, in fact contains several libraries besides `toxcore` which complement it, as well as several executables. However, note that although these are separate libraries, at the moment, when building the libraries, they are all merged into a single `toxcore` library. Here is the full list of the main components that can be built using the CMake, their dependencies and descriptions.
57dnf groupinstall "Development Tools"
58dnf install libtool autoconf automake check check-devel
59```
60Using ``dnf install @"Development Tools"`` is also valid and slightly shorter / cleaner way. ``dnf install @"Rpm Development Tools"`` would carry the remaining dependencies listed here.
61 35
62On SunOS: 36| Name | Type | Dependencies | Platform | Description |
37|----------------|------------|-----------------------------------------------|----------------|----------------------------------------------------------------------------|
38| toxcore | Library | libnacl or libsodium, libm, libpthread, librt | Cross-platform | The main Tox library that provides the messenger functionality. |
39| toxav | Library | libtoxcore, libopus, libvpx | Cross-platform | Provides audio/video functionality. |
40| toxencryptsave | Library | libtoxcore, libnacl or libsodium | Cross-platform | Provides encryption of Tox profiles (savedata), as well as arbitrary data. |
41| DHT_bootstrap | Executable | libtoxcore | Cross-platform | A simple DHT bootstrap node. |
42| tox-bootstrapd | Executable | libtoxcore, libconfig | Unix-like | Highly configurable DHT bootstrap node daemon (systemd, SysVinit, Docker). |
63 43
64```pfexcec 44#### Secondary
65pkg install autoconf automake gcc-47
66```
67On FreeBSD 10+:
68 45
69```tcsh 46There are some testing programs that you might find interesting. Note that they are not intended for the real-world use and are not coded to the high security standards, so use them on your own risk.
70pkg install net-im/tox
71```
72Note, if you install from ports select NaCl for performance, and sodium if you want it to be portable.
73
74**For A/V support, also install the dependences listed in the [libtoxav](#libtoxav) section.** Note that you have to install those dependencies **before** compiling `toxcore`.
75
76You should get and install [libsodium](https://github.com/jedisct1/libsodium). If you have installed `libsodium` from repo, ommit this step, and jump directly to [compiling toxcore](#compile-toxcore):
77```bash
78git clone https://github.com/jedisct1/libsodium.git
79cd libsodium
80git checkout tags/1.0.11
81./autogen.sh
82./configure && make check
83sudo checkinstall --install --pkgname libsodium --pkgversion 1.0.0 --nodoc
84sudo ldconfig
85cd ..
86```
87 47
48| Name | Type | Dependencies | Platform | Description |
49|-------------|------------|------------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------|
50| irc_syncbot | Executable | libtoxcore | Unix-like | Bot that synchronizes an IRC channel and a Tox group chat (conference). |
51| tox_shell | Executable | libtoxcore, libutil | Unix-like | Proof of concept SSH-like server software using Tox. Testing program, not intended for actual use. |
52| tox_sync | Executable | libtoxcore | Unix-like | Bittorrent-sync-like software using Tox. Syncs two directories together. |
88 53
89Or if checkinstall is not easily available for your distribution (e.g., Fedora), 54There are also some programs that are not plugged into the CMake build system which you might find interesting. You would need to build those programs yourself. These programs reside in [`other/fun`](other/fun) directory.
90this will install the libs to /usr/local/lib and the headers to /usr/local/include:
91 55
92```bash 56| Name | Type | Dependencies | Platform | Description |
93git clone https://github.com/jedisct1/libsodium.git 57|---------------------|------------|----------------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
94cd libsodium 58| bootstrap_node_info | Script | python3 | Cross-platform | Script for getting version and Message Of The Day (MOTD) information from a DHT bootstrap node. |
95git checkout tags/1.0.11 59| cracker | Executable | libnacl or libsodium | Cross-platform | Tries to find a curve25519 key pair, hex representation of the public key of which starts with the specified byte sequence. |
96./autogen.sh 60| strkey | Executable | libsodium | Cross-platform | Tries to find a curve25519 key pair, hex representation of the public key of which contains a specified byte pattern at the specified position or at any position. |
97./configure 61| make-funny-savefile | Script | python | Cross-platform | Generates Tox profile file (savedata file) with provided key pair. Useful for generating Tox profiles from the output of cracker or strkey programs. |
98make check 62| sign | Executable | libsodium | Cross-platform | Program for ed25519 file signing. |
99sudo make install
100cd ..
101```
102 63
103If your default prefix is ``/usr/local`` and you happen to get an error that says ``"error while loading shared libraries: libtoxcore.so.0: cannot open shared object file: No such file or directory"``, then you can try running ``sudo ldconfig``. If that doesn't fix it, run: 64## Building
104 65
105```bash 66### Requirements
106echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
107sudo ldconfig
108```
109 67
110You may run into a situation where there is no ``/etc/ld.so.conf.d`` directory. You could either create it manually, or append path to local library to ``ld.so.conf``: 68#### Library dependencies
111 69
112```bash 70Library dependencies are listed in the [components](#components) table. The dependencies need to be satisfied for the components to be built. Note that if you don't have a dependency for some component, e.g. you don't have `libopus` installed required for building `toxav` component, building of that component is silently disabled.
113echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf
114sudo ldconfig
115```
116 71
117##### Compile toxcore 72#### Compiler requirements
118 73
119Then clone this repo, generate makefile, and install `toxcore` system-wide: 74The supported compilers are GCC, Clang and MinGW.
120 75
121```bash 76In theory, any compiler that fully supports C99 and accepts GCC flags should work.
122git clone https://github.com/TokTok/c-toxcore.git c-toxcore
123cd c-toxcore
124autoreconf -i
125./configure
126make
127sudo make install
128```
129 77
78There is a partial and experimental support of Microsoft Visual C++ compiler. We welcome any patches that help improve it.
130 79
131### OS X: 80You should have a C99 compatible compiler in order to build the main components. The secondary components might require the compiler to support GNU extensions.
132 81
133You need the latest XCode with the Developer Tools (Preferences -> Downloads -> Command Line Tools). 82#### Build system requirements
134The following libraries are required along with libsodium and cmake for Mountain Lion and XCode 4.6.3 install libtool, automake and autoconf. You can download them with Homebrew, or install them manually.
135 83
136**Note: OS X users can also install Toxcore using [osx_build_script_toxcore.sh](other/osx_build_script_toxcore.sh)** 84To build the main components you need to have CMake of at least 2.8.6 version installed. You also need to have pkg-config installed, the build system uses it to find dependency libraries.
137 85
138There are no binaries/executables going to /bin/ or /usr/bin/ now. Everything is compiled and ran from the inside your local branch. 86There is some experimental accommodation for building natively on Windows, i.e. without having to use MSYS/Cygwin and pkg-config, but it uses exact hardcoded paths for finding libraries and supports building only of some of toxcore components, so your mileage might vary.
139 87
140#### Homebrew: 88### CMake options
141To install from the formula:
142```bash
143brew tap Tox/tox
144brew install --HEAD libtoxcore
145```
146 89
147To do it manually: 90There are some options that are available to configure the build.
148```
149brew install libtool automake autoconf libsodium check
150```
151Then clone this repo and generate makefile:
152```bash
153git clone https://github.com/TokTok/c-toxcore.git c-toxcore
154cd c-toxcore
155autoreconf -i
156./configure
157make
158make install
159```
160 91
161If execution fails with errors like "dyld: Library not loaded: /opt/tox-im/lib/libtoxcore.0.dylib", you may need to specify libsodium path: 92| Name | Description | Expected Value | Default Value |
93|----------------------|-----------------------------------------------------------------------------------------------|--------------------------------------------|---------------------------------------------------|
94| ASAN | Enable address-sanitizer to detect invalid memory accesses. | ON or OFF | OFF |
95| BOOTSTRAP_DAEMON | Enable building of tox-bootstrapd, the DHT bootstrap node daemon. For Unix-like systems only. | ON or OFF | ON |
96| BUILD_AV_TEST | Build toxav test. | ON or OFF | ON |
97| BUILD_TOXAV | Whether to build the tox AV library. | ON or OFF | ON |
98| CMAKE_INSTALL_PREFIX | Path to where everything should be installed. | Directory path. | Platform-dependent. Refer to CMake documentation. |
99| DEBUG | Enable assertions and other debugging facilities. | ON or OFF | OFF |
100| DHT_BOOTSTRAP | Enable building of DHT_bootstrap | ON or OFF | ON |
101| ENABLE_SHARED | Build shared (dynamic) libraries for all modules. | ON or OFF | ON |
102| ENABLE_STATIC | Build static libraries for all modules. | ON or OFF | ON |
103| ERROR_ON_WARNING | Make compilation error on a warning. | ON or OFF | OFF |
104| FORMAT_TEST | Require the format_test to be executed; fail cmake if it can't. | ON or OFF | OFF |
105| STRICT_ABI | Enforce strict ABI export in dynamic libraries. | ON or OFF | OFF |
106| TEST_TIMEOUT_SECONDS | Limit runtime of each test to the number of seconds specified. | Positive number or nothing (empty string). | Empty string. |
107| TRACE | Enable TRACE level logging (expensive, for network debugging). | ON or OFF | OFF |
108| USE_IPV6 | Use IPv6 in tests. | ON or OFF | ON |
109| WARNINGS | Enable additional compiler warnings. | ON or OFF | ON |
162 110
163Determine paths: 111You can get this list of option using the following commands
164```
165brew list libsodium
166```
167 112
168Configure include and lib folder and build again: 113```sh
169```bash 114grep "option(" CMakeLists.txt cmake/*
170./configure --with-libsodium-headers=/usr/local/Cellar/libsodium/1.0.0/include/ --with-libsodium-libs=/usr/local/Cellar/libsodium/1.0.0/lib/ 115grep "set(.* CACHE" CMakeLists.txt cmake/*
171make
172make install
173``` 116```
174 117
118Note that some options might be considered only if other options are enabled.
175 119
176#### Non-homebrew: 120Example of calling cmake with options
177
178Grab the following packages:
179 * https://gnu.org/software/libtool/
180 * https://gnu.org/software/autoconf/
181 * https://gnu.org/software/automake/
182 * https://github.com/jedisct1/libsodium
183 * http://check.sourceforge.net/
184 * http://yasm.tortall.net/Download.html (install before libvpx)
185 * https://code.google.com/p/webm/downloads/list
186 * http://www.opus-codec.org/downloads/
187 * http://www.freedesktop.org/wiki/Software/pkg-config/
188
189Macports: (https://www.macports.org/)
190All toxcore dependencies can be installed from MacPorts. This is often easier on PowerPC Macs,
191and any version of OS X prior to 10.6, since Homebrew is supported on 10.6 and up, but not much
192(or at all) on older systems. A few packages have slightly different names from the corresponding
193package in Debian.
194
195Same: libtool autoconf automake libsodium check yasm
196Different: libvpx (webm) libopus pkgconfig gettext
197 121
198(the libintl, from gettext, built into OS X 10.5 is missing libintl_setlocale, but the Macports build has it) 122```sh
199 123cmake \
200Verify where libintl is on your system: (MacPorts puts it in /opt/local) 124 -D ENABLE_STATIC=OFF \
201``` 125 -D DEBUG=ON \
202for d in /usr/local/lib /opt/local/lib /usr/lib /lib; do ls -l $d/libintl.*; done 126 -D CMAKE_INSTALL_PREFIX=/opt \
127 -D TEST_TIMEOUT_SECONDS=120 \
128 ..
203``` 129```
204 130
205Check if that copy has libintl_setlocale: 131### Build process
206```
207nm /opt/local/lib/libintl.8.dylib | grep _libintl_setlocale
208```
209 132
210Certain other tools may not be installed, or outdated, and should also be installed from MacPorts for simplicity: git cmake 133#### Unix-like
211 134
212If libsodium was installed with MacPorts, you may want to symlink the copy in /opt/local/lib to /usr/local/lib. That way you don't need special configure switches for toxcore to find libsodium, and every time MacPorts updates libsodium, the new version will be linked to toxcore every time you build: 135Assuming all the [requirements](#requirements) are met, just run
213```
214ln -s /opt/local/lib/libsodium.dylib /usr/local/lib/libsodium.dylib
215ln -s /opt/local/include/sodium.h /usr/local/include
216ln -s /opt/local/include/sodium /usr/local/include/
217```
218
219Much of the build can then be done as for other platforms: git clone, and so on. Differences will be noted with (OS X 10.5 specific)
220
221pkg-config is important for enabling a/v support in tox core, failure to install pkg-config will prevent tox core form finding the required libopus/libvpx libraries. (pkg-config may not configure properly, if you get an error about GLIB, run configure with the following parameter, --with-internal-glib).
222
223Uncompress and install them all. Make sure to follow the README as the instructions change, but they all follow the same pattern below:
224
225```bash
226./configure
227make
228sudo make install
229```
230 136
231Compiling and installing Tox Core 137```sh
232 138mkdir _build
233```bash 139cd _build
234cd c-toxcore 140cmake ..
235autoreconf -i
236./configure (OS X 10.5 specific)
237./configure CC="gcc -arch ppc -arch i386" CXX="g++ -arch ppc -arch i386" CPP="gcc -E" CXXCPP="g++ -E"
238make
239make install (OS X 10.5 specific)
240should be: sudo make install
241If it worked, you should have all the toxcore dylibs in /usr/local/lib: (besides the four below, the rest are symlinks to these)
242$ ls -la /usr/local/lib/libtox*.dylib
243libtoxav.0.dylib
244libtoxcore.0.dylib
245libtoxencryptsave.0.dylib
246to check what CPU architecture they're compiled for:
247$ lipo -i /usr/local/lib/libtoxencryptsave.0.dylib
248You should now be able to move on to compiling Toxic/Venom or some other client application
249There is also a shell script called "osx_build_script_toxcore.txt" which automates everything from "git pull" to "sudo make install", once the dependencies are already taken care of by MacPorts.
250```
251
252If after running ./configure you get an error about core being unable to find libsodium (and you have installed it) run the following in place of ./configure;
253
254```
255./configure --with-libsodium-headers=/usr/local/include/ --with-libsodium-libs=/usr/local/lib
256```
257
258Ensure you set the locations correctly depending on where you installed libsodium on your computer.
259
260If there is a problem with opus (for A/V) and you don't get a libtoxav, then try to set the pkg-config environment variable beforehand:
261
262```
263export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
264```
265
266### Windows:
267
268#### Cross-compile
269
270It's a bit challenging to build Tox and all of its dependencies natively on Windows, so we will show an easier, less error and headache prone method of building it -- cross-compiling.
271
272##### Setting up a VM
273
274We will assume that you don't have any VM running Linux around and will guide you from the ground up.
275
276First, you would need to get a virtual machine and a Linux distribution image file.
277
278For a virtual machine we will use VirtualBox. You can get it [here](https://www.virtualbox.org/wiki/Downloads).
279
280For a Linux distribution we will use Lubuntu 14.04 32-bit, which you can get [here](https://help.ubuntu.com/community/Lubuntu/GetLubuntu).
281
282After you have those downloaded, install the VirtualBox and create a VM in it. The default of 512mb of RAM and 8gb of dynamically-allocated virtual hard drive would be enough.
283
284When you have created the VM, go into its **Settings** -> **System** -> **Processor** and add some cores, if you have any additional available, for faster builds.
285
286Then, go to **Settings** -> **Storage**, click on **Empty** under **Controller: IDE**, click on the little disc icon on the right side of the window, click on **Choose a virtual CD/DVD disk file** and select the downloaded Lubuntu image file.
287
288Start the VM and follow the installation instructions.
289
290After Lubuntu is installed and you have booted into it, in VirtualBox menu on top of the window select **Devices** -> **Insert Guest Additions CD image...**.
291
292Open terminal from **Lubuntu's menu** -> **Accessories**.
293
294Execute:
295```bash
296sudo apt-get update
297sudo apt-get install build-essential -y
298cd /media/*/*/
299sudo ./VBoxLinuxAdditions.run
300```
301
302After that, create a folder called `toxbuild` somewhere on your Windows system. The go to **Devices** -> **Shared Folders Settings...** in the VirtualBox menu, add the `toxbuild` folder there and set **Auto-mount** and **Make Permanent** options.
303
304Execute:
305```bash
306sudo adduser `whoami` vboxsf
307```
308Note the use of a [grave accent](http://en.wikipedia.org/wiki/Grave_accent) instead of an apostrophe.
309
310Then just reboot the system with:
311```bash
312sudo reboot
313```
314
315After the system is booted, go to **Devices** -> **Shared Clipboard** and select **Bidirectional**. Now you will be able to copy-paste text between the host and the guest systems.
316
317Now that the virtual machine is all set up, let's move to getting build dependencies and setting up environment variables.
318
319##### Setting up the environment
320
321First we will install all tools that we would need for building:
322```bash
323sudo apt-get install build-essential libtool autotools-dev automake checkinstall check git yasm pkg-config mingw-w64 -y
324```
325
326Then we will define a few variables, **depending on which you will build either 32-bit or 64-bit Tox**.
327
328For 32-bit Tox build, do:
329```bash
330WINDOWS_TOOLCHAIN=i686-w64-mingw32
331LIB_VPX_TARGET=x86-win32-gcc
332```
333
334For 64-bit Tox build, do:
335```bash
336WINDOWS_TOOLCHAIN=x86_64-w64-mingw32
337LIB_VPX_TARGET=x86_64-win64-gcc
338```
339
340This is the only difference between 32-bit and 64-bit build procedures.
341
342For speeding up the build process do:
343```
344MAKEFLAGS=j$(nproc)
345export MAKEFLAGS
346```
347
348And let's make a folder where we will be building everything at
349```bash
350cd ~
351mkdir prefix
352cd prefix
353PREFIX_DIR=$(pwd)
354cd ..
355mkdir build
356cd build
357```
358
359##### Compiling
360
361Now we will build libraries needed for audio/video: VPX and Opus.
362
363VPX:
364```bash
365git clone https://chromium.googlesource.com/webm/libvpx
366cd libvpx
367git checkout tags/v1.3.0
368CROSS="$WINDOWS_TOOLCHAIN"- ./configure --target="$LIB_VPX_TARGET" --prefix="$PREFIX_DIR" --disable-examples --disable-unit-tests --disable-shared --enable-static
369make
370make install
371cd ..
372```
373
374Opus:
375```bash
376wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
377tar -xf opus-1.1.tar.gz
378cd opus-1.1
379./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-extra-programs --disable-doc --disable-shared --enable-static
380make
381make install
382cd ..
383```
384
385Now we will build sodium crypto library:
386```bash
387git clone https://github.com/jedisct1/libsodium/
388cd libsodium
389git checkout tags/1.0.3
390./autogen.sh
391./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-shared --enable-static
392make
393make install
394cd ..
395```
396
397And finally we will build Tox:
398```bash
399git clone https://github.com/TokTok/c-toxcore.git c-toxcore
400cd c-toxcore
401./autogen.sh
402./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-tests --disable-testing --with-dependency-search="$PREFIX_DIR" --disable-shared --enable-static
403make 141make
404make install 142make install
405cd ..
406```
407
408Then we make Tox shared library:
409```bash
410cd "$PREFIX_DIR"
411mkdir tmp
412cd tmp
413$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxcore.a
414$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxav.a
415$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxencryptsave.a
416$WINDOWS_TOOLCHAIN-gcc -Wl,--export-all-symbols -Wl,--out-implib=libtox.dll.a -shared -o libtox.dll *.o ../lib/*.a /usr/$WINDOWS_TOOLCHAIN/lib/libwinpthread.a -liphlpapi -lws2_32 -static-libgcc
417``` 143```
418 144
419And we will copy it over to the `toxbuild` directory: 145#### Windows
420```bash
421mkdir -p /media/sf_toxbuild/release/lib
422cp libtox.dll.a /media/sf_toxbuild/release/lib
423mkdir -p /media/sf_toxbuild/release/bin
424cp libtox.dll /media/sf_toxbuild/release/bin
425mkdir -p /media/sf_toxbuild/release/include
426cp -r ../include/tox /media/sf_toxbuild/release/include
427```
428 146
429That's it. Now you should have `release/bin/libtox.dll`, `release/bin/libtox.dll.a` and `release/include/tox/<headers>` in your `toxbuild` directory on the Windows system. 147##### Building on Windows host
430 148
431#### Native 149###### Microsoft Visual Studio's Developer Command Prompt
432 150
433Note that the Native instructions are incomplete, in a sense that they miss instructions needed for adding audio/video support to Tox. You also might stumble upon some unknown MinGW+msys issues while trying to build it. 151There are currently no instructions on how to build toxcore on Windows host in Microsoft Visual Studio's Developer Command Prompt. Contribution of the instructions is welcome!
434 152
435You should install: 153###### MSYS/Cygwin
436 - [MinGW](http://sourceforge.net/projects/mingw/)
437 154
438When installing MinGW, make sure to select the MSYS option in the installer. 155There are currently no instructions on how to build toxcore on Windows host in MSYS/Cygwin. Contribution of the instructions is welcome!
439MinGW will install an "MinGW shell" (you should get a shortcut for it), make sure to perform all operations (i.e., generating/running configure script, compiling, etc.) from the MinGW shell.
440 156
441First download the source tarball from https://download.libsodium.org/libsodium/releases/ and build it. 157##### Cross-compiling from Linux
442Assuming that you got the libsodium-1.0.0.tar.gz release:
443```cmd
444tar -zxvf libsodium-1.0.0.tar.gz
445cd libsodium-1.0.0
446./configure
447make
448make install
449cd ..
450```
451 158
452You can also use a precompiled win32 binary of libsodium, however you will have to place the files in places where they can be found, i.e., dll's go to /bin headers to /include and libraries to /lib directories in your MinGW shell. 159These cross-compilation instructions were tested on and written for 64-bit Ubuntu 16.04. You could generalize them for any Linux system, the only requirements are that you have Docker version of >= 1.9.0 and you are running 64-bit system.
453 160
454Next, install toxcore library, should either clone this repo by using git, or just download a [zip of current Master branch](https://github.com/TokTok/c-toxcore/archive/master.zip) and extract it somewhere. 161The cross-compilation is fully automated by a parameterized [Dockerfile](/other/docker/windows/Dockerfile).
455 162
456Assuming that you now have the sources in the toxcore directory: 163Install Docker
457 164
458```cmd 165```sh
459cd c-toxcore 166apt-get update
460autoreconf -i 167apt-get install docker.io
461./configure
462make
463make install
464``` 168```
465 169
170Get the toxcore source code and navigate to `other/docker/windows`.
466 171
467## Additional 172Build the container image based on the Dockerfile. The following options are available to customize the building of the container image.
468
469### Advanced configure options:
470
471 - --prefix=/where/to/install
472 - --with-libsodium-headers=/path/to/libsodium/include/
473 - --with-libsodium-libs=/path/to/sodiumtest/lib/
474 - --enable-silent-rules less verbose build output (undo: "make V=1")
475 - --disable-silent-rules verbose build output (undo: "make V=0")
476 - --disable-tests build unit tests (default: auto)
477 - --disable-av disable A/V support (default: auto) see: [libtoxav](#libtoxav)
478 - --enable-daemon build DHT bootstrap daemon (default=no) see: [Bootstrap daemon](#bootstrap-daemon)
479 - --enable-dht-bootstrap build DHT bootstrap utility (default=disabled)
480 - --enable-shared[=PKGS] build shared libraries [default=yes]
481 - --enable-static[=PKGS] build static libraries [default=yes]
482 173
483### A/V support: 174| Name | Description | Expected Value | Default Value |
175|---------------------|----------------------------------------------------------------|-------------------------------------|---------------|
176| SUPPORT_ARCH_i686 | Support building 32-bit toxcore. | "true" or "false" (case sensitive). | true |
177| SUPPORT_ARCH_x86_64 | Support building 64-bit toxcore. | "true" or "false" (case sensitive). | true |
178| SUPPORT_TEST | Support running toxcore automated tests. | "true" or "false" (case sensitive). | false |
179| VERSION_CHECK | Version of libcheck. Needed only when SUPPORT_TEST is enabled. | Git branch name. | 0.12.0 |
180| VERSION_OPUS | Version of libopus to build toxcore with. | Git branch name. | v1.2.1 |
181| VERSION_SODIUM | Version of libsodium to build toxcore with. | Git branch name. | 1.0.16 |
182| VERSION_VPX | Version of libvpx to build toxcore with. | Git branch name. | v1.6.1 |
484 183
485#### libtoxav: 184Example of building a container image with options
486 185
487'libtoxav' is needed for A/V support and it's enabled by default. You can disable it by adding --disable-av argument to ./configure script like so: 186```sh
488```bash 187cd other/docker/windows
489./configure --disable-av 188docker build \
189 --build-arg SUPPORT_TEST=true \
190 --build-arg VERSION_CHECK=0.11.0 \
191 -t toxcore \
192 .
490``` 193```
491 194
492There are 2 dependencies required for libtoxav: libopus and libvpx. If they are not installed A/V support is dropped. 195Run the container to build toxcore. The following options are available to customize the running of the container image.
493 196
494Install on fedora: 197| Name | Description | Expected Value | Default Value |
495```bash 198|--------------------|------------------------------------------------------------------------------------------|-------------------------------------|--------------------------------------------------------------------|
496yum install opus-devel libvpx-devel 199| ALLOW_TEST_FAILURE | Don't stop if a test suite fails. | "true" or "false" (case sensitive). | false |
497``` 200| ENABLE_ARCH_i686 | Build 32-bit toxcore. The image should have been built with SUPPORT_ARCH_i686 enabled. | "true" or "false" (case sensitive). | true |
498 201| ENABLE_ARCH_x86_64 | Build 64-bit toxcore. The image should have been built with SUPPORT_ARCH_x86_64 enabled. | "true" or "false" (case sensitive). | true |
499Install on ubuntu: 202| ENABLE_TEST | Run the test suite. The image should have been built with SUPPORT_TEST enabled. | "true" or "false" (case sensitive). | false |
500```bash 203| EXTRA_CMAKE_FLAGS | Extra arguments to pass to the CMake command when building toxcore. | CMake options. | "-DWARNINGS=OFF -DBOOTSTRAP_DAEMON=OFF -DTEST_TIMEOUT_SECONDS=300" |
501sudo apt-get install libopus-dev libvpx-dev pkg-config
502```
503If you get the "Unable to locate package libopus-dev" message, add the following ppa and try again:
504```bash
505sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update && sudo apt-get dist-upgrade
506```
507 204
508Install from source (example for most unix-like OS's): 205Example of running the container with options
509 206
510libvpx: 207```sh
511```bash 208docker run \
512git clone https://chromium.googlesource.com/webm/libvpx 209 -e ENABLE_TEST=true \
513cd libvpx 210 -e ALLOW_TEST_FAILURE=true \
514./configure 211 -v /path/to/toxcore/sourcecode:/toxcore \
515make -j3 212 -v /path/to/where/output/build/result:/prefix \
516sudo make install 213 --rm \
517cd .. 214 toxcore
518``` 215```
519 216
520libopus: 217After the build succeeds, you should see the built toxcore libraries in `/path/to/where/output/build/result`.
521```bash
522wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz
523tar xvzf opus-1.0.3.tar.gz
524cd opus-1.0.3
525./configure
526make -j3
527sudo make install
528cd ..
529```
530 218
531### Bootstrap daemon: 219## Pre-built binaries
532 220
533Daemon is disabled by default. You can enable it by adding --enable-daemon argument to ./configure script like so: 221### Linux
534```bash
535./configure --enable-daemon
536```
537There is one dependency required for bootstrap daemon: `libconfig-dev` >= 1.4.
538 222
539Install on fedora: 223Toxcore is packaged by at least by the following distributions: ALT Linux, [Arch Linux](https://www.archlinux.org/packages/?q=toxcore), [Fedora](https://apps.fedoraproject.org/packages/toxcore), Mageia, openSUSE, PCLinuxOS, ROSA and Slackware, [according to the information from pkgs.org](https://pkgs.org/download/toxcore). Note that this list might be incomplete and some other distributions might package it too.
540```bash
541yum install libconfig-devel
542```
543 224
544Install on ubuntu: 225Debian and Ubuntu packages are available in [tox.chat's package repository](https://tox.chat/download.html#gnulinux).
545```bash
546sudo apt-get install libconfig-dev
547```
548 226
549OS X homebrew: 227### Windows
550``` 228
551brew install libconfig 229There are nightly cross-compiled binaries available on Jenkins.
552```
553OS X non-homebrew:
554Grab the following [package](http://www.hyperrealm.com/libconfig/), uncompress and install
555 230
556See this [readme](other/bootstrap_daemon/README.md) on how to set up the bootstrap daemon. 231| | Shared | Static |
232|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
233| 32-bit | [Download](https://build.tox.chat/job/libtoxcore-toktok_build_windows_x86_shared_release/lastSuccessfulBuild/artifact/libtoxcore-toktok_build_windows_x86_shared_release.zip) | [Download](https://build.tox.chat/job/libtoxcore-toktok_build_windows_x86_static_release/lastSuccessfulBuild/artifact/libtoxcore-toktok_build_windows_x86_static_release.zip) |
234| 64-bit | [Download](https://build.tox.chat/job/libtoxcore-toktok_build_windows_x86-64_shared_release/lastSuccessfulBuild/artifact/libtoxcore-toktok_build_windows_x86-64_shared_release.zip) | [Download](https://build.tox.chat/job/libtoxcore-toktok_build_windows_x86-64_static_release/lastSuccessfulBuild/artifact/libtoxcore-toktok_build_windows_x86-64_static_release.zip) |