5 :Author: Arvid Norberg, arvid@rasterbar.com
7 .. contents:: Table of contents
11 downloading and building
12 ========================
14 To acquire the latest version of libtorrent, you'll have to grab it from SVN.
15 You'll find instructions on how to do this here__ (see subversion access).
17 __ http://sourceforge.net/svn/?group_id=79942
19 The build systems supported "out of the box" in libtorrent are boost-build v2
20 (BBv2) and autotools (for unix-like systems). If you still can't build after
21 following these instructions, you can usually get help in the ``#libtorrent``
22 IRC channel on ``irc.freenode.net``.
24 Community contributed build tutorials can be found on the wiki_.
26 .. _wiki: http://code.rasterbar.com/libtorrent/wiki/Building
31 To build libtorrent from svn you need to check out the libtorrent sources from
32 sourceforge and also check out the asio sources from its sourceforge cvs.
33 If you downloaded a release tarball, you can skip this section.
35 To prepare the directory structure for building, follow these steps:
37 * Check out libtorrent (instructions__).
38 * Check out asio (instructions__).
39 * Copy the ``asio/include/asio/`` directory into the ``libtorrent/include/libtorrent/``
40 directory. Alternatively you can make a symbolic link.
41 * Copy ``asio/include/asio.hpp`` into ``libtorrent/include/libtorrent``.
43 __ http://sourceforge.net/svn/?group_id=79942
44 __ http://sourceforge.net/cvs/?group_id=122478
46 Now the libtorrent directory is ready for building. Follow the steps in one
47 of the following sections depending on which build system you prefer to use.
52 The primary reason to use boost-build is that it will automatically build the
53 dependent boost libraries with the correct compiler settings, in order to
54 ensure that the build targets are link compatible (see `boost guidelines`__
55 for some details on this issue).
57 __ http://boost.org/more/separate_compilation.html
59 Since BBv2 will build the boost libraries for you, you need the full boost
60 source package. Having boost installed via some package system is usually not
61 enough (and even if it is enough, the necessary environment variables are
62 usually not set by the package installer).
64 If you want to build against an installed copy of boost, you can skip directly
65 to step 3 (assuming you also have boost build installed).
68 Step 1: Download boost
69 ~~~~~~~~~~~~~~~~~~~~~~
71 You'll find boost here__.
73 __ http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041&release_id=619445
75 Extract the archive to some directory where you want it. For the sake of this
76 guide, let's assume you extract the package to ``c:\boost_1_34_0`` (I'm using
77 a windows path in this example since if you're on linux/unix you're more likely
78 to use the autotools). You'll need at least version 1.34 of the boost library
79 in order to build libtorrent.
85 First you need to build ``bjam``. You do this by opening a terminal (In
86 windows, run ``cmd``). Change directory to
87 ``c:\boost_1_34_0\tools\jam\src``. Then run the script called
88 ``build.bat`` or ``build.sh`` on a unix system. This will build ``bjam`` and
89 place it in a directory starting with ``bin.`` and then have the name of your
90 platform. Copy the ``bjam.exe`` (or ``bjam`` on a unix system) to a place
91 that's in you shell's ``PATH``. On linux systems a place commonly used may be
92 ``/usr/local/bin`` or on windows ``c:\windows`` (you can also add directories
93 to the search paths by modifying the environment variable called ``PATH``).
95 Now you have ``bjam`` installed. ``bjam`` can be considered an interpreter
96 that the boost-build system is implemented on. So boost-build uses ``bjam``.
97 So, to complete the installation you need to make two more things. You need to
98 set the environment variable ``BOOST_BUILD_PATH``. This is the path that tells
99 ``bjam`` where it can find boost-build, your configuration file and all the
100 toolsets (descriptions used by boost-build to know how to use different
101 compilers on different platforms). Assuming the boost install path above, set
102 it to ``c:\boost_1_34_0\tools\build\v2``.
104 To set an environment variable in windows, type for example::
106 set BOOST_BUILD_PATH=c:\boost_1_34_0\tools\build\v2
108 In a terminal window.
110 The last thing to do to complete the setup of BBv2 is to modify your
111 ``user-config.jam`` file. It is located in ``c:\boost_1_34_0\tools\build\v2``.
112 Depending on your platform and which compiler you're using, you should add a
113 line for each compiler and compiler version you have installed on your system
114 that you want to be able to use with BBv2. For example, if you're using
115 Microsoft Visual Studio 7.1 (2003), just add a line::
119 If you use GCC, add the line::
123 If you have more than one version of GCC installed, you can add the
124 commandline used to invoke g++ after the version number, like this::
126 using gcc : 3.3 : g++-3.3 ;
127 using gcc : 4.0 : g++-4.0 ;
129 Another toolset worth mentioning is the ``darwin`` toolset (For MacOS X).
130 From Tiger (10.4) MacOS X comes with both GCC 3.3 and GCC 4.0. Then you can
131 use the following toolsets::
133 using darwin : 3.3 : g++-3.3 ;
134 using darwin : 4.0 : g++-4.0 ;
136 Note that the spaces around the semi-colons and colons are important!
138 Also see the `official installation instructions`_.
140 .. _`official installation instructions`: http://www.boost.org/doc/html/bbv2/installation.html
143 Step 3: Building libtorrent
144 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
146 When building libtorrent, the ``Jamfile`` expects the environment variable
147 ``BOOST_ROOT`` to be set to the boost installation directory. It uses this to
148 find the boost libraries it depends on, so they can be built and their headers
149 files found. So, set this to ``c:\boost_1_34_0``. You only need this if you're
150 building against a source distribution of boost.
152 Then the only thing left is simply to invoke ``bjam``. If you want to specify
153 a specific toolset to use (compiler) you can just add that to the commandline.
156 bjam msvc-7.1 boost=source
157 bjam gcc-3.3 boost=source
158 bjam darwin-4.0 boost=source
160 If you're building against a system installed boost, specify ``boost=system``.
162 To build different versions you can also just add the name of the build
163 variant. Some default build variants in BBv2 are ``release``, ``debug``,
166 You can build libtorrent as a dll too, by typing ``link=shared``, or
167 ``link=static`` to build a static library.
169 If you want to explicitly say how to link against the runtime library, you
170 can set the ``runtime-link`` feature on the commandline, either to ``shared``
171 or ``static``. Most operating systems will only allow linking shared against
172 the runtime, but on windows you can do both. Example::
174 bjam msvc-7.1 link=static runtime-link=static boost=source
178 If you link statically to the runtime library, you cannot build libtorrent
179 as a shared library (DLL), since you will get separate heaps in the library
180 and in the client application. It will result in crashes and possibly link
185 With boost-build V2 (Milestone 11), the darwin toolset uses the ``-s`` linker
186 option to strip debug symbols. This option is buggy in Apple's GCC, and
187 will make the executable crash on startup. On Mac OS X, instead build
188 your release executables with the ``debug-symbols=on`` option, and
189 later strip your executable with ``strip``.
193 Some linux systems requires linking against ``librt`` in order to access
194 the POSIX clock functions. If you get an error complaining about a missing
195 symbol ``clock_gettime``, you have to give ``need-librt=yes`` on the
196 bjam command line. This will make libtorrent link against ``librt``.
198 The build targets are put in a directory called bin, and under it they are
199 sorted in directories depending on the toolset and build variant used.
201 To build the examples, just change directory to the examples directory and
202 invoke ``bjam`` from there. To build and run the tests, go to the test
203 directory and run ``bjam``.
205 Note that if you're building on windows using the ``msvc`` toolset, you cannot run it
206 from a cygwin terminal, you'll have to run it from a ``cmd`` terminal. The same goes for
207 cygwin, if you're building with gcc in cygwin you'll have to run it from a cygwin terminal.
208 Also, make sure the paths are correct in the different environments. In cygwin, the paths
209 (``BOOST_BUILD_PATH`` and ``BOOST_ROOT``) should be in the typical unix-format (e.g.
210 ``/cygdrive/c/boost_1_34_0``). In the windows environment, they should have the typical
211 windows format (``c:/boost_1_34_0``).
213 The ``Jamfile`` will define ``NDEBUG`` when it's building a release build.
214 For more build configuration flags see `Build configurations`_.
218 +--------------------------+----------------------------------------------------+
219 | boost build feature | values |
220 +==========================+====================================================+
221 | ``boost`` | * ``system`` - default. Tells the Jamfile that |
222 | | boost is installed and should be linked against |
223 | | the system libraries. |
224 | | * ``source`` - Specifies that boost is to be built |
225 | | from source. The environment variable |
226 | | ``BOOST_ROOT`` must be defined to point to the |
227 | | boost directory. |
228 +--------------------------+----------------------------------------------------+
229 | ``boost-link`` | * ``static`` - links statically against the boost |
231 | | * ``shared`` - links dynamically against the boost |
233 +--------------------------+----------------------------------------------------+
234 | ``logging`` | * ``none`` - no logging. |
235 | | * ``default`` - basic session logging. |
236 | | * ``verbose`` - verbose peer wire logging. |
237 | | * ``errors`` - like verbose, but limited to errors.|
238 +--------------------------+----------------------------------------------------+
239 | ``dht-support`` | * ``on`` - build with support for tracker less |
240 | | torrents and DHT support. |
241 | | * ``logging`` - build with DHT support and verbose |
242 | | logging of the DHT protocol traffic. |
243 | | * ``off`` - build without DHT support. |
244 +--------------------------+----------------------------------------------------+
245 | ``need-librt`` | * ``no`` - this platform does not need to link |
246 | | against librt to have POSIX time functions. |
247 | | * ``yes`` - specify this if your linux system |
248 | | requires you to link against librt.a. This is |
249 | | typically the case on x86 64 bit systems. |
250 +--------------------------+----------------------------------------------------+
251 | ``zlib`` | * ``system`` - links against the zlib supplied |
252 | | with your operating system. |
253 | | * ``shipped`` - links against the zlib bundled |
254 | | with the libtorrent package. |
255 +--------------------------+----------------------------------------------------+
256 | ``geoip`` | * ``off`` - geo ip lookups disabled |
257 | | * ``static`` - MaxMind_ geo ip lookup code linked |
258 | | in statically. Note that this code is under |
260 | | * ``shared`` - The MaxMind_ geo ip lookup library |
261 | | is expected to be installed on the system and |
262 | | it will be used. |
263 +--------------------------+----------------------------------------------------+
264 | ``upnp-logging`` | * ``off`` - default. Does not log UPnP traffic. |
265 | | * ``on`` - creates "upnp.log" with the messages |
266 | | sent to and received from UPnP devices. |
267 +--------------------------+----------------------------------------------------+
268 | ``openssl`` | * ``pe`` - turns on support for encrypted |
269 | | connections. requires openssl (libcrypto) |
270 | | * ``sha-1`` - openssl will be used instead of the |
271 | | public domain SHA-1 implementation shipped with |
272 | | libtorrent. ``libcrypto.a`` will be required for |
273 | | linking. Encryption support is still turned off. |
274 | | * ``off`` - turns off support for encrypted |
275 | | connections. openssl is not linked in. The |
276 | | shipped public domain SHA-1 implementation is |
278 +--------------------------+----------------------------------------------------+
279 | ``pool-allocators`` | * ``on`` - default, uses pool allocators for send |
281 | | * ``off`` - uses ``malloc()`` and ``free()`` |
282 | | instead. Might be useful to debug buffer issues |
283 | | with tools like electric fence or libgmalloc. |
284 +--------------------------+----------------------------------------------------+
285 | ``link`` | * ``static`` - builds libtorrent as a static |
286 | | library (.a / .lib) |
287 | | * ``shared`` - builds libtorrent as a shared |
288 | | library (.so / .dll). |
289 +--------------------------+----------------------------------------------------+
290 | ``runtime-link`` | * ``static`` - links statically against the |
291 | | run-time library (if available on your |
293 | | * ``shared`` - link dynamically against the |
294 | | run-time library (default). |
295 +--------------------------+----------------------------------------------------+
296 | ``variant`` | * ``debug`` - builds libtorrent with debug |
297 | | information and invariant checks. |
298 | | * ``release`` - builds libtorrent in release mode |
299 | | without invariant checks and with optimization. |
300 | | * ``profile`` - builds libtorrent with profile |
302 +--------------------------+----------------------------------------------------+
303 | ``character-set`` | This setting will only have an affect on windows. |
304 | | Other platforms are expected to support UTF-8. |
306 | | * ``unicode`` - The unicode version of the win32 |
307 | | API is used. This is default. |
308 | | * ``ansi`` - The ansi version of the win32 API is |
310 +--------------------------+----------------------------------------------------+
311 | ``invariant-checks`` | This setting only affects debug builds (where |
312 | | ``NDEBUG`` is not defined). It defaults to ``on``. |
314 | | * ``on`` - internal invariant checks are enabled. |
315 | | * ``off`` - internal invariant checks are |
316 | | disabled. The resulting executable will run |
317 | | faster than a regular debug build. |
318 | | * ``full`` - turns on extra expensive invariant |
320 +--------------------------+----------------------------------------------------+
321 | ``debug-symbols`` | * ``on`` - default for debug builds. This setting |
322 | | is useful for building release builds with |
324 | | * ``off`` - default for release builds. |
325 +--------------------------+----------------------------------------------------+
326 | ``deprecated-functions`` | * ``on`` - default. Includes deprecated functions |
327 | | of the API (might produce warnings during build |
328 | | when deprecated functions are used). |
329 | | * ``off`` - excludes deprecated functions from the |
330 | | API. Generates build errors when deprecated |
331 | | functions are used. |
332 +--------------------------+----------------------------------------------------+
334 .. _MaxMind: http://www.maxmind.com/app/api
336 The ``variant`` feature is *implicit*, which means you don't need to specify
337 the name of the feature, just the value.
339 The logs created when building vlog or log mode are put in a directory called
340 ``libtorrent_logs`` in the current working directory.
342 When building the example client on windows, you need to build with
343 ``link=static`` otherwise you may get unresolved external symbols for some
344 boost.program-options symbols.
346 For more information, see the `Boost build v2 documentation`__, or more
347 specifically `the section on builtin features`__.
349 __ http://www.boost.org/tools/build/v2/index.html
350 __ http://www.boost.org/doc/html/bbv2/reference.html#bbv2.advanced.builtins.features
353 building with autotools
354 -----------------------
356 First of all, you need to install ``automake`` and ``autoconf``. Many
357 unix/linux systems comes with these preinstalled.
359 The prerequisites for building libtorrent are boost.thread, boost.date_time
360 and boost.filesystem. Those are the *compiled* boost libraries needed. The
361 headers-only libraries needed include (but is not necessarily limited to)
362 boost.bind, boost.ref, boost.multi_index, boost.optional, boost.lexical_cast,
363 boost.integer, boost.iterator, boost.tuple, boost.array, boost.function,
364 boost.smart_ptr, boost.preprocessor, boost.static_assert.
366 If you want to build the ``client_test`` example, you'll also need boost.regex
367 and boost.program_options.
369 Step 1: Generating the build system
370 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
372 No build system is present if libtorrent is checked out from CVS - it
373 needs to be generated first. If you're building from a released tarball,
374 you may skip directly to `Step 2: Running configure`_.
376 Execute the following commands, in the given order, to generate
381 libtoolize --copy --force
382 automake --add-missing --copy --gnu
385 On darwin/OSX you have to run ``glibtoolize`` instead of ``libtoolize``.
387 Step 2: Running configure
388 ~~~~~~~~~~~~~~~~~~~~~~~~~
390 In your shell, change directory to the libtorrent directory and run
391 ``./configure``. This will look for libraries and C++ features that libtorrent
392 is dependent on. If something is missing or can't be found it will print an
393 error telling you what failed.
395 The most likely problem you may encounter is that the configure script won't
396 find the boost libraries. Make sure you have boost installed on your system.
397 The easiest way to install boost is usually to use the preferred package
398 system on your platform. Usually libraries and headers are installed in
399 standard directories where the compiler will find them, but sometimes that
400 may not be the case. For example when installing boost on darwin using
401 darwinports (the package system based on BSD ports) all libraries are
402 installed to ``/opt/local/lib`` and headers are installed to
403 ``/opt/local/include``. By default the compiler will not look in these
404 directories. You have to set the enviornment variables ``LDFLAGS`` and
405 ``CXXFLAGS`` in order to make the compiler find those libs. In this example
406 you'd set them like this::
408 export LDFLAGS=-L/opt/local/lib
409 export CXXFLAGS=-I/opt/local/include
411 It was observed on FreeBSD (release 6.0) that one needs to add '-lpthread' to
412 LDFLAGS, as Boost::Thread detection will fail without it, even if
413 Boost::Thread is installed.
415 If you need to set these variables, it may be a good idea to add those lines
416 to your ``~/.profile`` or ``~/.tcshrc`` depending on your shell.
418 If the boost libraries are named with a suffix on your platform, you may use
419 the ``--with-boost-thread=`` option to specify the suffix used for the thread
420 library in this case. For more information about these options, run::
424 On gentoo the boost libraries that are built with multi-threading support have
427 You know that the boost libraries were found if you see the following output
428 from the configure script::
430 checking whether the Boost::DateTime library is available... yes
431 checking for main in -lboost_date_time... yes
432 checking whether the Boost::Filesystem library is available... yes
433 checking for main in -lboost_filesystem... yes
434 checking whether the Boost::Thread library is available... yes
435 checking for main in -lboost_thread... yes
437 Another possible source of problems may be if the path to your libtorrent
438 directory contains spaces. Make sure you either rename the directories with
439 spaces in their names to remove the spaces or move the libtorrent directory.
441 Creating a debug build
442 ~~~~~~~~~~~~~~~~~~~~~~
444 To tell configure to build a debug version (with debug info, asserts
445 and invariant checks enabled), you have to run the configure script
446 with the following option::
448 ./configure --enable-debug=yes
450 Creating a release build
451 ~~~~~~~~~~~~~~~~~~~~~~~~
453 To tell the configure to build a release version (without debug info,
454 asserts and invariant checks), you have to run the configure script
455 with the following option::
457 ./configure --enable-debug=no
459 The above option make use of -DNDEBUG, which is used throughout libtorrent.
461 Step 3: Building libtorrent
462 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
464 Once the configure script is run successfully, you just type ``make`` and
465 libtorrent, the examples and the tests will be built.
467 When libtorrent is built it may be a good idea to run the tests, you do this
468 by running ``make check``.
470 If you want to build a release version (without debug info, asserts and
471 invariant checks), you have to rerun the configure script and rebuild, like this::
473 ./configure --disable-debug
477 building with other build systems
478 ---------------------------------
480 If you're making your own project file, note that there are two versions of
481 the file abstraction. There's one ``file_win.cpp`` which relies on windows
482 file API that supports files larger than 2 Gigabytes. This does not work in
483 vc6 for some reason, possibly because it may require windows NT and above.
484 The other file, ``file.cpp`` is the default implementation that simply relies
485 on the standard low level io routines (``read()``, ``write()``, ``open()``
486 etc.), this implementation doesn't do anything special to support unicode
487 filenames, so if your target is Windows 2000 and up, you may want to use
488 ``file_win.cpp`` which supports unicode filenames.
490 If you're building in MS Visual Studio, you may have to set the compiler
491 options "force conformance in for loop scope", "treat wchar_t as built-in
492 type" and "Enable Run-Time Type Info" to Yes. For a detailed description
493 on how to build libtorrent with VS, see `the wiki`_.
495 .. _`the wiki`: http://code.rasterbar.com/libtorrent/wiki/Building
500 By default libtorrent is built In debug mode, and will have pretty expensive
501 invariant checks and asserts built into it. If you want to disable such checks
502 (you want to do that in a release build) you can see the table below for which
503 defines you can use to control the build.
505 +----------------------------------------+-------------------------------------------------+
506 | macro | description |
507 +========================================+=================================================+
508 | ``NDEBUG`` | If you define this macro, all asserts, |
509 | | invariant checks and general debug code will be |
510 | | removed. Since there is quite a lot of code in |
511 | | in header files in libtorrent, it may be |
512 | | important to define the symbol consistently |
513 | | across compilation units, including the clients |
514 | | files. Potential problems is different |
515 | | compilation units having different views of |
516 | | structs and class layouts and sizes. |
517 +----------------------------------------+-------------------------------------------------+
518 | ``TORRENT_LOGGING`` | This macro will enable logging of the session |
519 | | events, such as tracker announces and incoming |
520 | | connections (as well as blocked connections). |
521 +----------------------------------------+-------------------------------------------------+
522 | ``TORRENT_DISABLE_GEO_IP`` | This is defined by default by the Jamfile. It |
523 | | disables the GeoIP features, and avoids linking |
524 | | against LGPL:ed code. |
525 +----------------------------------------+-------------------------------------------------+
526 | ``TORRENT_VERBOSE_LOGGING`` | If you define this macro, every peer connection |
527 | | will log its traffic to a log file as well as |
528 | | the session log. |
529 +----------------------------------------+-------------------------------------------------+
530 | ``TORRENT_STORAGE_DEBUG`` | This will enable extra expensive invariant |
531 | | checks in the storage, including logging of |
533 +----------------------------------------+-------------------------------------------------+
534 | ``TORRENT_UPNP_LOGGING`` | Generates a "upnp.log" file with the UPnP |
535 | | traffic. This is very useful when debugging |
536 | | support for various UPnP routers. |
537 | | support for various UPnP routers. |
538 +----------------------------------------+-------------------------------------------------+
539 | ``TORRENT_DISK_STATS`` | This will create a log of all disk activity |
540 | | which later can parsed and graphed using |
541 | | ``parse_disk_log.py``. |
542 +----------------------------------------+-------------------------------------------------+
543 | ``TORRENT_STATS`` | This will generate a log with transfer rates, |
544 | | downloading torrents, seeding torrents, peers, |
545 | | connecting peers and disk buffers in use. The |
546 | | log can be parsed and graphed with |
547 | | ``parse_session_stats.py``. |
548 +----------------------------------------+-------------------------------------------------+
549 | ``UNICODE`` | If building on windows this will make sure the |
550 | | UTF-8 strings in pathnames are converted into |
551 | | UTF-16 before they are passed to the file |
553 +----------------------------------------+-------------------------------------------------+
554 | ``LITTLE_ENDIAN`` | This will use the little endian version of the |
555 | | sha-1 code. If defined on a big-endian system |
556 | | the sha-1 hashes will be incorrect and fail. |
557 | | If it is not defined and ``__BIG_ENDIAN__`` |
558 | | isn't defined either (it is defined by Apple's |
559 | | GCC) both little-endian and big-endian versions |
560 | | will be built and the correct code will be |
561 | | chosen at run-time. |
562 +----------------------------------------+-------------------------------------------------+
563 | ``TORRENT_DISABLE_POOL_ALLOCATOR`` | Disables use of ``boost::pool<>``. |
564 +----------------------------------------+-------------------------------------------------+
565 | ``TORRENT_LINKING_SHARED`` | If this is defined when including the |
566 | | libtorrent headers, the classes and functions |
567 | | will be tagged with ``__declspec(dllimport)`` |
568 | | on msvc and default visibility on GCC 4 and |
569 | | later. Set this in your project if you're |
570 | | linking against libtorrent as a shared library. |
571 | | (This is set by the Jamfile when |
572 | | ``link=shared`` is set). |
573 +----------------------------------------+-------------------------------------------------+
574 | ``TORRENT_BUILDING_SHARED`` | If this is defined, the functions and classes |
575 | | in libtorrent are marked with |
576 | | ``__declspec(dllexport)`` on msvc, or with |
577 | | default visibility on GCC 4 and later. This |
578 | | should be defined when building libtorrent as |
579 | | a shared library. (This is set by the Jamfile |
580 | | when ``link=shared`` is set). |
581 +----------------------------------------+-------------------------------------------------+
582 | ``TORRENT_DISABLE_DHT`` | If this is defined, the support for trackerless |
583 | | torrents will be disabled. |
584 +----------------------------------------+-------------------------------------------------+
585 | ``TORRENT_DHT_VERBOSE_LOGGING`` | This will enable verbose logging of the DHT |
586 | | protocol traffic. |
587 +----------------------------------------+-------------------------------------------------+
588 | ``TORRENT_DISABLE_ENCRYPTION`` | This will disable any encryption support and |
589 | | the openssl dependency that comes with it. |
590 | | Encryption support is the peer connection |
591 | | encrypted supported by clients such as |
592 | | uTorrent, Azureus and KTorrent. |
593 +----------------------------------------+-------------------------------------------------+
594 | ``_UNICODE`` | On windows, this will cause the file IO |
595 | | use wide character API, to properly support |
596 | | non-ansi characters. |
597 +----------------------------------------+-------------------------------------------------+
598 | ``TORRENT_DISABLE_RESOLVE_COUNTRIES`` | Defining this will disable the ability to |
599 | | resolve countries of origin for peer IPs. |
600 +----------------------------------------+-------------------------------------------------+
601 | ``TORRENT_DISABLE_INVARIANT_CHECKS`` | This will disable internal invariant checks in |
602 | | libtorrent. The invariant checks can sometime |
603 | | be quite expensive, they typically don't scale |
604 | | very well. This option can be used to still |
605 | | build in debug mode, with asserts enabled, but |
606 | | make the resulting executable faster. |
607 +----------------------------------------+-------------------------------------------------+
608 | ``TORRENT_EXPENSIVE_INVARIANT_CHECKS`` | This will enable extra expensive invariant |
609 | | checks. Useful for finding particular bugs |
610 | | or for running before releases. |
611 +----------------------------------------+-------------------------------------------------+
612 | ``TORRENT_NO_DEPRECATE`` | This will exclude all deprecated functions from |
613 | | the header files and cpp files. |
614 +----------------------------------------+-------------------------------------------------+
617 If you experience that libtorrent uses unreasonable amounts of cpu, it will
618 definitely help to define ``NDEBUG``, since it will remove the invariant checks