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 | 762548b | 2023-03-05 11:02:02 -0500 | [diff] [blame] | 10 | - Ubuntu 20.04 (focal) |
| 11 | - Ubuntu 22.04 (jammy) |
Davide Pesavento | 2be774b | 2024-06-07 17:25:31 -0400 | [diff] [blame] | 12 | - Ubuntu 24.04 (noble) |
Davide Pesavento | 762548b | 2023-03-05 11:02:02 -0500 | [diff] [blame] | 13 | - Debian 11 (bullseye) |
Davide Pesavento | e1005da | 2023-10-31 20:35:02 -0400 | [diff] [blame] | 14 | - Debian 12 (bookworm) |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 15 | - CentOS Stream 9 |
Davide Pesavento | 2be774b | 2024-06-07 17:25:31 -0400 | [diff] [blame] | 16 | - macOS 12 / 13 / 14 |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 17 | |
Davide Pesavento | 762548b | 2023-03-05 11:02:02 -0500 | [diff] [blame] | 18 | ndn-cxx should also work on the following platforms, although they are not officially |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 19 | supported: |
| 20 | |
Davide Pesavento | 762548b | 2023-03-05 11:02:02 -0500 | [diff] [blame] | 21 | - Any other recent version of Ubuntu not listed above |
Davide Pesavento | e1005da | 2023-10-31 20:35:02 -0400 | [diff] [blame] | 22 | - Fedora >= 33 |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 23 | - Alpine >= 3.12 |
Davide Pesavento | e1005da | 2023-10-31 20:35:02 -0400 | [diff] [blame] | 24 | - Any version of Raspberry Pi OS based on Debian 11 (bullseye) or later |
Davide Pesavento | 2be774b | 2024-06-07 17:25:31 -0400 | [diff] [blame] | 25 | - macOS >= 10.15 |
Davide Pesavento | ea5ce49 | 2022-09-30 20:25:25 -0400 | [diff] [blame] | 26 | - FreeBSD >= 12.2 |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 27 | |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 28 | Prerequisites |
| 29 | ------------- |
| 30 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 31 | Required |
| 32 | ~~~~~~~~ |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 33 | |
Davide Pesavento | 762548b | 2023-03-05 11:02:02 -0500 | [diff] [blame] | 34 | - GCC >= 9.3 or clang >= 7.0 (if you are on Linux or FreeBSD) |
Davide Pesavento | 2be774b | 2024-06-07 17:25:31 -0400 | [diff] [blame] | 35 | - Xcode >= 13.0 or corresponding version of Command Line Tools (if you are on macOS) |
Davide Pesavento | 762548b | 2023-03-05 11:02:02 -0500 | [diff] [blame] | 36 | - Python >= 3.8 |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 37 | - pkg-config |
Davide Pesavento | 550d8c9 | 2023-11-05 01:30:01 -0400 | [diff] [blame] | 38 | - Boost >= 1.71.0 |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 39 | - OpenSSL >= 1.1.1 |
| 40 | - SQLite 3.x |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 41 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 42 | To build ndn-cxx from source, one must first install a C++ compiler and all necessary |
| 43 | development tools and libraries: |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 44 | |
Davide Pesavento | 87208f9 | 2022-08-30 19:51:23 -0400 | [diff] [blame] | 45 | - On **Debian** and **Ubuntu** |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 46 | |
| 47 | In a terminal, enter:: |
| 48 | |
Davide Pesavento | 2d08539 | 2024-03-24 02:12:42 -0400 | [diff] [blame] | 49 | sudo apt install build-essential libboost-all-dev libssl-dev libsqlite3-dev pkg-config python3 |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 50 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 51 | - On **CentOS** and **Fedora** |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 52 | |
| 53 | In a terminal, enter:: |
| 54 | |
Davide Pesavento | 2d08539 | 2024-03-24 02:12:42 -0400 | [diff] [blame] | 55 | sudo dnf install gcc-c++ boost-devel openssl-devel sqlite-devel pkgconf-pkg-config python3 |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 56 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 57 | - On **macOS** |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 58 | |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 59 | * Install either Xcode (from the App Store) or the Command Line Tools |
| 60 | (with ``xcode-select --install``) |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 61 | |
Davide Pesavento | cad94b0 | 2021-04-09 21:23:03 -0400 | [diff] [blame] | 62 | * If using Homebrew (recommended), enter the following in a terminal: |
| 63 | |
| 64 | .. code-block:: sh |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 65 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 66 | brew install boost openssl pkg-config |
Alexander Afanasyev | 67cb75c | 2016-06-15 12:34:58 -0700 | [diff] [blame] | 67 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 68 | .. warning:: |
Alexander Afanasyev | 67cb75c | 2016-06-15 12:34:58 -0700 | [diff] [blame] | 69 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 70 | If a major OS upgrade is performed after installing the dependencies |
| 71 | with Homebrew, remember to reinstall all packages. |
Alexander Afanasyev | 67cb75c | 2016-06-15 12:34:58 -0700 | [diff] [blame] | 72 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 73 | - On **FreeBSD** |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 74 | |
| 75 | In a terminal, enter:: |
| 76 | |
Davide Pesavento | 2d08539 | 2024-03-24 02:12:42 -0400 | [diff] [blame] | 77 | sudo pkg install boost-libs openssl sqlite3 pkgconf python3 |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 78 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 79 | Optional |
| 80 | ~~~~~~~~ |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 81 | |
Davide Pesavento | 01cea50 | 2021-07-31 19:25:42 -0400 | [diff] [blame] | 82 | To build tutorials, man pages, and API documentation the following additional dependencies |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 83 | need to be installed: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 84 | |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 85 | - doxygen |
| 86 | - graphviz |
Davide Pesavento | 02bbfa7 | 2022-09-21 20:53:03 -0400 | [diff] [blame] | 87 | - sphinx >= 4.0 |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 88 | - sphinxcontrib-doxylink |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 89 | |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 90 | 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] | 91 | |
Davide Pesavento | 3ffae26 | 2021-08-27 18:48:22 -0400 | [diff] [blame] | 92 | .. note:: |
| 93 | On Linux, you may need to add ``$HOME/.local/bin`` to the ``PATH`` environment variable |
| 94 | for your user, for example: |
| 95 | |
| 96 | .. code-block:: sh |
| 97 | |
| 98 | export PATH="${HOME}/.local/bin${PATH:+:}${PATH}" |
| 99 | |
Davide Pesavento | 87208f9 | 2022-08-30 19:51:23 -0400 | [diff] [blame] | 100 | - On **Debian** and **Ubuntu**: |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 101 | |
| 102 | .. code-block:: sh |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 103 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 104 | sudo apt install doxygen graphviz python3-pip |
Davide Pesavento | 30ed628 | 2021-07-25 20:05:06 -0400 | [diff] [blame] | 105 | pip3 install --user sphinx sphinxcontrib-doxylink |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 106 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 107 | - On **CentOS** and **Fedora**: |
| 108 | |
| 109 | .. code-block:: sh |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 110 | |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 111 | sudo dnf install doxygen graphviz python3-pip |
| 112 | pip3 install --user sphinx sphinxcontrib-doxylink |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 113 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 114 | - On **macOS**: |
| 115 | |
| 116 | .. code-block:: sh |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 117 | |
| 118 | brew install doxygen graphviz |
Davide Pesavento | 30ed628 | 2021-07-25 20:05:06 -0400 | [diff] [blame] | 119 | sudo pip3 install sphinx sphinxcontrib-doxylink |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 120 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 121 | - On **FreeBSD**: |
| 122 | |
| 123 | .. code-block:: sh |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 124 | |
Davide Pesavento | ea5ce49 | 2022-09-30 20:25:25 -0400 | [diff] [blame] | 125 | sudo pkg install doxygen graphviz py39-sphinx |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 126 | |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 127 | Build |
| 128 | ----- |
| 129 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 130 | .. note:: |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 131 | These are instructions for regular builds of ndn-cxx (release mode). If you are |
| 132 | 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] | 133 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 134 | To build in a terminal, change directory to the ndn-cxx root, then enter: |
| 135 | |
| 136 | .. code-block:: sh |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 137 | |
Davide Pesavento | fbca611 | 2022-07-03 16:31:04 -0400 | [diff] [blame] | 138 | ./waf configure |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 139 | ./waf |
| 140 | sudo ./waf install |
| 141 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 142 | By default, only the shared variant of the ndn-cxx library will be built. To build the |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 143 | static library, pass ``--enable-static`` to the ``./waf configure`` command: |
| 144 | |
| 145 | .. code-block:: sh |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 146 | |
Spyridon Mastorakis | 5ebfda6 | 2015-07-21 20:57:40 -0700 | [diff] [blame] | 147 | ./waf configure --enable-static |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 148 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 149 | To disable the build of the shared library and build only the static library, use the |
| 150 | additional ``--disable-shared`` option. Note that at least one variant of the library |
| 151 | needs to be enabled. |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 152 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 153 | .. code-block:: sh |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 154 | |
Spyridon Mastorakis | 5ebfda6 | 2015-07-21 20:57:40 -0700 | [diff] [blame] | 155 | ./waf configure --enable-static --disable-shared |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 156 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 157 | On Linux, it is necessary to run the following command after the shared library has |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 158 | been installed: |
| 159 | |
| 160 | .. code-block:: sh |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 161 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 162 | sudo ldconfig |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 163 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 164 | .. note:: |
Davide Pesavento | 4dc4b3c | 2024-02-05 20:05:54 -0500 | [diff] [blame] | 165 | On Linux, when the library is installed in a non-default location (generally, not in |
| 166 | ``/usr/lib`` or ``/usr/local/lib``), the following additional actions may be necessary. |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 167 | |
Davide Pesavento | 4dc4b3c | 2024-02-05 20:05:54 -0500 | [diff] [blame] | 168 | The library installation path should be added to ``/etc/ld.so.conf`` or to |
| 169 | ``/etc/ld.so.conf.d/*.conf`` before running ``ldconfig``. For example: |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 170 | |
| 171 | .. code-block:: sh |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 172 | |
Davide Pesavento | 4dc4b3c | 2024-02-05 20:05:54 -0500 | [diff] [blame] | 173 | echo /usr/local/lib64 | sudo tee /etc/ld.so.conf.d/ndn-cxx.conf |
| 174 | sudo ldconfig |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 175 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 176 | Alternatively, the ``LD_LIBRARY_PATH`` environment variable can be set to point to |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 177 | the installation directory of the shared library: |
| 178 | |
| 179 | .. code-block:: sh |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 180 | |
Davide Pesavento | 4dc4b3c | 2024-02-05 20:05:54 -0500 | [diff] [blame] | 181 | export LD_LIBRARY_PATH=/usr/local/lib64 |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 182 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 183 | The ``./waf install`` command installs the following files: |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 184 | |
Davide Pesavento | 4dc4b3c | 2024-02-05 20:05:54 -0500 | [diff] [blame] | 185 | - ``<LIBDIR>/libndn-cxx.a``: static NDN C++ library (if enabled). |
| 186 | - ``<LIBDIR>/libndn-cxx.so``, ``<LIBDIR>/libndn-cxx.so.<VERSION>`` (on Linux), |
| 187 | ``<LIBDIR>/libndn-cxx.dylib``, ``<LIBDIR>/libndn-cxx.<VERSION>.dylib`` (on macOS): |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 188 | shared NDN C++ library (if enabled). |
Davide Pesavento | 4dc4b3c | 2024-02-05 20:05:54 -0500 | [diff] [blame] | 189 | - ``<LIBDIR>/pkgconfig/libndn-cxx.pc``: pkgconfig file storing all necessary flags to |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 190 | build against the library. For example, if the ``pkg-config`` or ``pkgconf-pkg-config`` |
| 191 | package is installed and ``PKG_CONFIG_PATH`` is configured properly (or if |
Davide Pesavento | 4dc4b3c | 2024-02-05 20:05:54 -0500 | [diff] [blame] | 192 | ``<LIBDIR>/pkgconfig`` is a default search path), the command ``pkg-config --cflags |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 193 | --libs libndn-cxx`` will return all necessary compile and link flags for the library. |
Davide Pesavento | 4dc4b3c | 2024-02-05 20:05:54 -0500 | [diff] [blame] | 194 | - ``<BINDIR>/ndnsec``: command-line tool to manage NDN keys and certificates. |
| 195 | - ``<BINDIR>/ndnsec-*``: convenience aliases for ``ndnsec`` tools. |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 196 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 197 | If configured with tests (``./waf configure --with-tests``), the above commands |
| 198 | will also produce: |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 199 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 200 | - ``build/unit-tests``: a unit test binary for the library. |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 201 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 202 | 1.5 GB available memory per CPU core is necessary for efficient compilation. On a |
| 203 | multi-core machine with less than 1.5 GB available memory per CPU core, limit the |
| 204 | objects being compiled in parallel with ``./waf -jN``, where N is the amount of |
| 205 | available memory divided by 1.5 GB (e.g., ``./waf -j2`` for 3 GB of memory). This |
| 206 | should avoid memory thrashing and result in faster compilation. |
Junxiao Shi | e04bd83 | 2014-11-29 23:02:38 -0700 | [diff] [blame] | 207 | |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 208 | Build with examples |
| 209 | ------------------- |
| 210 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 211 | By default, the examples in the ``examples/`` directory will not be built. To enable |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 212 | them, pass ``--with-examples`` during the configuration step: |
| 213 | |
| 214 | .. code-block:: sh |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 215 | |
Davide Pesavento | fbca611 | 2022-07-03 16:31:04 -0400 | [diff] [blame] | 216 | ./waf configure --with-examples |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 217 | ./waf |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 218 | sudo ./waf install |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 219 | sudo ldconfig # on Linux only |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 220 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 221 | To run the examples: |
| 222 | |
| 223 | .. code-block:: sh |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 224 | |
| 225 | # trivial producer app |
| 226 | ./build/examples/producer |
| 227 | |
| 228 | # trivial consumer app |
| 229 | ./build/examples/consumer |
| 230 | |
| 231 | # trivial consumer app with timers |
| 232 | ./build/examples/consumer-with-timer |
| 233 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 234 | If you want to make a new sample application, just create a ``.cpp`` file inside the |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 235 | ``examples/`` directory and it will be compiled during the next run of ``./waf``: |
| 236 | |
| 237 | .. code-block:: sh |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 238 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 239 | cp examples/consumer.cpp examples/my-new-app.cpp |
| 240 | ... # edit examples/my-new-app.cpp with your preferred editor |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 241 | ./waf |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 242 | sudo ./waf install |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 243 | sudo ldconfig # on Linux only |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 244 | ./build/examples/my-new-app |
Alexander Afanasyev | c8bcd45 | 2014-05-12 17:58:47 -0700 | [diff] [blame] | 245 | |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 246 | Debug symbols |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 247 | ------------- |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 248 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 249 | The default compiler flags include debug symbols in binaries. This should provide |
| 250 | more meaningful debugging information if ndn-cxx or your application crashes. |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 251 | |
Eric Newberry | bdfb53a | 2020-10-01 10:43:46 -0700 | [diff] [blame] | 252 | If this is not desired, the default flags can be overridden to disable debug symbols. |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 253 | The following example shows how to completely disable debug symbols and configure |
| 254 | ndn-cxx to be installed into ``/usr`` with configuration in the ``/etc`` directory. |
| 255 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 256 | .. code-block:: sh |
Alexander Afanasyev | 9b0e114 | 2014-05-08 00:17:34 -0700 | [diff] [blame] | 257 | |
| 258 | CXXFLAGS="-O2" ./waf configure --prefix=/usr --sysconfdir=/etc |
| 259 | ./waf |
| 260 | sudo ./waf install |
| 261 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 262 | Customizing the compiler |
| 263 | ------------------------ |
Alexander Afanasyev | 7ed2943 | 2015-06-05 18:01:16 -0700 | [diff] [blame] | 264 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 265 | To build ndn-cxx with a different compiler (rather than the platform default), set the |
| 266 | ``CXX`` environment variable to point to the compiler binary. For example, to build |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 267 | with clang on Linux, use the following: |
| 268 | |
| 269 | .. code-block:: sh |
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 | CXX=clang++ ./waf configure |
| 272 | |
| 273 | Building the documentation |
| 274 | -------------------------- |
| 275 | |
Eric Newberry | bdfb53a | 2020-10-01 10:43:46 -0700 | [diff] [blame] | 276 | Tutorials and API documentation can be built using the following commands: |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 277 | |
| 278 | .. code-block:: sh |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 279 | |
| 280 | # Full set of documentation (tutorials + API) in build/docs |
| 281 | ./waf docs |
| 282 | |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 283 | # Only tutorials in build/docs |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 284 | ./waf sphinx |
| 285 | |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 286 | # Only API docs in build/docs/doxygen |
Sepehr Abdous | 4fc6db2 | 2018-08-22 15:26:06 -0700 | [diff] [blame] | 287 | ./waf doxygen |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 288 | |
Davide Pesavento | 01cea50 | 2021-07-31 19:25:42 -0400 | [diff] [blame] | 289 | If ``sphinx-build`` is detected during ``./waf configure``, man pages will automatically |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 290 | be built and installed during the normal build process (i.e., during ``./waf`` and |
Davide Pesavento | 01cea50 | 2021-07-31 19:25:42 -0400 | [diff] [blame] | 291 | ``./waf install``). By default, man pages will be installed into ``${PREFIX}/share/man`` |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 292 | (the default value for ``PREFIX`` is ``/usr/local``). This location can be changed |
| 293 | during the ``./waf configure`` stage using the ``--prefix``, ``--datarootdir``, or |
| 294 | ``--mandir`` options. |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 295 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 296 | For further details, please refer to ``./waf --help``. |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 297 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 298 | .. _Development build: |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 299 | |
| 300 | Development build |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 301 | ----------------- |
| 302 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 303 | The following is the suggested build procedure for development builds: |
| 304 | |
| 305 | .. code-block:: sh |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 306 | |
Davide Pesavento | fbca611 | 2022-07-03 16:31:04 -0400 | [diff] [blame] | 307 | ./waf configure --debug --with-tests |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 308 | ./waf |
| 309 | sudo ./waf install |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 310 | sudo ldconfig # on Linux only |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 311 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 312 | In a development build, most compiler optimizations will be disabled and all warnings |
| 313 | will be treated as errors. This default behavior can be overridden by setting the |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 314 | ``CXXFLAGS`` environment variable before running ``./waf configure``, for example: |
| 315 | |
| 316 | .. code-block:: sh |
Alexander Afanasyev | c5452c5 | 2014-04-29 17:21:51 -0700 | [diff] [blame] | 317 | |
Davide Pesavento | 81de5d9 | 2022-12-30 01:08:05 -0500 | [diff] [blame] | 318 | CXXFLAGS="-O1 -g3 -Wall" ./waf configure --debug --with-tests |
| 319 | ./waf |