1 /*! \page installSimgrid Install Simgrid
3 \htmlinclude .installSimgrid.doc.toc
5 \section installSimgrid_cmake Installing the SimGrid library with Cmake (since V3.4)
7 \subsection installSimgrid_intro Some generalitty
9 \subsubsection installSimgrid_intro1 What is Cmake?
11 CMake is a family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. For more information see official web site <a href="http://www.cmake.org/">here</a>.
13 \subsubsection installSimgrid_intro2 Why cmake?
15 CMake permits to developers to compil projects on different plateforms. Then many tools are embedded like ctest for making test, a link to cdash for vizualise results but also test coverage and bug reports.
17 \subsubsection installSimgrid_intro3 What cmake need?
19 CMake needs some prerequists like :
24 \li c, c++ and java compiler regards to developers
25 \li ccmake for graphical used of CMake
26 \li cmake <a href="http://www.cmake.org/cmake/resources/software.html">(download page)</a>
29 \li cmake 2.8 <a href="http://www.cmake.org/cmake/resources/software.html">(download page)</a>
30 \li perl strawberry <a href="http://www.strawberryperl.com/download/5.12.2.0/strawberry-perl-5.12.2.0.msi">(download page)</a>
31 \li git <a href="http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe">(download page)</a>
32 \li SimGrid Installer <a href="https://gforge.inria.fr/frs/?group_id=12">(download page)</a>
34 \subsubsection installSimgrid_cmakeoption1 Liste of options
37 "cmake -D[name]=[value] ... ./"
39 [name] enable_gtnets [value] ON/OFF or TRUE/FALSE or 1/0
40 enable_lua ON/OFF or TRUE/FALSE or 1/0
41 enable_compile_optimizations ON/OFF or TRUE/FALSE or 1/0
42 enable_compile_warnings ON/OFF or TRUE/FALSE or 1/0
43 enable_smpi ON/OFF or TRUE/FALSE or 1/0
44 enable_maintainer_mode ON/OFF or TRUE/FALSE or 1/0
45 enable_supernovae ON/OFF or TRUE/FALSE or 1/0
46 enable_tracing ON/OFF or TRUE/FALSE or 1/0
47 enable_coverage ON/OFF or TRUE/FALSE or 1/0
48 enable_memcheck ON/OFF or TRUE/FALSE or 1/0
49 enable_model-checking ON/OFF or TRUE/FALSE or 1/0
50 enable_debug ON/OFF or TRUE/FALSE or 1/0
51 enable_jedule ON/OFF or TRUE/FALSE or 1/0
52 enable_latency_bound_tracking ON/OFF or TRUE/FALSE or 1/0
53 enable_lib_static ON/OFF or TRUE/FALSE or 1/0
54 enable_pcre ON/OFF or TRUE/FALSE or 1/0
56 gtnets_path <path_to_gtnets_directory>
57 CMAKE_INSTALL_PREFIX <path_to_install_directory>
58 pipol_user <pipol_username>
61 \subsubsection installSimgrid_cmakeoption2 Options explaination
63 \li enable_gtnets : set to true implie that user wants to use gtnets.
65 \li enable_lua : set to true implie that user wants to add lua langage into simgrid compilation.
67 \li enable_compile_optimizations : add flags "-O3 -finline-functions -funroll-loops -fno-strict-aliasing"
69 \li enable_compile_warnings : add flags "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror"
71 \li enable_smpi : Set to true if you want to use smpi lib. Actually on simgrid v3.4.1 Mac doesn't support lib smpi.
73 \li enable_maintainer_mode : set to true it remakes some files.
75 \li enable_supernovae : set to true make one file for each lib and compile with those generated files.
77 \li enable_tracing : To enable the generation of simulation traces for visualization.
79 \li enable_coverage : When set to true this option enable code coverage by setting -fprofile-arcs -ftest-coverage flags.
81 \li enable_memcheck : When set to true this option enable tests for memcheck.
83 \li enable_model-checking : Enable the model checking when set to true.
85 \li enable_debug : If enable_debug is set to 'off' Simgrid compil flag has '-DNDEBUG' option.
87 \li enable_jedule : To enable jedule mode, which creates visualizations of task schedules with Simdag.
89 \li enable_latency_bound_tracking : Set to on if you want to be warned when communications are limited by round trip time.
91 \li enable_lib_static : Enable generated Simgrid and smpi static libraries.
93 \li enable_pcre : Use or not the pcre lib for memory optimization.
95 \li custom_flags : If user wants to use a specific flag during compilation, give here.
97 \li gtnets_path : Path to gtnets install directory (ex /usr)
99 \li CMAKE_INSTALL_PREFIX : Path where are installed lib/ doc/ and include/ directories (ex /usr/local)
101 \li pipol_user : specify your pipol username if you want to use the pipol-remote command.
103 \subsubsection installSimgrid_cmakeoption3 Initialisation
105 Those options are initialized the first time you launch "cmake ." whithout specified option.
113 enable_compile_optimizations on
116 enable_compile_warnings off
117 enable_maintainer_mode off
120 enable_model-checking off
122 enable_latency_bound_tracking off
123 enable_lib_static off
124 CMAKE_INSTALL_PREFIX /usr/local
130 \subsubsection installSimgrid_cmakeoption4 Option's cache and how to reset?
132 When options have been set they are keep into a cache file named "CMakeCache.txt". So if you want
133 reset values you just delete this file located to the project directory.
135 \subsection installSimgrid_cmakecompilation Cmake compilation
137 \subsubsection installSimgrid_cmakecompilation1 With command line.
139 On Unix or Mac platform:
142 cmake -D[name]=[value] ... ./
149 cmake -G"Unix Makefiles" -D[name]=[value] ... ./
153 \subsubsection installSimgrid_cmakecompilation2 With ccmake tool.
158 Then follow instructions.
160 \subsubsection installSimgrid_cmakecompilation2bis Build out of source.
162 As cmake generate many files used for compilation, we recommand to make a build directory.
163 For examples you can make :
166 "navarrop@caraja:~/Developments$ cd simgrid/"
167 "navarrop@caraja:~/Developments/simgrid$ mkdir build_directory"
168 "navarrop@caraja:~/Developments/simgrid$ cd build_directory/"
169 "navarrop@caraja:~/Developments/simgrid/build_directory$ cmake ../"
170 "navarrop@caraja:~/Developments/simgrid/build_directory$ make"
173 Or complety out of sources :
176 "navarrop@caraja:~/Developments$ mkdir build_dir"
177 "navarrop@caraja:~/Developments$ cd build_dir/"
178 "navarrop@caraja:~/Developments/build_dir$ cmake ../simgrid/"
179 "navarrop@caraja:~/Developments/build_dir$ make"
182 Those two kind of compilation permit to delete files created by compilation easier.
184 \subsubsection installSimgrid_cmakecompilation3 Resume of command line
188 cmake <path> configure the project for Unix and Mac
189 cmake -G"Unix Makefiles" <path> configure the project for Windows
190 make build all targets for Unix and Mac
191 gmake buill all targets for windows
192 (g)make VERBOSE=1 build all targets and print build command lines
193 make check test all targets and summarize
194 make dist make the distrib
195 make distcheck check the dist (make + make dist + make check)
196 (g)make install install the project (doc/ bin/ lib/ include/)
197 (g)make uninstall uninstall the project (doc/ bin/ lib/ include/)
198 (g)make clean clean all targets
199 make simgrid_documentation Create simgrid documentation
202 When the project have been succesfully compiling and build you can make tests.
206 ctest launch only tests
208 ctest -D Continuous(Start|Update|Configure|Build)
209 ctest -D Continuous(Test|Coverage|MemCheck|Submit)
210 ctest -D Experimental
211 ctest -D Experimental(Start|Update|Configure|Build)
212 ctest -D Experimental(Test|Coverage|MemCheck|Submit)
214 ctest -D Nightly(Start|Update|Configure|Build)
215 ctest -D Nightly(Test|Coverage|MemCheck|Submit)
216 ctest -D NightlyMemoryCheck
219 If you want to test before make a commit you can simply make "ctest -D Experimental" and then you can visualize results submitted into Cdash. <a href="http://cdash.inria.fr/CDash/index.php?project=Simgrid">(Go to Cdash site)</a>.
221 \subsection installSimgrid_cmakeinstall How to install with cmake?
223 \subsubsection installSimgrid_cmakeinstall1 From svn.
226 cmake -Denable_maintainer_mode=on -DCMAKE_INSTALL_PREFIX=/home/navarrop/Bureau/install_simgrid ./
231 \subsubsection installSimgrid_cmakeinstall2 From a distrib
234 For version 3.4.1 and 3.4
235 cmake -Dprefix=/home/navarrop/Bureau/install_simgrid ./
239 cmake -DCMAKE_INSTALL_PREFIX=/home/navarrop/Bureau/install_simgrid ./
245 \subsection installSimgrid_cmakehowto How to modified sources files for developers
247 \subsubsection installSimgrid_cmakehowto1 Add an executable or examples.
249 If you want make an executable you have to create a CMakeList.txt to the src directory.
250 You must specified where to create the executable, source list, dependencies and the name of the binary.
253 cmake_minimum_required(VERSION 2.6)
255 set(EXECUTABLE_OUTPUT_PATH "./")
256 set(LIBRARY_OUTPUT_PATH "${CMAKE_HOME_DIRECTORY}/lib")
258 add_executable(get_sender get_sender.c) #add_executable(<name_of_target> <src list>)
260 ### Add definitions for compile
261 target_link_libraries(get_sender simgrid m pthread) #target_link_libraries(<name_of_targe> <dependencies>)
264 Then you have to modified <project/directory>/buildtools/Cmake/MakeExeLib.cmake and add
267 add_subdirectory(${CMAKE_HOME_DIRECTORY}/<path_where_is_CMakeList.txt>)
270 \subsubsection installSimgrid_cmakehowto2 Delete/add sources to lib.
272 If you want modified, add or delete source files from a library you have to edit <project/directory>/buildtools/Cmake/DefinePackages.cmake
276 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/MsgException.java
277 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/JniException.java
278 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/NativeException.java
279 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/HostNotFoundException.java
280 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/ProcessNotFoundException.java
281 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Msg.java
282 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Process.java
283 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Host.java
284 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Task.java
285 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/MsgNative.java
286 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/ApplicationHandler.java
287 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Sem.java
292 \section installSimgrid_installation Installing the SimGrid library with Autotools (valid until V3.3.4)
294 Many people have been asking me questions on how to use SimGrid. Quite
295 often, the questions were not really about SimGrid but on the
296 installation process. This section is intended to help people that are
297 not familiar with compiling C files under UNIX. If you follow these
298 instructions and still have some troubles, drop an e-mail to
299 <simgrid-user@lists.gforge.inria.fr>.
301 \subsection installSimgrid_compiling Compiling SimGrid from a stable archive
303 First of all, you need to download the latest version of SimGrid from
304 <a href="http://gforge.inria.fr/frs/?group_id=12">here</a>.
305 Suppose you have uncompressed SimGrid in some temporary location of
306 your home directory (say <tt>/home/joe/tmp/simgrid-3.0.1 </tt>). The
307 simplest way to use SimGrid is to install it in your home
308 directory. Change your directory to
309 <tt>/home/joe/tmp/simgrid-3.0.1</tt> and type
312 ./configure --prefix=$HOME
317 If at some point, something fails, check the section \ref faq_trouble_compil .
318 If it does not help, you can report this problem to the
319 list but, please, avoid sending a laconic mail like "There is a problem. Is it
320 okay?". Send the config.log file which is automatically generated by
321 configure. Try to capture both the standard output and the error output of the
322 <tt>make</tt> command with <tt>script</tt>. There is no way for us to help you
323 without the relevant bits of information.
325 Now, the following directory should have been created :
327 \li <tt>/home/joe/doc/simgrid/html/</tt>
328 \li <tt>/home/joe/lib/</tt>
329 \li <tt>/home/joe/include/</tt>
331 SimGrid is not a binary, it is a library. Both a static and a dynamic
332 version are available. Here is what you can find if you try a <tt>ls
335 \verbatim libsimgrid.a libsimgrid.la libsimgrid.so libsimgrid.so.0 libsimgrid.so.0.0.1
338 Thus, there is two ways to link your program with SimGrid:
339 \li Either you use the static version, e.g
340 \verbatim gcc libsimgrid.a -o MainProgram MainProgram.c
342 In this case, all the SimGrid functions are directly
343 included in <tt>MainProgram</tt> (hence a bigger binary).
344 \li Either you use the dynamic version (the preferred method)
345 \verbatim gcc -lsimgrid -o MainProgram MainProgram.c
347 In this case, the SimGrid functions are not included in
348 <tt>MainProgram</tt> and you need to set your environment
349 variable in such a way that <tt>libsimgrid.so</tt> will be
350 found at runtime. This can be done by adding the following
351 line in your .bashrc (if you use bash and if you have
352 installed the SimGrid libraries in your home directory):
353 \verbatim export LD_LIBRARY_PATH=$HOME/lib/:$LD_LIBRARY_PATH
356 \subsection installSimgrid_compiling_java Java bindings don't get compiled
358 The configure script detects automatically whether you have the
359 softwares needed to use the Java bindings or not. At the end of the
360 configure, you can see the configuration picked by the script, which
361 should look similar to
362 \verbatim Configuration of package simgrid' (version 3.3.4-svn) on
365 Compiler: gcc (version: )
367 CFlags: -O3 -finline-functions -funroll-loops -fno-strict-aliasing -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror -g3
371 Context backend: ucontext
378 In this example, Java backends won't be compiled.
380 On Debian-like systems (which includes ubuntu), you need the following
381 packages: sun-java6-jdk libgcj10-dev. If you cannot find the
382 libgcj10-dev, try another version, like libgcj9-dev (on Ubuntu before
383 9.10) or libgcj11-dev (not released yet, but certainly one day).
384 Please note that you need to activate the contrib and non-free
385 repositories in Debian, and the universe ones in Ubuntu. Java comes at
388 \subsection installSimgrid_compiling_snapshoot SimGrid development snapshots
390 We have very high standards on software quality, and we are reluctant releasing
391 a stable release as long as there is still some known bug in the code base. In
392 addition, we added quite an extensive test base, making sure that we correctly
393 test the most important parts of the tool.
395 As an unfortunate conclusion, there may be some time between the stable
396 releases. If you want to benefit from the most recent features we introduced,
397 but don't want to take the risk of an untested version from the SVN, then
398 development snapshots are done for you.
400 These are pre-releases of SimGrid that still fail some tests about features
401 that almost nobody use, or on platforms not being in our core target (which is
402 Linux, Mac, other Unixes and Windows, from the most important to the less
403 one). That means that using this development releases should be safe for most
406 These archives can be found on
407 <a href="http://www.loria.fr/~quinson/Research/SimGrid/">this web page</a>. Once you
408 got the lastest archive, you can compile it just like any archive (see above).
410 \subsection installSimgrid_compiling_svn Compiling SimGrid from the SVN
412 The project development takes place in the SVN, where all changes are
413 committed when they happen. Then every once in a while, we make sure that the
414 code quality meets our standard and release an archive from the code in the
415 SVN. We afterward go back to the development in the SVN. So, if you need a
416 recently added feature and can afford some little problem with the stability
417 of the lastest features, you may want to use the SVN version instead of a
420 For that, you first need to get the "simgrid" module from
421 <a href="http://gforge.inria.fr/scm/?group_id=12">here</a>.
423 You won't find any <tt>configure</tt> and a few other things
424 (<tt>Makefile.in</tt>'s, documentation, ...) will be missing as well. The
425 reason for that is that all these files have to be regenerated using the
426 latest versions of <tt>autoconf</tt>, <tt>libtool</tt>, <tt>automake</tt>
427 (>1.9) and <tt>doxygen</tt> (>1.4). To generate the <tt>configure</tt> and
428 the <tt>Makefile.in</tt>'s, you just have to launch the <tt>bootstrap</tt>
429 command that resides in the top of the source tree. Then just follow the
430 instructions of Section \ref installSimgrid_compiling.
432 We insist on the fact that you really need the latest versions of
433 autoconf, automake and libtool. Doing this step on exotic architectures/systems
434 (i.e. anything different from a recent linux distribution) may be
435 ... uncertain. If you need to compile the SVN version on a machine where all these
436 dependencies are not met, the easiest is to do <tt>make dist</tt> in the SVN
437 directory of another machine where all dependencies are met. It will create an
438 archive you may deploy on other sites just as a regular stable release.
440 In summary, the following commands will checkout the SVN, regenerate the
441 configure script and friends, configure SimGrid and build it.
443 \verbatim svn checkout svn://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk simgrid
446 ./configure --enable-maintainer-mode --prefix=<where to install SimGrid>
449 Then, if you want to install SimGrid on the current box, just do:
450 \verbatim make install \endverbatim
452 If you want to build an snapshot of the SVN to deploy it on another box (for
453 example because the other machine don't have the autotools), do:
454 \verbatim make dist \endverbatim
456 Moreover, you should never call the autotools manually since you must run
457 them in a specific order with specific arguments. Most of the times, the
458 makefiles will automatically call the tools for you. When it's not possible
459 (such as the first time you checkout the SVN), use the ./bootstrap command
460 to call them explicitly.
462 \subsection installSimgrid_setting_MSG Setting up your own MSG code
464 Do not build your simulator by modifying the SimGrid examples. Go
465 outside the SimGrid source tree and create your own working directory
466 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
468 Suppose your simulation has the following structure (remember it is
469 just an example to illustrate a possible way to compile everything;
470 feel free to organize it as you want).
472 \li <tt>sched.h</tt>: a description of the core of the
473 scheduler (i.e. which functions are can be used by the
474 agents). For example we could find the following functions
475 (master, forwarder, slave).
477 \li <tt>sched.c</tt>: a C file including <tt>sched.h</tt> and
478 implementing the core of the scheduler. Most of these
479 functions use the MSG functions defined in section \ref
482 \li <tt>masterslave.c</tt>: a C file with the main function, i.e.
483 the MSG initialization (MSG_global_init()), the platform
484 creation (e.g. with MSG_create_environment()), the
485 deployment phase (e.g. with MSG_function_register() and
486 MSG_launch_application()) and the call to
489 To compile such a program, we suggest to use the following
490 Makefile. It is a generic Makefile that we have used many times with
491 our students when we teach the C language.
495 masterslave: masterslave.o sched.o
497 INSTALL_PATH = $$HOME
499 PEDANTIC_PARANOID_FREAK = -O0 -Wshadow -Wcast-align \
500 -Waggregate-return -Wmissing-prototypes -Wmissing-declarations \
501 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
502 -Wmissing-noreturn -Wredundant-decls -Wnested-externs \
503 -Wpointer-arith -Wwrite-strings -finline-functions
504 REASONABLY_CAREFUL_DUDE = -Wall
505 NO_PRAYER_FOR_THE_WICKED = -w -O2
506 WARNINGS = $(REASONABLY_CAREFUL_DUDE)
507 CFLAGS = -g $(WARNINGS)
509 INCLUDES = -I$(INSTALL_PATH)/include
510 DEFS = -L$(INSTALL_PATH)/lib/
511 LDADD = -lm -lsimgrid
515 $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@
518 $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
521 rm -f $(BIN_FILES) *.o *~
527 The first two lines indicates what should be build when typing make
528 (<tt>masterslave</tt>) and of which files it is to be made of
529 (<tt>masterslave.o</tt> and <tt>sched.o</tt>). This makefile assumes
530 that you have set up correctly your <tt>LD_LIBRARY_PATH</tt> variable
531 (look, there is a <tt>LDADD = -lm -lsimgrid</tt>). If you prefer using
532 the static version, remove the <tt>-lsimgrid</tt> and add a
533 <tt>$(INSTALL_PATH)/lib/libsimgrid.a</tt> on the next line, right
534 after the <tt>LIBS = </tt>.
536 More generally, if you have never written a Makefile by yourself, type
537 in a terminal : <tt>info make</tt> and read the introduction. The
538 previous example should be enough for a first try but you may want to
539 perform some more complex compilations...
541 \subsection installSimgrid_setting_GRAS Setting up your own GRAS code
543 If you use the GRAS interface instead of the MSG one, then previous section
544 is not the better source of information. Instead, you should check the GRAS
545 tutorial in general, and the \ref GRAS_tut_tour_setup in particular.