summaryrefslogtreecommitdiff
path: root/INSTALL.md
blob: 14d2ef679315ca45f2b2dd33be70717763e9f179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
#Install Instructions

- [Installation](#installation)
  - [Unix like](#unix)
  - [OS X](#osx)
    - [Homebrew](#homebrew)
    - [Non-Homebrew](#non-homebrew)
  - [Windows](#windows)
    - [Cross-Compile](#windows-cross-compile)
      - [Setting up a VM](#windows-cross-compile-vm)
      - [Setting up the environment](#windows-cross-compile-environment)
      - [Compiling](#windows-cross-compile-compiling)
    - [Native](#windows-native)
- [Additional](#additional)
  - [Advanced configure options](#aconf)
  - [A/V support](#av)
    - [libtoxav](#libtoxav)
  - [Bootstrap daemon](#bootstrapd)
  - [nTox](#ntox)

<a name="installation" />
##Installation

<a name="unix" />
###Most Unix like OSes:

Build dependencies:

Note: package fetching commands may vary by OS.

On Ubuntu:

```bash
sudo apt-get install build-essential libtool autotools-dev automake checkinstall check git yasm
```

On Fedora:

```bash
yum groupinstall "Development Tools"
yum install libtool autoconf automake check check-devel
```

On SunOS:

```pfexcec
pkg install autoconf automake gcc-47
```
On FreeBSD 10+:

```tcsh
pkg install net-im/tox
```
Note, if you install from ports select NaCl for performance, and sodium if you want it to be portable.

**For A/V support, also install the dependences listed in the [libtoxav] (#libtoxav) section.**

You should get and install [libsodium](https://github.com/jedisct1/libsodium):
```bash
git clone git://github.com/jedisct1/libsodium.git
cd libsodium
git checkout tags/0.7.0
./autogen.sh
./configure && make check
sudo checkinstall --install --pkgname libsodium --pkgversion 0.7.0 --nodoc
sudo ldconfig
cd ..
```


Or if checkinstall is not easily available for your distribution (e.g., Fedora),
this will install the libs to /usr/local/lib and the headers to /usr/local/include:

```bash
git clone git://github.com/jedisct1/libsodium.git
cd libsodium
git checkout tags/0.7.0
./autogen.sh
./configure
make check
sudo make install
cd ..
```

If 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:
```
echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
sudo ldconfig
```

Then clone this repo and generate makefile:
```bash
git clone git://github.com/irungentoo/toxcore.git
cd toxcore
autoreconf -i
./configure
make
sudo make install
```


<a name="osx" />
###OS X:

You need the latest XCode with the Developer Tools (Preferences -> Downloads -> Command Line Tools).
The 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.

There are no binaries/executables going to /bin/ or /usr/bin/ now. Everything is compiled and ran from the inside your local branch. See [Usage](#usage) below.
<a name="homebrew" />
####Homebrew:
To install from the formula:
```bash
brew tap Tox/tox
brew install --HEAD libtoxcore
```

To do it manually:
```
brew install libtool automake autoconf libsodium check
```
Then clone this repo and generate makefile:
```bash
git clone git://github.com/irungentoo/toxcore.git
cd toxcore
autoreconf -i
./configure
make
make install
```

If execution fails with errors like "dyld: Library not loaded: /opt/tox-im/lib/libtoxcore.0.dylib", you may need to specify libsodium path:

Determine paths:
```
brew list libsodium
```

Configure include and lib folder and build again:
```bash
./configure --with-libsodium-headers=/usr/local/Cellar/libsodium/0.7.0/include/ --with-libsodium-libs=/usr/local/Cellar/libsodium/0.7.0/lib/
make
make install
```


<a name="non-homebrew" />
####Non-homebrew:

Grab the following packages:
  * https://gnu.org/software/libtool/
  * https://gnu.org/software/autoconf/
  * https://gnu.org/software/automake/
  * https://github.com/jedisct1/libsodium
  * http://check.sourceforge.net/
  * http://yasm.tortall.net/Download.html (install before libvpx)
  * https://code.google.com/p/webm/downloads/list
  * http://www.opus-codec.org/downloads/
  * http://www.freedesktop.org/wiki/Software/pkg-config/

Macports: (https://www.macports.org/)
All toxcore dependencies can be installed from MacPorts. This is often easier on PowerPC Macs,
and any version of OS X prior to 10.6, since Homebrew is supported on 10.6 and up, but not much
(or at all) on older systems. A few packages have slightly different names from the corresponding
package in Debian.

Same: libtool autoconf automake libsodium check yasm
Different: libvpx (webm) libopus pkgconfig gettext

(the libintl, from gettext, built into OS X 10.5 is missing libintl_setlocale, but the Macports build has it)

Verify where libintl is on your system: (MacPorts puts it in /opt/local)
$ for d in /usr/local/lib /opt/local/lib /usr/lib /lib; do ls -l $d/libintl.*; done

Check if that copy has libintl_setlocale:
nm /opt/local/lib/libintl.8.dylib | grep _libintl_setlocale

Certain other tools may not be installed, or outdated, and should also be installed from MacPorts for simplicity: git cmake

If 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:
ln -s /opt/local/lib/libsodium.dylib /usr/local/lib/libsodium.dylib

Much 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)

pkg-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).

Uncompress and install them all. Make sure to follow the README as the instructions change, but they all follow the same pattern below:

```bash
./configure
make
sudo make install
```

Compiling and installing Tox Core

```bash
cd toxcore
autoreconf -i
./configure (OS X 10.5 specific)
./configure CC="gcc -arch ppc -arch i386" CXX="g++ -arch ppc -arch i386" CPP="gcc -E" CXXCPP="g++ -E"
make
make install (OS X 10.5 specific)
should be: sudo make install
If it worked, you should have all the toxcore dylibs in /usr/local/lib: (besides the four below, the rest are symlinks to these)
$ ls -la /usr/local/lib/libtox*.dylib
libtoxav.0.dylib
libtoxcore.0.dylib
libtoxdns.0.dylib
libtoxencryptsave.0.dylib
to check what CPU architecture they're compiled for:
$ lipo -i /usr/local/lib/libtoxencryptsave.0.dylib
You should now be able to move on to compiling Toxic/Venom or some other client application
There 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.
```

If 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;

./configure --with-libsodium-headers=/usr/local/include/ --with-libsodium-libs=/usr/local/lib

Ensure you set the locations correctly depending on where you installed libsodium on your computer.

If 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:

```
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
```

<a name="windows" />
###Windows:

<a name="windows-cross-compile" />

####Cross-compile

It's a bit challenging to build Tox and all of its dependencies nativly on Windows, so we will show an easier, less error and headache prone method of building it -- cross-compiling.

<a name="windows-cross-compile-vm" />
#####Setting up a VM

We will assume that you don't have any VM running Linux around and will guide you from the ground up.

First, you would need to get a virtual machine and a Linux distribution image file.

For a virtual machine we will use VirtualBox. You can get it [here](https://www.virtualbox.org/wiki/Downloads).

For a Linux distribution we will use Lubuntu 14.04 32-bit, which you can get [here](https://help.ubuntu.com/community/Lubuntu/GetLubuntu).

After 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.

When you have created the VM, go into its **Settings** -> **System** -> **Processor** and add some cores, if you have any additional available, for faster builds.

Then, 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.

Start the VM and follow the installation instructions.

After Lubuntu is installed and you have booted into it, in VirtualBox menu on top of the window select **Devices** -> **Insert Guest Additions CD image...**.

Open terminal from **Lubuntu's menu** -> **Accessories**.

Execute:
```bash
sudo apt-get update
sudo apt-get install build-essential -y
cd /media/*/*/
sudo ./VBoxLinuxAdditions.run
```

After 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.

Execute:
```bash
sudo adduser `whoami` vboxsf
```
Note the use of a [grave accent](http://en.wikipedia.org/wiki/Grave_accent) instead of an apostrophe.

Then just reboot the system with:
```bash
sudo reboot
```

After 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.

Now that the virtual machine is all set up, let's move to getting build dependencies and setting up environment variables.

<a name="windows-cross-compile-environment" />
#####Setting up the environment

First we will install all tools that we would need for building:
```bash
sudo apt-get install build-essential libtool autotools-dev automake checkinstall check git yasm pkg-config mingw-w64 -y
```

Then we will define a few variables, **depending on which you will build either 32-bit or 64-bit Tox**.

For 32-bit Tox build, do:
```bash
WINDOWS_TOOLCHAIN=i686-w64-mingw32
LIB_VPX_TARGET=x86-win32-gcc
```

For 64-bit Tox build, do:
```bash
WINDOWS_TOOLCHAIN=x86_64-w64-mingw32
LIB_VPX_TARGET=x86_64-win64-gcc
```

This is the only difference between 32-bit and 64-bit build procedures.

For speeding up the build process do:
```
MAKEFLAGS=j$(nproc)
export MAKEFLAGS
```

And let's make a folder where we will be building everything at
```bash
cd ~
mkdir prefix
cd prefix
PREFIX_DIR=$(pwd)
cd ..
mkdir build
cd build
```

<a name="windows-cross-compile-compiling" />
#####Compiling

Now we will build libraries needed for audio/video: VPX and Opus.

VPX:
```bash
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
git checkout tags/v1.3.0
CROSS="$WINDOWS_TOOLCHAIN"- ./configure --target="$LIB_VPX_TARGET" --prefix="$PREFIX_DIR" --disable-examples --disable-unit-tests --disable-shared --enable-static
make
make install
cd ..
```

Opus:
```bash
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
tar -xf opus-1.1.tar.gz
cd opus-1.1
./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-extra-programs --disable-doc --disable-shared --enable-static
make
make install
cd ..
```

Now we will build sodium crypto library:
```bash
git clone https://github.com/jedisct1/libsodium/
cd libsodium
git checkout tags/0.7.0
./autogen.sh
./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-shared --enable-static
make
make install
cd ..
```

And finally we will build Tox:
```bash
git clone https://github.com/irungentoo/toxcore
cd toxcore
./autogen.sh
./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-ntox --disable-tests --disable-testing --with-dependency-search="$PREFIX_DIR" --disable-shared --enable-static
make
make install
cd ..
```

Then we make Tox shared library:
```bash
cd "$PREFIX_DIR"
mkdir tmp
cd tmp
$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxcore.a
$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxav.a
$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxdns.a
$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxencryptsave.a
$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
```

And we will copy it over to the `toxbuild` directory:
```bash
mkdir -p /media/sf_toxbuild/release/lib
cp libtox.dll.a /media/sf_toxbuild/release/lib
mkdir -p /media/sf_toxbuild/release/bin
cp libtox.dll /media/sf_toxbuild/release/bin
mkdir -p /media/sf_toxbuild/release/include
cp -r ../include/tox /media/sf_toxbuild/release/include
```

That'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.

<a name="windows-native" />
####Native

Note 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.

You should install:
  - [MinGW](http://sourceforge.net/projects/mingw/)

When installing MinGW, make sure to select the MSYS option in the installer.
MinGW 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.

First download the source tarball from https://download.libsodium.org/libsodium/releases/ and build it.
Assuming that you got the libsodium-0.7.0.tar.gz release:
```cmd
tar -zxvf libsodium-0.7.0.tar.gz
cd libsodium-0.7.0
./configure
make
make install
cd ..
```

You 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.

Next, install toxcore library, should either clone this repo by using git, or just download a [zip of current Master branch](https://github.com/irungentoo/toxcore/archive/master.zip) and extract it somewhere.

Assuming that you now have the sources in the toxcore directory:

```cmd
cd toxcore
autoreconf -i
./configure
make
make install
```

<a name="Clients" />
####Clients:
While [Toxic](https://github.com/tox/toxic) is no longer in core, a list of Tox clients are located in our [wiki](http://wiki.tox.im/client)





<a name="additional" />
##Additional



<a name="aconf" />
###Advanced configure options:

  - --prefix=/where/to/install
  - --with-libsodium-headers=/path/to/libsodium/include/
  - --with-libsodium-libs=/path/to/sodiumtest/lib/
  - --enable-silent-rules less verbose build output (undo: "make V=1")
  - --disable-silent-rules verbose build output (undo: "make V=0")
  - --disable-tests build unit tests (default: auto)
  - --disable-av disable A/V support (default: auto) see: [libtoxav](#libtoxav)
  - --enable-ntox build nTox client (default: no) see: [nTox](#ntox)
  - --enable-daemon build DHT bootstrap daemon (default=no) see: [Bootstrap daemon](#bootstrapd)
  - --enable-shared[=PKGS]  build shared libraries [default=yes]
  - --enable-static[=PKGS]  build static libraries [default=yes]


<a name="av" />
###A/V support:

<a name="libtoxav" />
####libtoxav:

'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:
```bash
./configure --disable-av
```

There are 2 dependencies required for libtoxav: libopus and libvpx. If they are not installed A/V support is dropped.

Install on fedora:
```bash
yum install libopus-devel libvpx-devel
```

Install on ubuntu:
```bash
sudo apt-get install libopus-dev libvpx-dev
```
If you get the "Unable to locate package libopus-dev" message, add the following ppa and try again:
```bash
sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update && sudo apt-get dist-upgrade
```

Install from source (example for most unix-like OS's):

libvpx:
```bash
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure
make -j3
sudo make install
cd ..
```

libopus:
```bash
wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz
tar xvzf opus-1.0.3.tar.gz
cd opus-1.0.3
./configure
make -j3
sudo make install
cd ..
```

<a name="bootstrapd" />
###Bootstrap daemon:

Daemon is disabled by default. You can enable it by adding --enable-daemon argument to ./configure script like so:
```bash
./configure --enable-daemon
```
There is one dependency required for bootstrap daemon: `libconfig-dev` >= 1.4.

Install on fedora:
```bash
yum install libconfig-devel
```

Install on ubuntu:
```bash
sudo apt-get install libconfig-dev
```

OS X homebrew:
```
brew install libconfig
```
OS X non-homebrew:
Grab the following [package] (http://www.hyperrealm.com/libconfig/), uncompress and install

See this [readme](other/bootstrap_daemon/README.md) on how to set up the bootstrap daemon.


<a name="ntox" />
###nTox test cli:

nTox is disabled by default. You can enable it by adding --enable-ntox argument to ./configure script like so:
```bash
./configure --enable-ntox
```
There is one dependency required for nTox: libncurses.

Install on fedora:
```bash
yum install ncurses-devel
```

Install on ubuntu:
```bash
sudo apt-get install ncurses-dev
```