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