Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
8b474c7388d5f9ea585511e44d8c48256c94c338
[simgrid.git] / doc / doxygen / install.doc
1 /*! @page install Installing Simgrid
2
3 @tableofcontents
4
5 SimGrid should work out of the box on Linux, Mac OSX, FreeBSD, and Windows (under windows, only the Java interfaces are
6 available at the moment).
7
8 The easiest way to install SimGrid is to go for a @ref install_binary "binary package". Under Debian or Ubuntu, this is 
9 very easy as SimGrid is directly integrated to the official repositories. For other Linux variants, you probably want 
10 to go for a @ref install_src "source install". Please contact us if you want to contribute the build scripts for your 
11 preferred distribution. If you just want to use @ref install_binary_java "Java", simply copy the jar file on your disk 
12 and you're set.
13
14 @section install_binary Pre-compiled Packages
15
16 @subsection install_binary_linux Binaries for Linux
17
18 Most of us use a Debian or Ubuntu system, so the packages for these
19 systems are well integrated and up-to-date. To get these packages, simply type:
20
21 @verbatim
22 apt-get install simgrid
23 @endverbatim
24
25 @subsection install_binary_java Stable Java Package 
26
27 For the SimGrid Java bindings, grab the jar file from the [download
28 page](https://gforge.inria.fr/frs/?group_id=12) and copy it in your
29 classpath (typically, your source code root directory). This
30 self-contained version even includes the SimGrid native components for
31 the following architectures: Linux (Amd64, x86, Arm), Mac OS X 64
32 bits, Windows 64 bits, FreeBSD (64 bits).
33
34 @subsection install_binary_java_builder Nightly built Java Package
35
36 For Windows, head to [AppVeyor](https://ci.appveyor.com/project/simgrid/simgrid).
37 Click on the artefact link on the right, and grab your file. If the latest build failed, there will be no artefact. Then
38 you will need to first click on "History" on the top and search for the last successful build.
39
40 For non-Windows systems (Linux, Mac or FreeBSD), head to [Jenkins](https://ci.inria.fr/simgrid/job/SimGrid).
41 In the build history, pick the last green (or at least yellow) build that is not blinking (i.e., not currently under 
42 build). In the list, pick a system that is close to yours, and click on the ball in the Debug row. The build artefact 
43 will appear on the top of the resulting page.
44
45 @subsection install_binary_java_troubleshooting Binary Java Troubleshooting
46
47  - **Your architecture is not supported by this jarfile**. \n
48    If your system is in the list of the supported architectures (see
49    @ref install_binary_java "above"), then this is probably a bug that 
50    @ref contributing_bugs "you should report".\n
51    If your system is actually not supported, you should compile your
52    own jarfile @ref install_src "by compiling SimGrid" on your
53    machine. If you feel so, @ref community_contact "contact us" so that we add
54    your architecture to the list.
55
56  - **Library not found: boost-context**.\n 
57    You should obviously install the @c boost-context library on your
58    machine, for example with @c apt-get.
59
60 @section install_src Source Installs
61
62 @subsection install_src_deps Getting the Dependencies
63
64 Recompiling an official archive is not much more complex. SimGrid only uses very standard tools:
65   - C compiler, C++ compiler, make and friends. SimGrid is rather
66     demanding on the compiler. We use the C++11 standard, and older
67     compilers tend to fail on us. It seems that g++ 5.0 or higher is
68     required nowadays (because of boost). 
69     SimGrid compiles well with `clang` too.
70   - perl (but you may try to go without it)
71   - We use cmake to configure our compilation
72       ([download page](http://www.cmake.org/cmake/resources/software.html)).
73       You need cmake version 2.8.8 or higher. 
74       `ccmake` provides a nicer graphical interface compared to `cmake`.
75       Press `t` in `ccmake` if you need to see absolutely all
76       configuration options (e.g., if your python installation is not standard).
77   - boost:
78     - Debian / Ubuntu: `apt-get install libboost-dev libboost-context-dev`
79     - Max OS X: with [fink](http://www.finkproject.org/): `fink install boost1.53.nopython`,
80       or with homebrew: `brew install boost`
81   - Java (if you want to build the Java bindings): 
82     - Debian / Ubuntu: `apt-get install default-jdk libgcj17-dev` (any
83       version of libgcj will do it; you can use libgcj16-dev or libgcj18-dev
84       instead, depending on your version of Debian/Ubuntu)
85     - Mac OS X or Windows: Grab a [full JDK](http://www.oracle.com/technetwork/java/javase/downloads)
86   - Lua (if you want to build with lua enabled): Your version of Lua
87     must be 5.3. SimGrid won't work with Lua 5.2 nor with 5.1, and
88     probably not with Lua 5.4 either.
89     - Debian / Ubuntu: `apt-get install liblua5.3-dev lua5.3`
90     - Windows: choco install lua53
91     - From the source: you need to patch the sources to build dynamic libraries 
92       - [Download lua 5.3](http://www.lua.org/download.html). SimGrid
93         won't work with lua 5.2 as lua breaks the compatibility.
94       - Open the archive: `tar xvfz lua-5.3.*.tar.gz`
95       - Enter the directory: `cd lua-5.3*`
96       - Patch the sources: `patch -p1 < /path/to/simgrid/...../tools/lualib.patch`
97       - Build and install lua: `make linux && sudo make install`
98
99 For platform-specific details, please see  @ref install_cmake_mac,
100 @ref install_cmake_windows, @ref install_java and @ref install_src_32bits
101
102 @subsection install_src_fetch Getting the Sources
103
104 You can download the *@SimGridRelease.tar.gz* archive from the 
105 [download page](https://gforge.inria.fr/frs/?group_id=12).
106 Then, recompiling the archive should be done in a few lines:
107
108 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh}
109 tar xf @SimGridRelease.tar.gz
110 cd @SimGridRelease
111 cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
112 make
113 make install
114 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115
116 If you want to stay on the bleeding edge, you should get the latest git version, and recompile it as you would do for 
117 an official archive. Depending on the files you change in the source tree, some extra tools may be needed.
118
119 @verbatim
120 git clone git://scm.gforge.inria.fr/simgrid/simgrid.git simgrid
121 @endverbatim
122
123 @subsection install_src_config Build Configuration
124
125 This section is about *compile-time options*, that are very different
126 from @ref options "run-time options". Compile-time options fall into
127 two categories. @ref install_cmake_list "SimGrid-specific options"
128 define which part of the framework to compile while 
129 @ref install_cmake_howto "generic options" are provided by cmake
130 itself. 
131
132 @subsubsection install_cmake_howto Generic build-time options
133
134 These options specify for example the path to various system elements
135 (Python path, compiler to use, etc). In most case, cmake automatically
136 discovers the right value for these ones, but you can set them
137 manually on need.  Notable such variables include @c CC and @c CXX,
138 defining respectively the C and C++ compiler executables, @c CFLAGS
139 and @c CXXFLAGS respectively specifying extra options to pass to the C
140 and C++ compilers, or @c PYTHON_EXECUTABLE specifying the path to the
141 python executable.  The best way to discover the exact name of the
142 option that you need to change is to press 't' in the ccmake graphical
143 interface, as all options are shown (and documented) in the advanced
144 mode.
145
146 Once you know their name, there is several ways to change the value of
147 build-time options. You can naturally use the ccmake graphical
148 interface for that, or you can use environment variables, or you can
149 prefer the @c -D flag of @c cmake.
150
151 For example, you can change the compilers with environment variables
152 by issuing these commands before launching cmake:
153
154 @verbatim
155 export CC=gcc-5.1
156 export CXX=g++-5.1
157 @endverbatim
158
159 The same can be done by passing @c -D parameters to cmake, as follows.
160 Note that the ending dot is mandatory (see @ref install_cmake_outsrc).
161
162 @verbatim
163 cmake -DCC=clang -DCXX=clang++ .
164 @endverbatim
165
166 @subsubsection install_cmake_list SimGrid compilation options
167
168 Here is the list of SimGrid-specific @ref install_src_config
169 "build-time options".
170
171   @li <b>CMAKE_INSTALL_PREFIX</b> (path): Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
172
173   @li <b>enable_compile_optimizations</b> (ON/OFF) to request the compiler to produce efficient code. You want to 
174       activate it, unless you plan to debug SimGrid itself. Indeed, efficient code may be appear mangled to debuggers.
175
176   @li <b>enable_compile_warnings</b> (ON/OFF) to request the compiler to issue error messages whenever the source code
177       is not perfectly clean. If you are a SimGrid developer, you have to activate this option to enforce the code 
178       quality. As a regular user, this option will bring you nothing.
179
180   @li <b>enable_debug</b> (ON/OFF). Disable this option toto discard
181       all log messages of gravity debug or below at compile time (see
182       @ref XBT_log). The resulting code is faster than if you
183       discarding these messages at runtime. However, it obviously
184       becomes impossible to get any debug info from SimGrid if
185       something goes wrong.
186
187   @li <b>enable_documentation</b> (ON/OFF) to generate the documentation pages.
188
189   @li <b>enable_java</b> (ON/OFF) to enjoy the java bindings of SimGrid.
190
191   @li <b>enable_jedule</b> (ON/OFF) to get SimDag producing execution traces that can then be visualized with the 
192       Jedule external tool.
193
194   @li <b>enable_lua</b> (ON/OFF) to enjoy the lua bindings to the
195       SimGrid internals (this require the liblua5.3-dev and lua-5.3 packages or equivalent).
196
197   @li <b>enable_lib_in_jar</b> (ON/OFF) to make sure that the native
198       java bindings are bundled in the jar file.
199
200   @li <b>enable_lto</b> (ON/OFF) to enable the Link Time Optimization
201       of the C compiler. This feature really speeds up the produced
202       code, but it is fragile with some versions of GCC.
203
204   @li <b>enable_maintainer_mode</b> (ON/OFF) is only needed if you plan to modify very specific parts of SimGrid
205       (e.g., the XML parsers and other related elements). Moreover, this adds an extra dependency on flex and flexml.
206
207   @li <b>enable_mallocators</b> (ON/OFF) has to be disabled when tracking memory issues within SimGrid, 
208       or our internal memory caching mechanism will fool the debuggers.
209
210   @li <b>enable_model-checking</b> (ON/OFF) This execution gear
211       is very usable now, but enabling this option at compile time
212       will **hinder simulation speed** even when the model-checker is
213       not activated at run time.
214
215   @li <b>enable_ns3</b> (ON/OFF) if you want to use ns-3. See section @ref pls_ns3.
216
217   @li <b>enable_smpi</b> (ON/OFF) to run MPI code on top of SimGrid.
218
219   @li <b>enable_smpi_ISP_testsuite</b> (ON/OFF) to add many extra
220       tests for the model-checker module.
221
222   @li <b>enable_smpi_MPICH3_testsuite</b> (ON/OFF) to add many extra
223       tests for the MPI module.
224
225 @subsubsection install_cmake_reset Reset the build configuration
226
227 To empty the cmake cache (either when you add a new library or when
228 things go seriously wrong), simply delete your @c CMakeCache.txt. You
229 may also want to directly edit this file in some circumstances.
230
231 @subsubsection install_cmake_outsrc Out of Tree Compilation
232
233 By default, the files produced during the compilation are placed in
234 the source directory. It is however often better to put them all in a
235 separate directory: cleaning the tree becomes as easy as removing this
236 directory, and you can have several such directories to test several
237 parameter sets or architectures.
238
239 For that, go to the directory where the files should be produced, and
240 invoke cmake (or ccmake) with the full path to the SimGrid source as
241 last argument.
242
243 @verbatim
244 mkdir build
245 cd build
246 cmake [options] ..
247 make
248 @endverbatim
249
250 @subsubsection install_cmake_mac Mac OS X Builds
251
252 SimGrid compiles like a charm with clang (version 3.0 or higher) on Mac OS X:
253
254 @verbatim
255 cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
256 make
257 @endverbatim
258
259 With the XCode version of clang 4.1, you may get the following error message:
260 @verbatim
261 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
262 @endverbatim
263
264 In that case, edit the CMakeCache.txt file directly, so that the
265 CMAKE_OSX_SYSROOT is similar to the following. Don't worry about the
266 warning that the "-pthread" argument is not used, if it appears.
267 @verbatim
268 CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
269 @endverbatim
270
271 In the El Capitan version of Max OS X, Apple decided that users don't
272 need no /usr/include directory anymore. If you are hit by this pure
273 madness, just run the following command to restore that classical
274 UNIX directory: `xcode-select -install`
275
276 @subsubsection install_cmake_windows Windows Builds
277
278 Building SimGrid on Windows may be something of an adventure:
279 We only manage to  do so ourselves with MinGW-64, <a
280 href="http://www.activestate.com/activeperl/downloads">ActiveState</a>
281 Perl and <a href="http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe">msys</a>
282 git). Have a look at out configuration scripts in @c appveyor.yml, but
283 don't expect too much  from us: we are really not fluent with Windows.
284 Actually your help is welcome.
285
286 The drawback of MinGW-64 is that the produced DLL are not compatible
287 with MS Visual C. <a href="http://clang.llvm.org/docs/MSVCCompatibility.html">clang-cl</a>
288 sounds promising to fix this. If you get something working, please
289 @ref community_contact "tell us".
290
291 @subsubsection install_java Build the Java bindings
292
293 Once you have the [full JDK](http://www.oracle.com/technetwork/java/javase/downloads) installed
294 (on Debian/Ubuntu, grab the package ```default-jdk``` for that), things should be as simple as:
295
296 ~~~~{.sh}
297 cmake -Denable_java=ON .
298 make 
299 ~~~~
300
301 After the compilation, the file ```simgrid.jar``` is produced in the
302 root directory. If you only want to build the jarfile and its
303 dependencies, type ```make simgrid-java_jar```. It will save you the
304 time of building every C examples and other things that you don't need
305 for Java.
306
307 ** **Error: jni could not be found**. Sometimes, the build system fails
308 to find the JNI headers. In this case, you need to first locate them as follows:
309
310 ~~~~{.sh}
311 $ locate jni.h
312 /usr/lib/jvm/java-7-openjdk-amd64/include/jni.h
313 /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h
314 ~~~~
315
316 Then, set the JAVA_INCLUDE_PATH environment variable to the right
317 path, and relaunch cmake. If you have several version of jni installed
318 (as above), use the right one (check the java version you use with
319 ```javac -version```).
320
321 ~~~~{.sh}
322 export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-amd64/include/
323 cmake -Denable_java=ON .
324 make
325 ~~~~
326
327 Note that the filename ```jni.h``` was removed from the path.
328
329 @subsubsection install_src_32bits 32 bits Builds on Multi-arch Linux
330
331 On a multiarch x86_64 Linux, it should be possible to compile a 32 bit
332 version of SimGrid with something like:
333
334 @verbatim
335 CFLAGS=-m32 \
336 CXXFLAGS=-m32 \
337 PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig/ \
338 cmake . \
339 -DCMAKE_SYSTEM_PROCESSOR=i386 \
340 -DCMAKE_Fortran_COMPILER=/some/path/to/i686-linux-gnu-gfortran \
341 -DGFORTRAN_EXE=/some/path/to/i686-linux-gnu-gfortran \
342 -DCMAKE_Fortran_FLAGS=-m32
343 @endverbatim
344
345 If needed, implement @c i686-linux-gnu-gfortran as a script:
346
347 @verbatim
348 #!/usr/bin/env sh
349 exec gfortran -m32 "$@"
350 @endverbatim
351
352 @subsection install_src_compil Existing Compilation Targets
353
354 In most cases, compiling and installing SimGrid is enough:
355
356 @verbatim
357 make
358 make install # try "sudo make install" if you don't have the permission to write
359 @endverbatim
360
361 In addition, several compilation targets are provided in SimGrid. If
362 your system is well configured, the full list of targets is available
363 for completion when using the Tab key. Note that some of the existing
364 targets are not really for public consumption so don't worry if some
365 stuff doesn't work for you.
366
367 @verbatim
368 make simgrid                    Build only the SimGrid library and not any example
369 make app-masterworker           Build only this example (works for any example)
370 make clean                      Clean the results of a previous compilation
371 make install                    Install the project (doc/ bin/ lib/ include/)
372 make uninstall                  Uninstall the project (doc/ bin/ lib/ include/)
373 make dist                       Build a distribution archive (tgz)
374 make distcheck                  Check the dist (make + make dist + tests on the distribution)
375 make documentation              Create SimGrid documentation
376 @endverbatim
377
378 If you want to see what is really happening, try adding VERBOSE=1 to
379 your compilation requests:
380
381 @verbatim
382 make VERBOSE=1
383 @endverbatim
384
385 @subsection install_src_test Testing your build
386
387 Once everything is built, you may want to test the result. SimGrid
388 comes with an extensive set of regression tests (as described in the
389 @ref inside_tests "insider manual"). The tests are run with @c ctest, that comes with CMake.
390 We run them every commit and the results are on [our
391 Jenkins](https://ci.inria.fr/simgrid/).
392
393 @verbatim
394 ctest                     # Launch all tests
395 ctest -R msg              # Launch only the tests which name match the string "msg"
396 ctest -j4                 # Launch all tests in parallel, at most 4 at the same time
397 ctest --verbose           # Display all details on what's going on
398 ctest --output-on-failure # Only get verbose for the tests that fail
399
400 ctest -R msg- -j5 --output-on-failure # You changed MSG and want to check that you didn't break anything, huh?
401                                       # That's fine, I do so all the time myself.
402 @endverbatim
403
404 */