1 This page summarizes how to compile SimGrid. The full Install
2 documentation is available in doc/html/install.html or online at
4 http://simgrid.gforge.inria.fr/
6 Getting the Dependencies
7 ------------------------
8 SimGrid only uses very standard tools:
9 - C compiler, C++ compiler, make and friends.
10 - perl (but you may try to go without it)
11 - cmake (version 2.8.8 or higher). You may want to use ccmake for a graphical interface over cmake.
13 - Max OS X: with fink: fink install boost1.53.nopython, or with homebrew: brew install boost
14 - Debian / Ubuntu: apt-get install libboost-dev libboost-context-dev
15 - Java (if you want to build the Java bindings):
16 - Mac OS X or Windows: Grab a full JDK
17 - Debian / Ubuntu: apt-get install default-jdk
21 Note that compile-time options are very different from run-time options.
23 The default configuration should be fine for most usages, but if you
24 need to change something, there are several ways to do so. First, you
25 can use environment variables. For example, you can change the
26 compilers used by issuing these commands before launching cmake:
31 Note that other variables are available, such as CFLAGS and CXXFLAGS
32 to add options respectively for the C and C++ compilers.
34 Another way to do so is to use the -D argument of cmake as follows. Note that the ending dot is mandatory (see Out of Tree Compilation).
36 cmake -DCC=clang -DCXX=clang++ .
38 Finally, you can use the ccmake graphical interface to change these settings.
42 Existing compilation options
43 ----------------------------
45 CMAKE_INSTALL_PREFIX (path)
46 Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
47 enable_compile_optimizations (ON/OFF)
48 Request the compiler to produce efficient code. You want to
49 activate it, unless you plan to debug SimGrid itself. Indeed,
50 efficient code may be appear mangled to debuggers.
51 enable_compile_warnings (ON/OFF)
52 Request the compiler to issue error messages whenever the source
53 code is not perfectly clean. If you are a SimGrid developer, you
54 have to activate this option to enforce the code quality. As a
55 regular user, this option will bring you nothing.
57 Disable this option toto discard all log messages of gravity debug
58 or below at compile time. The resulting code is faster than if you
59 discarding these messages at runtime. However, it obviously becomes
60 impossible to get any debug info from SimGrid if something goes
62 enable_documentation (ON/OFF)
63 Generate the documentation pages.
65 To enjoy the java bindings of SimGrid.
66 enable_jedule (ON/OFF)
67 To get SimDag producing execution traces that can then be
68 visualized with the Jedule external tool.
70 To enjoy the lua bindings to the SimGrid internals.
71 enable_lib_in_jar (ON/OFF)
72 Bundle the native java bindings in the jar file.
74 Enable the Link Time Optimization of the C compiler. This feature
75 really speeds up the produced code, but it is fragile with some
77 enable_maintainer_mode (ON/OFF)
78 Only needed if you plan to modify very specific parts of SimGrid
79 (e.g., the XML parsers and other related elements). Moreover, this
80 adds an extra dependency on flex and flexml.
81 enable_mallocators (ON/OFF)
82 Disabled this when tracking memory issues within SimGrid, or our
83 internal memory caching mechanism will fool the debuggers.
84 enable_model-checking (ON/OFF)
85 This execution gear is very usable now, but enabling this option at
86 compile time will hinder simulation speed even when the
87 model-checker is not activated at run time.
89 Allow to use ns-3 as a SimGrid network model.
91 Allow to run MPI code on top of SimGrid.
92 enable_smpi_ISP_testsuite (ON/OFF)
93 Add many extra tests for the model-checker module.
94 enable_smpi_MPICH3_testsuite (ON/OFF)
95 Add many extra tests for the MPI module.
97 Reset the build configuration
98 -----------------------------
100 To empty the cmake cache (either when you add a new library or when
101 things go seriously wrong), simply delete your CMakeCache.txt. You may
102 also want to directly edit this file in some circumstances.
104 Out of Tree Compilation
105 -----------------------
107 By default, the files produced during the compilation are placed in
108 the source directory. It is however often better to put them all in a
109 separate directory: cleaning the tree becomes as easy as removing this
110 directory, and you can have several such directories to test several
111 parameter sets or architectures. For that, go to the directory where
112 the files should be produced, and invoke cmake (or ccmake) with the
113 full path to the SimGrid source as last argument.
122 SimGrid compiles like a charm with clang (version 3.0 or higher) on Mac OS X:
124 cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
127 With the XCode version of clang 4.1, you may get the following error message:
128 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
130 In that case, edit the CMakeCache.txt file directly, so that the
131 CMAKE_OSX_SYSROOT is similar to the following. Don't worry about the
132 warning that the "-pthread" argument is not used, if it appears.
133 CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
135 In the El Capitan version of Max OS X, Apple decided that users don't
136 need no /usr/include directory anymore. If you are hit by this pure
137 madness, just run the following command to restore that classical UNIX
138 directory: xcode-select -install
143 Building SimGrid on Windows may be something of an adventure: We only
144 manage to do so ourselves with MinGW-64, ActiveState Perl and msys
145 git). Have a look at out configuration scripts in appveyor.yml, but
146 don't expect too much from us: we are really not fluent with Windows.
147 Actually your help is welcome.
149 The drawback of MinGW-64 is that the produced DLL are not compatible
150 with MS Visual C. clang-cl sounds promising to fix this. If you get
151 something working, please tell us.
153 Build the Java bindings
154 -----------------------
156 Once you have the full JDK installed (on Debian/Ubuntu, grab the
157 package default-jdk for that), things should be as simple as:
159 cmake -Denable_java=ON .
162 After the compilation, the file simgrid.jar is produced in the root
163 directory. If you only want to build the jarfile and its dependencies,
164 type make simgrid-java_jar. It will save you the time of building
165 every C examples and other things that you don't need for Java.
167 Sometimes, the build system fails to find the JNI headers:
168 Error: jni could not be found.
170 In this case, you need to first locate them as follows:
172 /usr/lib/jvm/java-7-openjdk-amd64/include/jni.h
173 /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h
175 Then, set the JAVA_INCLUDE_PATH environment variable to the right
176 path, and relaunch cmake. If you have several version of jni installed
177 (as above), use the right one (check the java version you use with
180 export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-amd64/include/
181 cmake -Denable_java=ON .
184 Note that the filename jni.h was removed from the path.
186 32 bits Builds on Multi-arch Linux
187 ----------------------------------
189 On a multiarch x86_64 Linux, it should be possible to compile a 32 bit version of SimGrid with something like:
192 PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig/ \
194 -DCMAKE_SYSTEM_PROCESSOR=i386 \
195 -DCMAKE_Fortran_COMPILER=/some/path/to/i686-linux-gnu-gfortran \
196 -DGFORTRAN_EXE=/some/path/to/i686-linux-gnu-gfortran \
197 -DCMAKE_Fortran_FLAGS=-m32
198 If needed, implement i686-linux-gnu-gfortran as a script:
200 exec gfortran -m32 "$@"
202 Existing Compilation Targets
203 ----------------------------
204 In most cases, compiling and installing SimGrid is enough:
206 make install # try "sudo make install" if you don't have the permission to write
208 In addition, several compilation targets are provided in SimGrid. If
209 your system is well configured, the full list of targets is available
210 for completion when using the Tab key. Note that some of the existing
211 targets are not really for public consumption so don't worry if some
212 stuff doesn't work for you.
214 make simgrid Build only the SimGrid library and not any example
215 make app-masterworker Build only this example (works for any example)
216 make clean Clean the results of a previous compilation
217 make install Install the project (doc/ bin/ lib/ include/)
218 make uninstall Uninstall the project (doc/ bin/ lib/ include/)
219 make dist Build a distribution archive (tgz)
220 make distcheck Check the dist (make + make dist + tests on the distribution)
221 make documentation Create SimGrid documentation
223 If you want to see what is really happening, try adding VERBOSE=1 to your compilation requests:
230 Once everything is built, you may want to test the result. SimGrid
231 comes with an extensive set of regression tests (as described in the
232 insider manual). The tests are run with ctest, that comes with CMake.
233 We run them every commit and the results are on our Jenkins.
235 ctest # Launch all tests
236 ctest -R msg # Launch only the tests which name match the string "msg"
237 ctest -j4 # Launch all tests in parallel, at most 4 at the same time
238 ctest --verbose # Display all details on what's going on
239 ctest --output-on-failure # Only get verbose for the tests that fail
240 ctest -R msg- -j5 --output-on-failure # You changed MSG and want to check that you didn't break anything, huh?
241 # That's fine, I do so all the time myself.