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