File: linux.rst

package info (click to toggle)
ns3 3.46-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 105,864 kB
  • sloc: cpp: 624,863; python: 14,863; ansic: 6,772; makefile: 1,950; sh: 987; javascript: 167; perl: 102
file content (184 lines) | stat: -rw-r--r-- 10,075 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
.. include:: replace.txt
.. heading hierarchy:
   ------------- Chapter
   ************* Section (#.#)
   ============= Subsection (#.#.#)
   ############# Paragraph (no number)

.. _Linux:

Linux
-----

This chapter describes Linux-specific installation commands to install the options described
in the previous chapter.  The chapter is written initially with Ubuntu (Debian-based) Linux
examples (Ubuntu is the most frequently used Linux distribution by |ns3| users) but should
translate fairly well to derivatives (e.g. Linux Mint).

The list of packages depends on which version of ns-3 you are trying to build, and on which
extensions you need; please review the previous chapter if you need more information.

Requirements
************

The minimum supported version of Ubuntu is Ubuntu 22.04 LTS.  Older versions may also be
suitable as long as the C++ compiler version is relatively recent.  As of the ns-3.46
release, g++ version 11 or later is required (or clang++ version 17 or later).
Older ns-3 releases may work with older versions of g++; check the RELEASE_NOTES.md file.

+--------------------+---------------------------------------------------------------------+
| **ns-3 Version**   | **apt Packages**                                                    |
+====================+==================+==================================================+
| 3.36 and later     | ``g++ python3 cmake ninja-build git``                               |
+--------------------+---------------------------------------------------------------------+
| 3.30-3.35          | ``g++ python3 git``                                                 |
+--------------------+---------------------------------------------------------------------+
| 3.29 and earlier   | ``g++ python2``                                                     |
+--------------------+---------------------------------------------------------------------+

Recommended
***********

+-----------------------------+------------------------------------------------------------+
| **Feature**                 | **apt Packages**                                           |
+=============================+============================================================+
| Compiler cache optimization | ``ccache``                                                 |
+-----------------------------+------------------------------------------------------------+
| Code linting                | ``clang-format clang-tidy``                                |
+-----------------------------+------------------------------------------------------------+
| Debugging                   | ``gdb valgrind``                                           |
+-----------------------------+------------------------------------------------------------+

.. note::
  For Ubuntu 20.04 release and earlier, the version of ccache provided by apt
  (3.7.7 or earlier) may not provide performance benefits, and users are recommended to install
  version 4 or later, possibly as a source install. For Ubuntu 22.04 and later, ccache can be
  installed using apt.

.. note::
  Different versions of ns-3 use different versions of clang-format, resulting in
  slightly different formatting decisions.  The ``check-style-clang-format.py``
  file enforces a minimum and maximum major version of clang-format with which the
  current codebase is compatible.  Since the ns-3.46 release, please consult the
  ``RELEASE_NOTES.md`` file for the currently supported versions.
  For some additional information about installing and using clang-format, please see the
  `ns-3 coding style section <https://www.nsnam.org/docs/contributing/html/coding-style.html#clang-format>`_
  on clang-format.

.. note::
  Different versions of ns-3 use different versions of clang-tidy.  Since the ns-3.46
  release, see the ``RELEASE_NOTES.md`` file for the currently supported versions.

Optional
********

Please see below subsections for Python-related package requirements.

+-----------------------------+------------------------------------------------------------+
| **Feature**                 | **apt Packages**                                           |
+=============================+============================================================+
| Reading pcap traces         | ``tcpdump wireshark``                                      |
+-----------------------------+------------------------------------------------------------+
| Database support            | ``sqlite sqlite3 libsqlite3-dev``                          |
+-----------------------------+------------------------------------------------------------+
| NetAnim animator            | ``qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools``      |
+-----------------------------+------------------------------------------------------------+
| MPI-based distributed       |                                                            |
| simulation                  | ``openmpi-bin openmpi-common openmpi-doc libopenmpi-dev``  |
+-----------------------------+------------------------------------------------------------+
| Building Doxygen            | ``doxygen graphviz imagemagick``                           |
+-----------------------------+------------------------------------------------------------+
| Sphinx documentation        | ``python3-sphinx dia imagemagick texlive dvipng latexmk``  |
|                             | ``texlive-extra-utils texlive-latex-extra``                |
|                             | ``texlive-font-utils``                                     |
+-----------------------------+------------------------------------------------------------+
| Eigen3                      | ``libeigen3-dev``                                          |
+-----------------------------+------------------------------------------------------------+
| GNU Scientific Library      | ``gsl-bin libgsl-dev libgslcblas0``                        |
+-----------------------------+------------------------------------------------------------+
| XML config store            | ``libxml2 libxml2-dev``                                    |
+-----------------------------+------------------------------------------------------------+
| GTK-based config store      | ``libgtk-3-dev``                                           |
+-----------------------------+------------------------------------------------------------+
| Emulation with virtual      |                                                            |
| machines and tap bridge     | ``lxc-utils lxc-templates iproute2 iptables``              |
+-----------------------------+------------------------------------------------------------+
| Support for openflow        | ``libxml2 libxml2-dev libboost-all-dev``                   |
+-----------------------------+------------------------------------------------------------+

.. note::
  For Ubuntu 20.10 and earlier, the single 'qt5-default' package suffices for NetAnim (``apt install qt5-default``)

Python bindings
===============

Python requires `Cppyy, <https://cppyy.readthedocs.io/en/latest/installation.html>` and specifically,
version 3.5.0 is the latest version known to work with ns-3 at this time.

ns-3.45 and newer::

  python3 -m pip install --user cppyy==3.5.0

ns-3.42-3.44::

  python3 -m pip install --user cppyy==3.1.2

ns-3.37-3.41::

  python3 -m pip install --user cppyy==2.4.2

ns-3.30-3.36 (also requires pybindgen, found in the ``allinone`` directory)::

  apt install python3-dev pkg-config python3-setuptools

PyViz visualizer
================

The PyViz visualizer uses a variety of Python packages supporting GraphViz.::

  apt install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3

For Ubuntu 18.04 and later, python-pygoocanvas is no longer provided. The ns-3.29 release and later upgrades the support to GTK+ version 3, and requires these packages:

For ns-3.28 and earlier releases, PyViz is based on Python2, GTK+ 2, GooCanvas, and GraphViz::

  apt install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev ipython

Generating modified python bindings (ns-3.36 and earlier)
=========================================================

To modify the Python bindings found in release 3.36 and earlier (not needed for modern releases,
or if you do not use Python).::

  apt install cmake libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake python3-pip
  python3 -m pip install --user cxxfilt

and you will want to install castxml and pygccxml as per the instructions for python bindings (or
through the bake build tool as described in the tutorial). The 'castxml' and 'pygccxml' packages
provided by Ubuntu 18.04 and earlier are not recommended; a source build (coordinated via bake)
is recommended. If you plan to work with bindings or rescan them for any ns-3 C++ changes you
might make, please read the chapter in the manual on this topic.

Caveats and troubleshooting
***************************

When building documentation, if you get an error such as
``convert ... not authorized source-temp/figures/lena-dual-stripe.eps``, see
`this post <https://cromwell-intl.com/open-source/pdf-not-authorized.html>`_ about editing
ImageMagick's security policy configuration.  In brief, you will want to make this kind of
change to ImageMagick security policy::

   --- ImageMagick-6/policy.xml.bak 2020-04-28 21:10:08.564613444 -0700
   +++ ImageMagick-6/policy.xml 2020-04-28 21:10:29.413438798 -0700
   @@ -87,10 +87,10 @@
      <policy domain="path" rights="none" pattern="@*"/>
   -  <policy domain="coder" rights="none" pattern="PS" />
   +  <policy domain="coder" rights="read|write" pattern="PS" />
      <policy domain="coder" rights="none" pattern="PS2" />
      <policy domain="coder" rights="none" pattern="PS3" />
      <policy domain="coder" rights="none" pattern="EPS" />
   -  <policy domain="coder" rights="none" pattern="PDF" />
   +  <policy domain="coder" rights="read|write" pattern="PDF" />
      <policy domain="coder" rights="none" pattern="XPS" />
    </policymap>