Alexander Afanasyev | abaab52 | 2014-04-30 20:42:11 -0700 | [diff] [blame] | 1 | .. _Getting Started with ndn-cxx: |
| 2 | |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 3 | Getting started with ndn-cxx |
| 4 | ============================ |
| 5 | |
| 6 | Supported platforms |
| 7 | ------------------- |
| 8 | |
| 9 | ndn-cxx uses continuous integration and has been tested on the following |
| 10 | platforms: |
| 11 | |
Davide Pesavento | 7c4ad51 | 2018-04-28 15:20:11 -0400 | [diff] [blame] | 12 | - Ubuntu 16.04 (amd64, armhf, i386) |
| 13 | - Ubuntu 18.04 (amd64) |
Alexander Afanasyev | 0d748af | 2019-04-25 17:45:07 -0400 | [diff] [blame] | 14 | - Ubuntu 19.04 (amd64) |
Davide Pesavento | 0530b5b | 2016-11-07 03:23:58 +0100 | [diff] [blame] | 15 | - macOS 10.12 |
Eric Newberry | 935d7fe | 2017-10-29 15:09:36 -0700 | [diff] [blame] | 16 | - macOS 10.13 |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 17 | - macOS 10.14 |
Alexander Afanasyev | 0d748af | 2019-04-25 17:45:07 -0400 | [diff] [blame] | 18 | - CentOS 7 (with gcc 7 and boost 1.58.0) |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 19 | |
| 20 | ndn-cxx is known to work on the following platforms, although they are not officially |
| 21 | supported: |
| 22 | |
Davide Pesavento | 7c4ad51 | 2018-04-28 15:20:11 -0400 | [diff] [blame] | 23 | - Debian >= 9 |
| 24 | - Fedora >= 24 |
Ivan Yeo | ba1a4a9 | 2015-01-11 00:45:57 -0800 | [diff] [blame] | 25 | - Gentoo Linux |
Davide Pesavento | 7c4ad51 | 2018-04-28 15:20:11 -0400 | [diff] [blame] | 26 | - Raspbian >= 2017-08-16 |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 27 | - FreeBSD 11.2 |
| 28 | |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 29 | |
| 30 | Prerequisites |
| 31 | ------------- |
| 32 | |
| 33 | Required: |
| 34 | ~~~~~~~~~ |
| 35 | |
Davide Pesavento | ca660f1 | 2018-06-16 14:01:51 -0400 | [diff] [blame] | 36 | - GCC >= 5.3, or clang >= 3.6 |
Davide Pesavento | 7c4ad51 | 2018-04-28 15:20:11 -0400 | [diff] [blame] | 37 | - ``python2`` >= 2.7, or ``python3`` >= 3.4 |
Davide Pesavento | 844b093 | 2018-05-07 01:00:16 -0400 | [diff] [blame] | 38 | - Boost libraries >= 1.58 |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 39 | - ``pkg-config`` |
| 40 | - SQLite 3.x |
| 41 | - OpenSSL >= 1.0.2 |
| 42 | - Apple Security framework (on macOS only) |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 43 | |
| 44 | Following are the detailed steps for each platform to install the compiler, all necessary |
| 45 | development tools and libraries, and ndn-cxx prerequisites. |
| 46 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 47 | - macOS |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 48 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 49 | * Install Xcode from the App Store, or at least the Command Line Tools |
| 50 | (``xcode-select --install``) |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 51 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 52 | * If using Homebrew (recommended), enter the following in a terminal:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 53 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 54 | brew install boost openssl pkg-config |
Alexander Afanasyev | 67cb75c | 2016-06-15 12:34:58 -0700 | [diff] [blame] | 55 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 56 | .. note:: |
Alexander Afanasyev | 67cb75c | 2016-06-15 12:34:58 -0700 | [diff] [blame] | 57 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 58 | If a major OS upgrade is performed after installing the dependencies |
| 59 | with Homebrew, remember to reinstall all packages. |
Alexander Afanasyev | 67cb75c | 2016-06-15 12:34:58 -0700 | [diff] [blame] | 60 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 61 | - Ubuntu |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 62 | |
Alexander Afanasyev | 67cb75c | 2016-06-15 12:34:58 -0700 | [diff] [blame] | 63 | In a terminal, enter:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 64 | |
Alexander Afanasyev | 0d748af | 2019-04-25 17:45:07 -0400 | [diff] [blame] | 65 | sudo apt install build-essential libboost-all-dev libssl-dev libsqlite3-dev pkg-config python-minimal |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 66 | |
Ivan Yeo | ba1a4a9 | 2015-01-11 00:45:57 -0800 | [diff] [blame] | 67 | - Fedora |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 68 | |
Alexander Afanasyev | 67cb75c | 2016-06-15 12:34:58 -0700 | [diff] [blame] | 69 | In a terminal, enter:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 70 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 71 | sudo yum install gcc-g++ sqlite-devel boost-devel openssl-devel |
| 72 | |
| 73 | - FreeBSD |
| 74 | |
| 75 | In a terminal, enter:: |
| 76 | |
| 77 | sudo pkg install python pkgconf sqlite3 boost-libs |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 78 | |
| 79 | Optional: |
| 80 | ~~~~~~~~~ |
| 81 | |
| 82 | To build tutorials, manpages, and API documentation the following |
| 83 | dependencies need to be installed: |
| 84 | |
| 85 | - ``doxygen`` |
| 86 | - ``graphviz`` |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 87 | - ``python-sphinx`` |
| 88 | - ``sphinxcontrib-doxylink`` |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 89 | |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 90 | The following lists steps for common platforms to install these prerequisites: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 91 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 92 | - On macOS with Homebrew and pip:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 93 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 94 | brew install doxygen graphviz |
| 95 | sudo pip install sphinx sphinxcontrib-doxylink |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 96 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 97 | - On Ubuntu:: |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 98 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 99 | sudo apt install doxygen graphviz python3-pip |
| 100 | sudo pip3 install sphinx sphinxcontrib-doxylink |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 101 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 102 | - On Fedora:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 103 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 104 | sudo yum install doxygen graphviz python-sphinx |
| 105 | sudo pip install sphinxcontrib-doxylink |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 106 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 107 | - On FreeBSD:: |
| 108 | |
| 109 | sudo pkg install doxygen graphviz py27-sphinx |
| 110 | |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 111 | |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 112 | .. _build: |
| 113 | |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 114 | Build |
| 115 | ----- |
| 116 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 117 | .. note:: |
| 118 | These are instructions for regular builds of ndn-cxx (release mode). |
| 119 | To do development of ndn-cxx code itself, see "Development build" below. |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 120 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 121 | To build in a terminal, change directory to the ndn-cxx root, then enter:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 122 | |
| 123 | ./waf configure |
| 124 | ./waf |
| 125 | sudo ./waf install |
| 126 | |
Spyridon Mastorakis | 5ebfda6 | 2015-07-21 20:57:40 -0700 | [diff] [blame] | 127 | By default, only the shared version of ndn-cxx library is built. To build the static library, |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 128 | use ``--enable-static`` option for ``./waf configure`` command:: |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 129 | |
Spyridon Mastorakis | 5ebfda6 | 2015-07-21 20:57:40 -0700 | [diff] [blame] | 130 | ./waf configure --enable-static |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 131 | |
Spyridon Mastorakis | 5ebfda6 | 2015-07-21 20:57:40 -0700 | [diff] [blame] | 132 | To disable build of the shared library and build only the static library, use additional |
| 133 | ``--disable-shared`` option. Note that at least one version of the library needs to be |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 134 | enabled. |
| 135 | |
| 136 | :: |
| 137 | |
Spyridon Mastorakis | 5ebfda6 | 2015-07-21 20:57:40 -0700 | [diff] [blame] | 138 | ./waf configure --enable-static --disable-shared |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 139 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 140 | After the shared library is installed, on Linux it is also necessary to run:: |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 141 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 142 | sudo ldconfig |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 143 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 144 | .. note:: |
| 145 | When the library is installed in a non-standard path (in general: not in ``/usr/lib`` |
| 146 | or ``/usr/local/lib``; on some Linux distros including Fedora: not in ``/usr/lib``), |
| 147 | additional actions may be necessary. |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 148 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 149 | The installation path should be added to ``/etc/ld.so.conf`` (or in |
| 150 | ``/etc/ld.so.conf.d``) **before** running ``sudo ldconfig``. For example:: |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 151 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 152 | echo /usr/local/lib | sudo tee /etc/ld.so.conf.d/ndn-cxx.conf |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 153 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 154 | Alternatively, the ``LD_LIBRARY_PATH`` environment variable can be set to point to |
| 155 | the installation directory of the shared library:: |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 156 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 157 | export LD_LIBRARY_PATH=/usr/local/lib |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 158 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 159 | The ``./waf install`` command installs the following files: |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 160 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 161 | - ``<LIBPATH>/libndn-cxx.a``: static NDN C++ library (if enabled). |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 162 | - ``<LIBPATH>/libndn-cxx.so``, ``<LIBPATH>/libndn-cxx.so.<VERSION>`` (on Linux), |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 163 | ``<LIBPATH>/libndn-cxx.dylib``, ``<LIBPATH>/libndn-cxx.<VERSION>.dylib`` (on macOS): |
| 164 | shared NDN C++ library (if enabled). |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 165 | - ``<LIBPATH>/pkgconfig/libndn-cxx.pc``: pkgconfig file storing all |
| 166 | neccessary flags to build against the library. For example, if |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 167 | pkg-config or pkgconf package is installed and ``PKG_CONFIG_PATH`` is |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 168 | configured properly (or ``<LIBPATH>/pkgconfig`` is a default path), |
| 169 | ``pkgconfig --libs --clflags libndn-cxx`` will return all necessary |
| 170 | compile and link flags for the library. |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 171 | - ``<BINPATH>/ndnsec``: tool to manage NDN keys and certificates. |
| 172 | - ``<BINPATH>/ndnsec-*``: convenience aliases for ``ndnsec`` tools. |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 173 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 174 | If configured with tests (``./waf configure --with-tests``), the above |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 175 | commands will also produce: |
| 176 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 177 | - ``build/unit-tests``: a unit test binary for the library. |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 178 | |
Junxiao Shi | e04bd83 | 2014-11-29 23:02:38 -0700 | [diff] [blame] | 179 | 1.5GB available memory per CPU core is necessary for efficient compilation. |
| 180 | On a multi-core machine with less than 1.5GB available memory per CPU core, |
| 181 | limit the objects being compiled in parallel with ``./waf -jN`` where N is the amount |
| 182 | of available memory divided by 1.5GB (eg. ``./waf -j1`` for 1.5GB memory), |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 183 | which should usually avoid memory thrashing and result in faster compilation. |
Junxiao Shi | e04bd83 | 2014-11-29 23:02:38 -0700 | [diff] [blame] | 184 | |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 185 | Build with examples |
| 186 | ------------------- |
| 187 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 188 | By default, examples in ``examples/`` are not built. To enable them, use the |
| 189 | ``--with-examples`` configure option:: |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 190 | |
| 191 | ./waf configure --with-examples |
| 192 | ./waf |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 193 | sudo ./waf install |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 194 | sudo ldconfig # (on Linux only) |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 195 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 196 | To run examples:: |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 197 | |
| 198 | # trivial producer app |
| 199 | ./build/examples/producer |
| 200 | |
| 201 | # trivial consumer app |
| 202 | ./build/examples/consumer |
| 203 | |
| 204 | # trivial consumer app with timers |
| 205 | ./build/examples/consumer-with-timer |
| 206 | |
| 207 | If you want to test out a sample application, just create a ``.cpp`` file in ``examples/`` |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 208 | folder and it will be compiled on the next run on ``./waf``. For example:: |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 209 | |
| 210 | cp examples/consumer.cpp examples/my-new-consumer-app.cpp |
| 211 | ./waf |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 212 | sudo ./waf install |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 213 | sudo ldconfig # (on Linux only) |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 214 | ./build/examples/my-new-consumer-app |
| 215 | |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 216 | Debug symbols |
| 217 | ~~~~~~~~~~~~~ |
| 218 | |
| 219 | The default compiler flags enable debug symbols to be included in binaries (i.e., ``-g`` |
| 220 | flag for ``./waf configure`` and ``-g3`` for ``./waf configure --debug``). This |
| 221 | potentially allows more meaningful debugging information if your application crashes. |
| 222 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 223 | The default build flags can easily be overridden:: |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 224 | |
| 225 | CXXFLAGS="-O2" ./waf configure --prefix=/usr --sysconfdir=/etc |
| 226 | ./waf |
| 227 | sudo ./waf install |
| 228 | |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 229 | |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 230 | Documentation |
| 231 | ------------- |
| 232 | |
| 233 | ndn-cxx tutorials and API documentation can be built using the following |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 234 | commands:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 235 | |
| 236 | # Full set of documentation (tutorials + API) in build/docs |
| 237 | ./waf docs |
| 238 | |
| 239 | # Only tutorials in `build/docs` |
| 240 | ./waf sphinx |
| 241 | |
| 242 | # Only API docs in `build/docs/doxygen` |
Sepehr Abdous | 4fc6db2 | 2018-08-22 15:26:06 -0700 | [diff] [blame] | 243 | ./waf doxygen |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 244 | |
| 245 | Manpages are automatically created and installed during the normal build |
| 246 | process (e.g., during ``./waf`` and ``./waf install``), if |
| 247 | ``python-sphinx`` module is detected during ``./waf configure`` stage. |
| 248 | By default, manpages are installed into ``${PREFIX}/share/man`` (where |
| 249 | default value for ``PREFIX`` is ``/usr/local``). This location can be |
| 250 | changed during ``./waf configure`` stage using ``--prefix``, |
| 251 | ``--datarootdir``, or ``--mandir`` options. |
| 252 | |
| 253 | For more details, refer to ``./waf --help``. |
| 254 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 255 | |
| 256 | Development build |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 257 | ----------------- |
| 258 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 259 | The following is the suggested configure command for development builds:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 260 | |
| 261 | ./waf configure --debug --with-tests |
| 262 | ./waf |
| 263 | sudo ./waf install |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 264 | sudo ldconfig # (on Linux only) |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 265 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 266 | In the development build most compiler optimizations are disabled by |
| 267 | default and all warnings are treated as errors. The default behavior can |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 268 | be overridden by setting ``CXXFLAGS`` environment variable before |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 269 | running ``./waf configure``:: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 270 | |
| 271 | CXXFLAGS="-O1 -g3" ./waf configure --debug --with-tests |
| 272 | ... |
Alexander Afanasyev | 5946ed1 | 2015-01-19 23:41:39 -0800 | [diff] [blame] | 273 | |
Alexander Afanasyev | 5946ed1 | 2015-01-19 23:41:39 -0800 | [diff] [blame] | 274 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 275 | Customizing the compiler |
| 276 | ------------------------ |
| 277 | |
| 278 | To choose a custom C++ compiler for building ndn-cxx, set the ``CXX`` environment |
Davide Pesavento | 0530b5b | 2016-11-07 03:23:58 +0100 | [diff] [blame] | 279 | variable to point to the compiler binary. For example, to build with clang on |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 280 | Linux, use the following:: |
Alexander Afanasyev | 5946ed1 | 2015-01-19 23:41:39 -0800 | [diff] [blame] | 281 | |
Davide Pesavento | 0530b5b | 2016-11-07 03:23:58 +0100 | [diff] [blame] | 282 | CXX=clang++ ./waf configure |