author | Tom Henderson <tomh@tomh.org> |
Sun, 05 May 2013 22:42:12 -0700 | |
changeset 9742 | b24738ffa84b |
parent 9189 | b6e9f47c260b |
child 9749 | ce15c45471d8 |
permissions | -rw-r--r-- |
6754 | 1 |
.. include:: replace.txt |
2 |
||
3 |
||
4 |
Getting Started |
|
5 |
--------------- |
|
6 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
7 |
This section is aimed at getting a user to a working state starting |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
8 |
with a machine that may never have had |ns3| installed. It covers |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
9 |
supported platforms, prerequisites, ways to obtain |ns3|, ways to |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
10 |
build |ns3|, and ways to verify your build and run simple programs. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
11 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
12 |
Overview |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
13 |
******** |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
14 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
15 |
|ns3| is built as a system of software libraries that work together. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
16 |
User programs can be written that links with (or imports from) these |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
17 |
libraries. User programs are written in either the C++ or Python |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
18 |
programming languages. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
19 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
20 |
|ns3| is distributed as source code, meaning that the target system |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
21 |
needs to have a software development environment to build the libraries |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
22 |
first, then build the user program. |ns3| could in principle be |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
23 |
distributed as pre-built libraries for selected systems, and in the |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
24 |
future it may be distributed that way, but at present, many users |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
25 |
actually do their work by editing |ns3| itself, so having the source |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
26 |
code around to rebuild the libraries is useful. If someone would like |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
27 |
to undertake the job of making pre-built libraries and packages for |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
28 |
operating systems, please contact the ns-developers mailing list. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
29 |
|
6754 | 30 |
Downloading ns-3 |
31 |
**************** |
|
32 |
||
33 |
The |ns3| system as a whole is a fairly complex system and has a |
|
34 |
number of dependencies on other components. Along with the systems you will |
|
8837 | 35 |
most likely deal with every day (the GNU toolchain, Mercurial, a text |
6754 | 36 |
editor) you will need to ensure that a number of additional libraries are |
37 |
present on your system before proceeding. |ns3| provides a wiki |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
38 |
page that includes pages with many useful hints and tips. |
6754 | 39 |
One such page is the "Installation" page, |
40 |
http://www.nsnam.org/wiki/index.php/Installation. |
|
41 |
||
42 |
The "Prerequisites" section of this wiki page explains which packages are |
|
43 |
required to support common |ns3| options, and also provides the |
|
44 |
commands used to install them for common Linux variants. Cygwin users will |
|
45 |
have to use the Cygwin installer (if you are a Cygwin user, you used it to |
|
46 |
install Cygwin). |
|
47 |
||
48 |
You may want to take this opportunity to explore the |ns3| wiki |
|
49 |
a bit since there really is a wealth of information there. |
|
50 |
||
51 |
From this point forward, we are going to assume that the reader is working in |
|
52 |
Linux or a Linux emulation environment (Linux, Cygwin, etc.) and has the GNU |
|
53 |
toolchain installed and verified along with the prerequisites mentioned |
|
54 |
above. We are also going to assume that you have Mercurial and Waf installed |
|
7314
7162e24118ea
Miscellaneous fixes to Tutorial
Mitch Watrous <watrous@u.washington.edu>
parents:
7275
diff
changeset
|
55 |
and running on the target system. |
6754 | 56 |
|
57 |
The |ns3| code is available in Mercurial repositories on the server |
|
58 |
http://code.nsnam.org. You can also download a tarball release at |
|
59 |
http://www.nsnam.org/releases/, or you can work with repositories |
|
60 |
using Mercurial. We recommend using Mercurial unless there's a good reason |
|
61 |
not to. See the end of this section for instructions on how to get a tarball |
|
62 |
release. |
|
63 |
||
64 |
The simplest way to get started using Mercurial repositories is to use the |
|
65 |
``ns-3-allinone`` environment. This is a set of scripts that manages the |
|
66 |
downloading and building of various subsystems of |ns3| for you. We |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
67 |
recommend that you begin your |ns3| work in this environment. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
68 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
69 |
Downloading ns-3 Using a Tarball |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
70 |
++++++++++++++++++++++++++++++++ |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
71 |
A tarball is a particular format of software archive where multiple |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
72 |
files are bundled together and the archive possibly compressed. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
73 |
|ns3| software releases are provided via a downloadable tarball. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
74 |
The process for downloading |ns3| via tarball is simple; you just |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
75 |
have to pick a release, download it and decompress it. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
76 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
77 |
Let's assume that you, as a user, wish to build |ns3| in a local |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
78 |
directory called ``workspace``. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
79 |
If you adopt the ``workspace`` directory approach, you can |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
80 |
get a copy of a release by typing the following into your Linux shell |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
81 |
(substitute the appropriate version numbers, of course): |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
82 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
83 |
:: |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
84 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
85 |
cd |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
86 |
mkdir workspace |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
87 |
cd workspace |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
88 |
wget http://www.nsnam.org/releases/ns-allinone-3.17.tar.bz2 |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
89 |
tar xjf ns-allinone-3.17.tar.bz2 |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
90 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
91 |
If you change into the directory ``ns-allinone-3.17`` you should see a |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
92 |
number of files: |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
93 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
94 |
:: |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
95 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
96 |
bake constants.py ns-3.17 README |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
97 |
build.py netanim-3.103 pybindgen-0.16.0.825 util.py |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
98 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
99 |
You are now ready to build the |ns3| distribution. |
6754 | 100 |
|
101 |
Downloading ns-3 Using Mercurial |
|
102 |
++++++++++++++++++++++++++++++++ |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
103 |
|ns3| can also be fetched from the project's master code repositories |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
104 |
using a tool called Mercurial. |
6754 | 105 |
One practice is to create a directory called ``repos`` in one's home |
106 |
directory under which one can keep local Mercurial repositories. |
|
107 |
*Hint: we will assume you do this later in the tutorial.* If you adopt |
|
108 |
that approach, you can get a copy of ``ns-3-allinone`` by typing the |
|
109 |
following into your Linux shell (assuming you have installed Mercurial): |
|
110 |
||
111 |
:: |
|
9163
950db74a6484
Minor fixes and corrections to tutorial formatting.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9107
diff
changeset
|
112 |
|
6754 | 113 |
cd |
114 |
mkdir repos |
|
115 |
cd repos |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
116 |
hg clone http://code.nsnam.org/bake |
6754 | 117 |
|
118 |
As the hg (Mercurial) command executes, you should see something like the |
|
119 |
following displayed, |
|
120 |
||
121 |
:: |
|
122 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
123 |
destination directory: bake |
6754 | 124 |
requesting all changes |
125 |
adding changesets |
|
126 |
adding manifests |
|
127 |
adding file changes |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
128 |
added 252 changesets with 661 changes to 62 files |
7654 | 129 |
updating to branch default |
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
130 |
45 files updated, 0 files merged, 0 files removed, 0 files unresolved |
6754 | 131 |
|
132 |
After the clone command completes, you should have a directory called |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
133 |
``bake``, the contents of which should |
6754 | 134 |
look something like the following: |
135 |
||
136 |
:: |
|
137 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
138 |
bake bakeconf.xml doc generate-binary.py TODO |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
139 |
bake.py examples test |
6754 | 140 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
141 |
Notice that you really just downloaded some Python scripts and a Python |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
142 |
module called ``bake``. The next step |
6754 | 143 |
will be to use those scripts to download and build the |ns3| |
144 |
distribution of your choice. |
|
145 |
||
146 |
If you go to the following link: http://code.nsnam.org/, |
|
147 |
you will see a number of repositories. Many are the private repositories of |
|
148 |
the |ns3| development team. The repositories of interest to you will |
|
149 |
be prefixed with "ns-3". Official releases of |ns3| will be |
|
150 |
numbered as ``ns-3.<release>.<hotfix>``. For example, a second hotfix to a |
|
7275 | 151 |
still hypothetical release forty two of |ns3| would be numbered as |
152 |
``ns-3.42.2``. |
|
6754 | 153 |
|
154 |
The current development snapshot (unreleased) of |ns3| may be found |
|
155 |
at http://code.nsnam.org/ns-3-dev/. The |
|
156 |
developers attempt to keep these repository in consistent, working states but |
|
157 |
they are in a development area with unreleased code present, so you may want |
|
158 |
to consider staying with an official release if you do not need newly- |
|
159 |
introduced features. |
|
160 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
161 |
Since the release numbers are going to be changing, we will stick with |
6754 | 162 |
the more constant ns-3-dev here in the tutorial, but you can replace the |
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
163 |
string "ns-3-dev" with your choice of release (e.g., ns-3.17) in the |
6754 | 164 |
text below. You can find the latest version of the |
165 |
code either by inspection of the repository list or by going to the |
|
7314
7162e24118ea
Miscellaneous fixes to Tutorial
Mitch Watrous <watrous@u.washington.edu>
parents:
7275
diff
changeset
|
166 |
`"ns-3 Releases" |
7162e24118ea
Miscellaneous fixes to Tutorial
Mitch Watrous <watrous@u.washington.edu>
parents:
7275
diff
changeset
|
167 |
<http://www.nsnam.org/releases>`_ |
7162e24118ea
Miscellaneous fixes to Tutorial
Mitch Watrous <watrous@u.washington.edu>
parents:
7275
diff
changeset
|
168 |
web page and clicking on the latest release link. |
6754 | 169 |
|
170 |
Go ahead and change into the ``ns-3-allinone`` directory you created when |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
171 |
you cloned that repository. We are now going to use the bake tool |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
172 |
to pull down the various pieces of |ns3| you will be using. |
6754 | 173 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
174 |
Go ahead and type the following into your shell: |
6754 | 175 |
|
176 |
:: |
|
177 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
178 |
./bake.py configure -e ns-3.17 |
6754 | 179 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
180 |
Next, we'l ask bake to check whether we have enough tools to download |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
181 |
various components. Type: |
6754 | 182 |
|
183 |
:: |
|
184 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
185 |
./bake.py check |
6754 | 186 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
187 |
You should see something like the following, |
6754 | 188 |
|
189 |
:: |
|
190 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
191 |
> Python - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
192 |
> GNU C++ compiler - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
193 |
> Mercurial - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
194 |
> CVS - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
195 |
> GIT - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
196 |
> Bazaar - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
197 |
> Tar tool - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
198 |
> Unzip tool - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
199 |
> Unrar tool - is missing |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
200 |
> 7z data compression utility - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
201 |
> XZ data compression utility - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
202 |
> Make - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
203 |
> cMake - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
204 |
> patch tool - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
205 |
> autoreconf tool - OK |
6754 | 206 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
207 |
> Path searched for tools: /usr/lib64/qt-3.3/bin /usr/lib64/ccache /usr/local/bin /bin /usr/bin /usr/local/sbin /usr/sbin /sbin /home/tomh/bin bin |
6754 | 208 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
209 |
In particular, download tools such as Mercurial, CVS, GIT, and Bazaar |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
210 |
are our principal concerns at thi spoint, since they allow us to fetch |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
211 |
the code. Please install missing tools at this stage if you are able to. |
6754 | 212 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
213 |
Next, try to download the software: |
6754 | 214 |
|
215 |
:: |
|
216 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
217 |
python ./bake.py download |
6754 | 218 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
219 |
should yield something like: |
6754 | 220 |
|
221 |
:: |
|
222 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
223 |
>> Searching for system dependency pygoocanvas - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
224 |
>> Searching for system dependency python-dev - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
225 |
>> Searching for system dependency pygraphviz - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
226 |
>> Downloading pybindgen-0.16.0.825 - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
227 |
>> Searching for system dependency g++ - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
228 |
>> Searching for system dependency qt4 - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
229 |
>> Downloading netanim-3.103 - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
230 |
>> Downloading ns-3.17 - OK |
6754 | 231 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
232 |
The above suggests that three sources have been downloaded. Check the |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
233 |
``source`` directory now and type ``ls``; one should see: |
6754 | 234 |
|
235 |
:: |
|
236 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
237 |
netanim-3.103 ns-3.17 pybindgen-0.16.0.825 |
6754 | 238 |
|
239 |
You are now ready to build the |ns3| distribution. |
|
240 |
||
241 |
Building ns-3 |
|
242 |
************* |
|
243 |
||
244 |
Building with build.py |
|
245 |
++++++++++++++++++++++ |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
246 |
When working from a released tarball, the first time you build the |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
247 |
|ns3| project you can build using a convenience program found in the |
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
248 |
``allinone`` directory. This program is called ``build.py``. This |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
249 |
program will get the project configured for you |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
250 |
in the most commonly useful way. However, please note that more advanced |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
251 |
configuration and work with |ns3| will typically involve using the |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
252 |
native |ns3| build system, Waf, to be introduced later in this tutorial. |
6754 | 253 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
254 |
If you downloaded |
6754 | 255 |
using a tarball you should have a directory called something like |
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
256 |
``ns-allinone-3.17`` under your ``~/workspace`` directory. |
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
257 |
Type the following: |
6754 | 258 |
|
259 |
:: |
|
260 |
||
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
261 |
./build.py --enable-examples --enable-tests |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6754
diff
changeset
|
262 |
|
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
263 |
Because we are working with examples and tests in this tutorial, and |
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
264 |
because they are not built by default in |ns3|, the arguments for |
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
265 |
build.py tells it to build them for us. The program also defaults to |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
266 |
building all available modules. Later, you can build |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
267 |
|ns3| without examples and tests, or eliminate the modules that |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
268 |
are not necessary for your work, if you wish. |
6754 | 269 |
|
270 |
You will see lots of typical compiler output messages displayed as the build |
|
271 |
script builds the various pieces you downloaded. Eventually you should see the |
|
272 |
following magic words: |
|
273 |
||
274 |
:: |
|
275 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
276 |
Waf: Leaving directory `/path/to/workspace/ns-allinone-3.17/ns-3.17/build' |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
277 |
'build' finished successfully (6m25.032s) |
7071 | 278 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
279 |
Modules built: |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
280 |
antenna aodv applications |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
281 |
bridge buildings config-store |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
282 |
core csma csma-layout |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
283 |
dsdv dsr emu |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
284 |
energy fd-net-device flow-monitor |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
285 |
internet lte mesh |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
286 |
mobility mpi netanim (no Python) |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
287 |
network nix-vector-routing olsr |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
288 |
point-to-point point-to-point-layout propagation |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
289 |
spectrum stats tap-bridge |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
290 |
test (no Python) tools topology-read |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
291 |
uan virtual-net-device wifi |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
292 |
wimax |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
293 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
294 |
Modules not built (see ns-3 tutorial for explanation): |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
295 |
brite click openflow |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
296 |
visualizer |
6754 | 297 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
298 |
Leaving directory `./ns-3.17` |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
299 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
300 |
Regarding the portion about modules not built: |
9169
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
301 |
|
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
302 |
:: |
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
303 |
|
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
304 |
Modules not built (see ns-3 tutorial for explanation): |
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
305 |
brite click openflow |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
306 |
visualizer |
9169
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
307 |
|
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
308 |
This just means that some ns-3 modules that have dependencies on |
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
309 |
outside libraries may not have been built, or that the configuration |
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
310 |
specifically asked not to build them. It does not mean that the |
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
311 |
simulator did not build successfully or that it will provide wrong |
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
312 |
results for the modules listed as being built. |
f8bff624db3c
clarify 'Modules not built' waf report
Tom Henderson <tomh@tomh.org>
parents:
9163
diff
changeset
|
313 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
314 |
Building with bake |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
315 |
++++++++++++++++++ |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
316 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
317 |
If you used bake above to fetch source code from project repositories, you |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
318 |
may continue to use it to build |ns3|. Type |
6754 | 319 |
|
320 |
:: |
|
321 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
322 |
python bake.py build |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
323 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
324 |
and you should see something like: |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
325 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
326 |
:: |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
327 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
328 |
>> Building pybindgen-0.16.0.825 - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
329 |
>> Building netanim-3.103 - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
330 |
>> Building ns-3.17 - OK |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
331 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
332 |
If there happens to be a failure, please have a look at what the following |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
333 |
command tells you; it may give a hint as to a missing dependency: |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
334 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
335 |
:: |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
336 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
337 |
python bake.py show |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
338 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
339 |
This will list out the various dependencies of the packages you are |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
340 |
trying to build. |
6754 | 341 |
|
342 |
Building with Waf |
|
343 |
+++++++++++++++++ |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
344 |
|
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
345 |
Up to this point, we have used either the `build.py` script, or the |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
346 |
`bake` tool, to get started with building |ns3|. These tools are useful |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
347 |
for building |ns3| and supporting libraries, and they call into |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
348 |
the |ns3| directory to call the Waf build tool to do the actual building. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
349 |
Most users quickly transition to using Waf directly to configure and |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
350 |
build |ns3|. So, to proceed, please change your working directory to |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
351 |
the |ns3| directory that you have initially built. |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
352 |
|
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
353 |
It's not |
6754 | 354 |
strictly required at this point, but it will be valuable to take a slight |
355 |
detour and look at how to make changes to the configuration of the project. |
|
356 |
Probably the most useful configuration change you can make will be to |
|
357 |
build the optimized version of the code. By default you have configured |
|
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6754
diff
changeset
|
358 |
your project to build the debug version. Let's tell the project to |
6754 | 359 |
make an optimized build. To explain to Waf that it should do optimized |
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
360 |
builds that include the examples and tests, you will need to execute the |
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
361 |
following commands, |
6754 | 362 |
|
363 |
:: |
|
364 |
||
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
365 |
./waf clean |
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
366 |
./waf -d optimized --enable-examples --enable-tests configure |
6754 | 367 |
|
368 |
This runs Waf out of the local directory (which is provided as a convenience |
|
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
369 |
for you). The first command to clean out the previous build is not |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
370 |
typically strictly necessary but is good practice; it will remove the |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
371 |
previously built libraries and object files found in directory ``build/``. |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
372 |
When the project is reconfigured and the build system checks for various |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
373 |
dependencies, you should see |
6754 | 374 |
output that looks similar to the following, |
375 |
||
376 |
:: |
|
377 |
||
378 |
Checking for program g++ : ok /usr/bin/g++ |
|
379 |
Checking for program cpp : ok /usr/bin/cpp |
|
380 |
Checking for program ar : ok /usr/bin/ar |
|
381 |
Checking for program ranlib : ok /usr/bin/ranlib |
|
382 |
Checking for g++ : ok |
|
383 |
Checking for program pkg-config : ok /usr/bin/pkg-config |
|
384 |
Checking for -Wno-error=deprecated-declarations support : yes |
|
385 |
Checking for -Wl,--soname=foo support : yes |
|
386 |
Checking for header stdlib.h : ok |
|
387 |
Checking for header signal.h : ok |
|
388 |
Checking for header pthread.h : ok |
|
389 |
Checking for high precision time implementation : 128-bit integer |
|
390 |
Checking for header stdint.h : ok |
|
391 |
Checking for header inttypes.h : ok |
|
392 |
Checking for header sys/inttypes.h : not found |
|
393 |
Checking for library rt : ok |
|
394 |
Checking for header netpacket/packet.h : ok |
|
395 |
Checking for pkg-config flags for GSL : ok |
|
396 |
Checking for header linux/if_tun.h : ok |
|
397 |
Checking for pkg-config flags for GTK_CONFIG_STORE : ok |
|
398 |
Checking for pkg-config flags for LIBXML2 : ok |
|
399 |
Checking for library sqlite3 : ok |
|
400 |
Checking for NSC location : ok ../nsc (guessed) |
|
401 |
Checking for library dl : ok |
|
402 |
Checking for NSC supported architecture x86_64 : ok |
|
403 |
Checking for program python : ok /usr/bin/python |
|
404 |
Checking for Python version >= 2.3 : ok 2.5.2 |
|
405 |
Checking for library python2.5 : ok |
|
406 |
Checking for program python2.5-config : ok /usr/bin/python2.5-config |
|
407 |
Checking for header Python.h : ok |
|
408 |
Checking for -fvisibility=hidden support : yes |
|
409 |
Checking for pybindgen location : ok ../pybindgen (guessed) |
|
410 |
Checking for Python module pybindgen : ok |
|
411 |
Checking for pybindgen version : ok 0.10.0.640 |
|
412 |
Checking for Python module pygccxml : ok |
|
413 |
Checking for pygccxml version : ok 0.9.5 |
|
414 |
Checking for program gccxml : ok /usr/local/bin/gccxml |
|
415 |
Checking for gccxml version : ok 0.9.0 |
|
416 |
Checking for program sudo : ok /usr/bin/sudo |
|
417 |
Checking for program hg : ok /usr/bin/hg |
|
418 |
Checking for program valgrind : ok /usr/bin/valgrind |
|
419 |
---- Summary of optional NS-3 features: |
|
420 |
Threading Primitives : enabled |
|
421 |
Real Time Simulator : enabled |
|
422 |
Emulated Net Device : enabled |
|
423 |
GNU Scientific Library (GSL) : enabled |
|
424 |
Tap Bridge : enabled |
|
425 |
GtkConfigStore : enabled |
|
426 |
XmlIo : enabled |
|
427 |
SQlite stats data output : enabled |
|
428 |
Network Simulation Cradle : enabled |
|
429 |
Python Bindings : enabled |
|
430 |
Python API Scanning Support : enabled |
|
431 |
Use sudo to set suid bit : not enabled (option --enable-sudo not selected) |
|
7071 | 432 |
Build tests : enabled |
7025
32212c736ab4
Move examples out of samples directory and remove it
Mitch Watrous <watrous@u.washington.edu>
parents:
7024
diff
changeset
|
433 |
Build examples : enabled |
6754 | 434 |
Static build : not enabled (option --enable-static not selected) |
435 |
'configure' finished successfully (2.870s) |
|
436 |
||
437 |
Note the last part of the above output. Some ns-3 options are not enabled by |
|
438 |
default or require support from the underlying system to work properly. |
|
439 |
For instance, to enable XmlTo, the library libxml-2.0 must be found on the |
|
440 |
system. If this library were not found, the corresponding |ns3| feature |
|
441 |
would not be enabled and a message would be displayed. Note further that there is |
|
442 |
a feature to use the program ``sudo`` to set the suid bit of certain programs. |
|
443 |
This is not enabled by default and so this feature is reported as "not enabled." |
|
444 |
||
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
445 |
Now go ahead and switch back to the debug build that includes the examples and tests. |
6754 | 446 |
|
447 |
:: |
|
448 |
||
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
449 |
./waf clean |
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
450 |
./waf -d debug --enable-examples --enable-tests configure |
6754 | 451 |
|
452 |
The build system is now configured and you can build the debug versions of |
|
7654 | 453 |
the |ns3| programs by simply typing |
6754 | 454 |
|
455 |
:: |
|
456 |
||
457 |
./waf |
|
458 |
||
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
459 |
Okay, sorry, I made you build the |ns3| part of the system twice, |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
460 |
but now you know how to change the configuration and build optimized code. |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
461 |
|
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
462 |
Here are a few more introductory tips about Waf. |
6754 | 463 |
Some waf commands are meaningful during the build phase and some commands are valid |
464 |
in the configuration phase. For example, if you wanted to use the emulation |
|
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6754
diff
changeset
|
465 |
features of |ns3|, you might want to enable setting the suid bit using |
6754 | 466 |
sudo as described above. This turns out to be a configuration-time command, and so |
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
467 |
you could reconfigure using the following command that also includes the examples and tests |
6754 | 468 |
|
469 |
:: |
|
470 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
471 |
./waf configure -d debug --enable-sudo --enable-examples --enable-tests |
6754 | 472 |
|
473 |
If you do this, waf will have run sudo to change the socket creator programs of the |
|
474 |
emulation code to run as root. There are many other configure- and build-time options |
|
475 |
available in waf. To explore these options, type: |
|
476 |
||
477 |
:: |
|
478 |
||
479 |
./waf --help |
|
480 |
||
481 |
We'll use some of the testing-related commands in the next section. |
|
482 |
||
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
483 |
Finally, as an aside, it is possible to specify that waf builds the |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
484 |
project in |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
485 |
a directory different than the default ``build/`` directory by passing |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
486 |
the ``-o`` option to configure; e.g. |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
487 |
|
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
488 |
:: |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
489 |
|
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
490 |
./waf configure -d debug -o build/debug --enable-examples --enable-tests |
7661
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
491 |
|
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
492 |
This allows users to work with multiple builds rather than always |
9ef562047d3e
some clarifications to the use of build.py in the tutorial
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
493 |
overwriting the last build. |
6754 | 494 |
|
9189
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
495 |
In the examples above, waf uses GCC C++ compiler, command ``g++``, for |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
496 |
building ns-3. However, it's possible to change C++ compiler used by waf. |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
497 |
Say one wants to use Clang C++ compiler, command ``clang++``; it's done by |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
498 |
|
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
499 |
:: |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
500 |
|
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
501 |
CXX="clang++" ./waf configure |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
502 |
./waf build |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
503 |
|
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
504 |
One can also set up waf to do distributed compilation with ``distcc`` in |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
505 |
a similar way: |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
506 |
|
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
507 |
:: |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
508 |
|
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
509 |
CXX="distcc g++" ./waf configure |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
510 |
./waf build |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
511 |
|
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
512 |
More info on distcc and distributed compilation can be found on it's |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
513 |
`project page |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
514 |
<http://code.google.com/p/distcc/>`_ |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
515 |
under Documentation section. |
b6e9f47c260b
Document building with distcc in tutorial, add it to RELEASE_NOTES and CHANGES.html.
Vedran Mileti? <rivanvx@gmail.com>
parents:
9169
diff
changeset
|
516 |
|
6754 | 517 |
Testing ns-3 |
518 |
************ |
|
519 |
||
520 |
You can run the unit tests of the |ns3| distribution by running the |
|
521 |
"./test.py -c core" script, |
|
522 |
||
523 |
:: |
|
524 |
||
525 |
./test.py -c core |
|
526 |
||
527 |
These tests are run in parallel by waf. You should eventually |
|
528 |
see a report saying that, |
|
529 |
||
530 |
:: |
|
531 |
||
7654 | 532 |
92 of 92 tests passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors) |
6754 | 533 |
|
534 |
This is the important message. |
|
535 |
||
536 |
You will also see output from the test runner and the output will actually look something like, |
|
537 |
||
538 |
:: |
|
539 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
540 |
Waf: Entering directory `/path/to/workspace/ns-3-allinone/ns-3-dev/build' |
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
541 |
Waf: Leaving directory `/path/to/workspace/ns-3-allinone/ns-3-dev/build' |
6754 | 542 |
'build' finished successfully (1.799s) |
7071 | 543 |
|
544 |
Modules built: |
|
7275 | 545 |
aodv applications bridge |
546 |
click config-store core |
|
547 |
csma csma-layout dsdv |
|
548 |
emu energy flow-monitor |
|
549 |
internet lte mesh |
|
550 |
mobility mpi netanim |
|
551 |
network nix-vector-routing ns3tcp |
|
552 |
ns3wifi olsr openflow |
|
553 |
point-to-point point-to-point-layout propagation |
|
554 |
spectrum stats tap-bridge |
|
555 |
template test tools |
|
556 |
topology-read uan virtual-net-device |
|
557 |
visualizer wifi wimax |
|
7071 | 558 |
|
6754 | 559 |
PASS: TestSuite ns3-wifi-interference |
560 |
PASS: TestSuite histogram |
|
561 |
PASS: TestSuite sample |
|
562 |
PASS: TestSuite ipv4-address-helper |
|
563 |
PASS: TestSuite devices-wifi |
|
564 |
PASS: TestSuite propagation-loss-model |
|
565 |
||
566 |
... |
|
567 |
||
568 |
PASS: TestSuite attributes |
|
569 |
PASS: TestSuite config |
|
570 |
PASS: TestSuite global-value |
|
571 |
PASS: TestSuite command-line |
|
572 |
PASS: TestSuite basic-random-number |
|
573 |
PASS: TestSuite object |
|
574 |
PASS: TestSuite random-number-generators |
|
7654 | 575 |
92 of 92 tests passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors) |
6754 | 576 |
|
7654 | 577 |
This command is typically run by users to quickly verify that an |
6754 | 578 |
|ns3| distribution has built correctly. |
579 |
||
580 |
Running a Script |
|
581 |
**************** |
|
582 |
We typically run scripts under the control of Waf. This allows the build |
|
583 |
system to ensure that the shared library paths are set correctly and that |
|
584 |
the libraries are available at run time. To run a program, simply use the |
|
585 |
``--run`` option in Waf. Let's run the |ns3| equivalent of the |
|
586 |
ubiquitous hello world program by typing the following: |
|
587 |
||
588 |
:: |
|
589 |
||
590 |
./waf --run hello-simulator |
|
591 |
||
592 |
Waf first checks to make sure that the program is built correctly and |
|
593 |
executes a build if required. Waf then executes the program, which |
|
594 |
produces the following output. |
|
595 |
||
596 |
:: |
|
597 |
||
598 |
Hello Simulator |
|
599 |
||
600 |
*Congratulations. You are now an ns-3 user.* |
|
601 |
||
602 |
*What do I do if I don't see the output?* |
|
603 |
||
9107 | 604 |
If you see ``waf`` messages indicating that the build was |
6754 | 605 |
completed successfully, but do not see the "Hello Simulator" output, |
606 |
chances are that you have switched your build mode to "optimized" in |
|
607 |
the "Building with Waf" section, but have missed the change back to |
|
608 |
"debug" mode. All of the console output used in this tutorial uses a |
|
609 |
special |ns3| logging component that is useful for printing |
|
610 |
user messages to the console. Output from this component is |
|
611 |
automatically disabled when you compile optimized code -- it is |
|
612 |
"optimized out." If you don't see the "Hello Simulator" output, |
|
613 |
type the following, |
|
614 |
||
615 |
:: |
|
616 |
||
9742
b24738ffa84b
update tutorial for bake usage
Tom Henderson <tomh@tomh.org>
parents:
9189
diff
changeset
|
617 |
./waf configure -d debug --enable-examples --enable-tests |
6754 | 618 |
|
619 |
to tell ``waf`` to build the debug versions of the |ns3| |
|
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6998
diff
changeset
|
620 |
programs that includes the examples and tests. You must still build |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6754
diff
changeset
|
621 |
the actual debug version of the code by typing, |
6754 | 622 |
|
623 |
:: |
|
624 |
||
625 |
./waf |
|
626 |
||
627 |
Now, if you run the ``hello-simulator`` program, you should see the |
|
628 |
expected output. |
|
629 |
||
630 |
If you want to run programs under another tool such as gdb or valgrind, |
|
631 |
see this `wiki entry |
|
632 |
<http://www.nsnam.org/wiki/index.php/User_FAQ#How_to_run_NS-3_programs_under_another_tool>`_. |
|
633 |