Project

General

Profile

Installation » History » Version 63

Tony Ciavarella, 05/15/2014 11:19 PM

1 1 Tony Ciavarella
h1. Installation
2
3 5 Tony Ciavarella
h2. Obtaining the Source Code
4 1 Tony Ciavarella
5 2 Tony Ciavarella
h3. Release Tarballs
6
7 4 Tony Ciavarella
Release source tarballs are available on the "Files":http://oss.squalllinesoftware.com/projects/disorder/files page.  This is what you want if you are looking for stability and something ready for production use.  You'll probably want to use the most recent version found on that page.
8 2 Tony Ciavarella
9
h3. SCM
10
11 55 Tony Ciavarella
The Disorder source code is hosted in a "Mercurial":http://mercurial.selenic.com repository.  This is what you want if you are looking for the very latest bleeding edge of the code for contributing to Disorder, forking an evil fork, or whatever other reason you may have.
12 2 Tony Ciavarella
13 54 Tony Ciavarella
Read the "Mercurial Documentation":http://hgbook.red-bean.com/ if you aren't familiar with that and you want to go this route.
14 27 Tony Ciavarella
15 53 Tony Ciavarella
To clone the repository including the full history:
16 54 Tony Ciavarella
<pre>hg clone http://hg.squalllinesoftware.com/oss/disorder</pre>
17 2 Tony Ciavarella
18 1 Tony Ciavarella
h2. Prerequisites
19
20 38 Tony Ciavarella
Given the assumption that a somewhat sane build environment for C++ already exists on the build machine, the following third party things are required to build Disorder:
21 6 Tony Ciavarella
* "Boost":http://www.boost.org >= 1.49.0
22 8 Tony Ciavarella
* "Eigen":http://eigen.tuxfamily.org >= 3.0.5
23 45 Tony Ciavarella
* C++ version of the "SEDRIS SRM":http://www.sedris.org/srm_4.4/srm_c_cpp.htm >= 4.4.0
24
** The SEDRIS SRM is optional but you will need some kind of sophisticated geospatial thing if you don't use the SEDRIS SRM and you'll have to implement your own version of disorder's geospatial Convertor interface.
25 1 Tony Ciavarella
* A "Python":http://www.python.org interpreter (needed to use the "waf":https://code.google.com/p/waf/ build system)
26 52 Tony Ciavarella
* A C++ compiler capable of understanding the "ISO C++ 2011 Standard":http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50372
27
** "GCC":http://gcc.gnu.org >= 4.7.0
28
** "Clang++":http://clang.llvm.org >= 3.1.0
29 63 Tony Ciavarella
** Visual Studio = 2013 (version 12.x)
30
*** If you intend to use Visual Studio to build this thing on Windows, you're going to need 2013.  Visual Stupido is way behind in standards compliance.  They haven't even bothered to comply with the C99 standard yet.  Their C++11 support is not good in many areas so some things aren't as good as they could be when using disorder on Windows.
31
*** The express version may work, but using it to build an open source project may be a violation of Microsoft's silly license.
32 59 Tony Ciavarella
*** You can, of course, use gcc to build disorder on windows in a "cygwin":http://cygwin.org/ environment, but you should expect pain because SEDRIS won't build on cygwin out of the box.
33 1 Tony Ciavarella
34 13 Tony Ciavarella
Build and install these things in accordance with the instructions for your operating system provided by each vendor.  Some hints for certain platforms follow.
35 1 Tony Ciavarella
36 8 Tony Ciavarella
h3. Debian Linux and Derivatives
37
38 39 Tony Ciavarella
h4. Debian 6.x (Squeeze)
39
40 41 Tony Ciavarella
The binary packages for "Boost":http://www.boost.org and "Eigen":http://eigen.tuxfamily.org in the package system are way too old.  You'll have to download the source for them and build "Boost":http://www.boost.org yourself.
41 39 Tony Ciavarella
42
h4. Debian >= 7.x (Wheezy)
43 40 Tony Ciavarella
44 39 Tony Ciavarella
All the dependencies are available via the package system.  To install the Boost and Eigen build dependencies on Debian and maybe other derivatives:
45 8 Tony Ciavarella
<pre>sudo apt-get install libboost-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev libeigen3-dev</pre>
46 1 Tony Ciavarella
47
If you don't already have python, this will get the required bits of that:
48
<pre>sudo apt-get install python</pre>
49 13 Tony Ciavarella
50 33 Tony Ciavarella
h3. Sabayon Linux
51
52 42 Tony Ciavarella
To install boost via the entropy package system:
53 33 Tony Ciavarella
<pre>sudo equo install boost</pre>
54
55 37 Tony Ciavarella
As of 2/22/2013, the Eigen verison in entropy is a bit outdated (3.0.6).  You can use it, but you probably should download the latest version from "Eigen":http://eigen.tuxfamily.org which doesn't require any compilation.  Just extract the content of the archive somewhere and remember to tell Disorder where to find it with --eigen-root=<put actual path to eigen root here> during the configuration step.
56 33 Tony Ciavarella
57 35 Tony Ciavarella
If you don't already have python, this will get the required bits of that: <pre>sudo equo install python</pre>
58 34 Tony Ciavarella
59 13 Tony Ciavarella
h2. Configuration
60
61
If everything is setup properly, this step will be a breeze, but it is important to resolve any errors produced by the configuration step prior to attempting to compile Disorder.
62
63 46 Tony Ciavarella
h3. General
64
65
The basic idea of configuration is to allow disorder to learn enough about your build platform to be able to compile.  Disorder uses the 
66 47 Tony Ciavarella
"waf":https://code.google.com/p/waf/ build system to configure and compile. In general terms, you want to invoke waf with the configure target like this:
67 46 Tony Ciavarella
<pre>./waf configure</pre>
68
69
On linux-like systems, waf will attempt to find "Boost":http://www.boost.org and "Eigen":http://eigen.tuxfamily.org but you can override this behavior in the event of non-standard installation location or fanciful whimsy.  You will always have to tell it where to find the SEDRIS SRM however.  The options for configuring disorder's dependencies can be found by issuing the following command:
70
<pre>./waf --help</pre>
71
72
Said options are thusly enumerated for your convenience:
73
74
h4. Boost
75 49 Tony Ciavarella
76 46 Tony Ciavarella
|_. Option |_. Argument |_. Description |
77
| --boost-includes | path to the Boost includes root (eg. /opt/boost_1_49_0) | Tells disorder where to find the include files for the Boost libraries. |
78 48 Tony Ciavarella
| --boost-libs | path to the directory where the compiled Boost libraries are (eg. /opt/boost_1_49_0/stage/lib) | Tells disorder where to find Boost's compiled library files. |
79 46 Tony Ciavarella
| --boost-static | none | Links disorder against static Boost libraries instead of the default shared library linkage. |
80
| --boost-mt | none | Links disorder against the multi-threaded versions of the Boost libraries. |
81
| --boost-abi | desired tags from dgsyp | Select Boost libraries with tags.  See Boost documentation ("Unixes":http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html#library-naming, "windows":http://www.boost.org/doc/libs/1_53_0/more/getting_started/windows.html#library-naming) for more information. |
82
| --boost-toolset | desired toolset (eg. msvc, vc90, or gcc) | Overrides the automatic toolset detection as specified. |
83
84
h4. Eigen
85 49 Tony Ciavarella
86 46 Tony Ciavarella
|_. Option |_. Argument |_. Description |
87 50 Tony Ciavarella
| --eigen-root | path to the root of the Eigen library (eg. /opt/eigen-3.1.2) | Tells disorder where to find the Eigen library. |
88 46 Tony Ciavarella
89
h4. SEDRIS SRM
90 49 Tony Ciavarella
91 46 Tony Ciavarella
|_. Option |_. Argument |_. Description |
92 48 Tony Ciavarella
| --sedris-srm-root | path to the root of the SEDRIS SRM tree (eg. /opt/srm) | Tells disorder where to find the SEDRIS SRM.  This argument is *required*. |
93 46 Tony Ciavarella
| --sedris-srm-static | none | Links disorder against the static SEDRIS SRM library instead of the default dynamic one. |
94
| --sedris-srm-build-variant | build variant directory (eg. linux-3.5.0-sabayon-i386-gnu-/OPT) to find the compiled output files | Overrides the default selection of the first build variant found. |
95
96 15 Tony Ciavarella
h3. Linux
97 13 Tony Ciavarella
98
From inside the root of the Disorder tree do this in your favorite terminal emulator:
99
<pre>./waf configure --sedris-srm-root=<put the path to the SEDRIS SRM root here></pre>
100
For example, if your SEDRIS SRM is in /opt/sedris/srm:
101
<pre>./waf configure --sedris-srm-root=/opt/sedris/srm</pre>
102
103
That command will take several seconds and print a bunch of hopefully green stuff.  The output should end up looking something like this:
104
<pre>
105
Setting top to                           : /opt/disorder 
106
Setting out to                           : /opt/disorder/bin 
107
Checking for 'g++' (c++ compiler)        : /usr/bin/g++ 
108
Checking for program doxygen             : /usr/bin/doxygen 
109
Checking for program tar                 : /bin/tar 
110
Checking boost ABI tag                   :  
111
Checking boost includes                  : 1_49 
112
Checking boost libs                      : ok 
113
Checking for boost linkage               : ok 
114
Checking for header boost/asio.hpp       : yes 
115
Checking for header boost/bind.hpp       : yes 
116
Checking for header boost/date_time.hpp  : yes 
117
Checking for header boost/detail/endian.hpp : yes 
118
Checking for header boost/format.hpp        : yes 
119
Checking for header boost/function.hpp      : yes 
120
Checking for header boost/functional/factory.hpp : yes 
121
Checking for header boost/ptr_container/ptr_vector.hpp : yes 
122
Checking for header boost/scoped_ptr.hpp               : yes 
123
Checking for header boost/static_assert.hpp            : yes 
124
Checking for header boost/thread.hpp                   : yes 
125
Checking for program pkg-config                        : /usr/bin/pkg-config 
126
Checking for 'eigen3'                                  : yes 
127
Checking for header Eigen/Dense                        : yes 
128
Checking for SEDRIS SRM                                : /opt/sedris/srm 
129
Checking for SEDRIS SRM include directory              : /opt/sedris/srm/src/include 
130
Checking for SEDRIS SRM library directory              : /opt/sedris/srm/lib/linux-3.1.0-1-amd64-i386-gnu-/OPT 
131
SEDRIS SRM library                                     : /opt/sedris/srm/lib/linux-3.1.0-1-amd64-i386-gnu-/OPT/libsrm.so 
132
Checking for header srf_all.h                          : yes 
133
'configure' finished successfully (25.518s)
134
</pre>
135
136 18 Tony Ciavarella
If you get an error instead of that last line saying that 'configure' finished successfully, you must fix whatever is making it unhappy and try again.
137 13 Tony Ciavarella
138 19 Tony Ciavarella
h4. Clang++
139 16 Tony Ciavarella
140 32 Tony Ciavarella
To use the "Clang":http://clang.llvm.org/ C++ compiler instead of "GCC":http://gcc.gnu.org/, assuming clang++ is installed on the build system:
141 16 Tony Ciavarella
<pre>CXX=<put the path to clang++ here> ./waf configure --sedris-srm-root=<put the path to the SEDRIS SRM root here></pre>
142
143 19 Tony Ciavarella
For example:
144 16 Tony Ciavarella
<pre>CXX=/usr/bin/clang++ ./waf configure --sedris-srm-root=/opt/sedris/srm</pre>
145
146 13 Tony Ciavarella
h3. Windows
147
148
On windows, your $PATH environment variable needs to include the path to the Python interpreter.
149
150 30 Tony Ciavarella
The easiest way to configure Disorder on Windows is to use a modified version of the provided batch file to tell Disorder where your prerequisites live.  Copy the template from @tools/windows/configure.bat@ to the root of the Disorder tree.
151 1 Tony Ciavarella
152 30 Tony Ciavarella
This file contains some variables near the middle that must be set according to your system configuration.  An example is provided in the template for guidance.
153
154
Once you are finished editing configure.bat, it's time to execute it.  From the command line:
155
<pre>configure.bat</pre>
156
157
If everything is successful, you should get something that looks like this:
158
<pre>
159
C:\oss\disorder>python waf configure --boost-includes=c:\oss\boost_1_48_0 --boost-libs=c:\oss\boost_1_48_0\stage\lib --boost-mt --boost-static --eigen-root=c:\oss\eigen-3.0.4 --sedris-srm-root=c:\oss\sedris\srm --sedris-srm-static
160
Setting top to                           : C:\oss\disorder
161
Setting out to                           : C:\oss\disorder\bin
162
Checking for 'msvc' (c++ compiler)       : c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\CL.exe
163
Checking for program doxygen             : not found
164
Checking for Eigen library               : c:\oss\eigen-3.0.4
165
Checking for header Eigen/Dense          : yes
166
Checking for SEDRIS SRM                  : c:\oss\sedris\srm
167
Checking for SEDRIS SRM include directory : c:\oss\sedris\srm\src\include
168
Checking for SEDRIS SRM library directory : c:\oss\sedris\srm\lib\[Debug/Release]
169
Checking for header srf_all.h             : yes
170
Configuring boost libraries               : debug variant
171
Checking boost ABI tag                    : gd
172
Checking boost includes                   : 1_48
173
Checking boost libs                       : ok
174
Checking for boost linkage                : ok
175
Checking for header boost/asio.hpp        : yes
176
Checking for header boost/bind.hpp        : yes
177
Checking for header boost/date_time.hpp   : yes
178
Checking for header boost/detail/endian.hpp : yes
179
Checking for header boost/format.hpp        : yes
180
Checking for header boost/function.hpp      : yes
181
Checking for header boost/functional/factory.hpp : yes
182
Checking for header boost/ptr_container/ptr_vector.hpp : yes
183
Checking for header boost/scoped_ptr.hpp               : yes
184
Checking for header boost/static_assert.hpp            : yes
185
Checking for header boost/thread.hpp                   : yes
186
Configuring boost libraries                            : optimized variant
187
Checking boost ABI tag                                 :
188
Checking boost includes                                : 1_48
189
Checking boost libs                                    : ok
190
Checking for boost linkage                             : ok
191
Checking for header boost/asio.hpp                     : yes
192
Checking for header boost/bind.hpp                     : yes
193
Checking for header boost/date_time.hpp                : yes
194
Checking for header boost/detail/endian.hpp            : yes
195
Checking for header boost/format.hpp                   : yes
196
Checking for header boost/function.hpp                 : yes
197
Checking for header boost/functional/factory.hpp       : yes
198
Checking for header boost/ptr_container/ptr_vector.hpp : yes
199
Checking for header boost/scoped_ptr.hpp               : yes
200
Checking for header boost/static_assert.hpp            : yes
201
Checking for header boost/thread.hpp                   : yes
202
'configure' finished successfully (31.262s)
203
</pre>
204
205
If you don't see that last line that says @'configure' finished successfully@, then something is screwed up and it needs to be fixed.  Fix it and try again.
206 10 Tony Ciavarella
207 1 Tony Ciavarella
h2. Compiling
208
209 20 Tony Ciavarella
The basic strategy for building Disorder is to invoke the waf build system with the desired build variant.
210 1 Tony Ciavarella
211 20 Tony Ciavarella
Disorder has two build variants:
212 23 Tony Ciavarella
* debug: produces a library that contains debugging symbols and disables most compiler optimizations
213
* optimized: produces a library stripped of debugging symbols and enables compiler optimizations for performance
214 1 Tony Ciavarella
215 23 Tony Ciavarella
It might be reasonable to use the @debug@ variant in a development environment and the @optimized@ variant in a production environment.
216 1 Tony Ciavarella
217 23 Tony Ciavarella
The @debug@ variant is produced by the @build_debug@ build target and the @optimized@ variant is produced by the @build_optimized@ build target.
218
219 26 Tony Ciavarella
The results of the build are put in the @bin@ subdirectory under the name of the variant.  
220 23 Tony Ciavarella
221 26 Tony Ciavarella
Both variants can coexist peacefully in the tree at the same time.
222 23 Tony Ciavarella
223 20 Tony Ciavarella
h3. Linux
224 1 Tony Ciavarella
225 23 Tony Ciavarella
On Linux, to build the Disorder @debug@ variant:
226 20 Tony Ciavarella
<pre>./waf build_debug</pre>
227
228
h3. Windows
229
230 23 Tony Ciavarella
On Windows, the waf script is invoked indirectly.  To build the @optimized@ variant:
231
<pre>python.exe waf build_optimized</pre>
232 12 Tony Ciavarella
233 43 Tony Ciavarella
h2. Ensuring Build Correctness
234
235 44 Tony Ciavarella
Due to the complexity of varied compilers and build configurations, it is imperative that you preform the necessary testing on your build to ensure that it performs correctly.
236 43 Tony Ciavarella
237
Don't fret.  It's easy and is well worth the time it takes for the peace of mind you gain.  Just tell waf to test_all_<variant> like this for the @optimized@ variant:
238
<pre>./waf test_all_optimized</pre>
239
240 56 Tony Ciavarella
That should result in something like this:
241 43 Tony Ciavarella
<pre>
242
Waf: Entering directory `/opt/disorder/bin/optimized'
243 60 Tony Ciavarella
[PASS]: all      1 Asynchronous Log tests passed!
244
[PASS]: all   1789 Datum Factory tests passed!
245
[PASS]: all   1192 Dead Reckoner tests passed!
246
[PASS]: all    347 Entity Event tests passed!
247
[PASS]: all    191 Entity Freeze tests passed!
248
[PASS]: all    134 Entity Publisher tests passed!
249
[PASS]: all  75133 Geospatial tests passed!
250
[PASS]: all     13 Goofy Integer tests passed!
251
[PASS]: all     85 PDU Disseminator tests passed!
252
[PASS]: all     85 PDU Factory tests passed!
253
[PASS]: all   7659 PDU Size tests passed!
254
[PASS]: all     46 Timestamp tests passed!
255
[PASS]: all   2963 UDP Transport tests passed!
256 43 Tony Ciavarella
Waf: Leaving directory `/opt/disorder/bin/optimized'
257 61 Tony Ciavarella
'test_all_optimized' finished successfully (12.858s)
258 43 Tony Ciavarella
</pre>
259
260
If you see
261
<pre>Something failed!  That's not good.  This build cannot be trusted until the damn thing is fixed.</pre>
262
in red at the bottom instead of a green "finished successfully" message, you need to file a bug report and/or fix it yourself and send in a patch.  Under no circumstances should you attempt to use a build that fails the test suite.  A test failure means disorder isn't working as expected for some reason and that reason needs to be resolved for your simulation to function properly.
263
264 1 Tony Ciavarella
h2. Building Against the Disorder Library
265 28 Tony Ciavarella
266
h3. Compiling
267
268
In order to compile your goodness against the Disorder library, you'll need to have the header files from the @src@ directory in the Disorder tree and Eigen's include directory in your compiler's include path.  You do not need anything from SEDRIS SRM in your include path.
269
270
h3. Linking
271
272 29 Tony Ciavarella
Just link your program against Disorder's static library that can be found in the @bin/<build variant>@ directory.