9 SimGrid should work out of the box on Linux, Mac OSX, FreeBSD, and
10 Windows (under Windows, you need to install the Windows Subsystem
11 Linux to get more than the Java bindings).
19 On Debian or Ubuntu, simply type:
25 If you build pre-compiled packages for other distributions, drop us an
28 .. _install_java_precompiled:
33 The jar file can be retrieved from the `Release page
34 <https://framagit.org/simgrid/simgrid/tags>`_. This file is
35 self-contained, including the native components for Linux, Mac OS X and
36 Windows. Copy it to your project's classpath and you're set.
38 Nightly built Java Package
39 ^^^^^^^^^^^^^^^^^^^^^^^^^^
41 For non-Windows systems (Linux, Mac OS X, or FreeBSD), head to `Jenkins <https://ci.inria.fr/simgrid/job/SimGrid>`_.
42 In the build history, pick the last green (or at least yellow) build that is not blinking (i.e., not currently under
43 build). In the list, pick a system that is close to yours, and click on the ball in the Debug row. The build artefact
44 will appear at the top of the resulting page.
46 For Windows, head to `AppVeyor <https://ci.appveyor.com/project/simgrid/simgrid>`_.
47 Click on the artefact link on the right, and grab your file. If the latest build failed, there will be no artefact. Then
48 you will need to first click on "History" at the top and look for the last successful build.
50 Binary Java Troubleshooting
51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
53 Here are some error messages that you may get when trying to use the
56 Your architecture is not supported by this jarfile
57 If your system is not supported, you should compile your
58 own jarfile :ref:`by compiling SimGrid <install_src>` from the source.
59 Library not found: boost-context
60 You should obviously install the ``boost-context`` library on your
61 machine, for example with ``apt``.
65 Installing from the Source
66 --------------------------
68 Getting the Dependencies
69 ^^^^^^^^^^^^^^^^^^^^^^^^
71 C++ compiler (either g++, clang, or icc).
72 We use the C++11 standard, and older compilers tend to fail on
73 us. It seems that g++ 5.0 or higher is required nowadays (because of
74 boost). SimGrid compiles well with `clang` or `icc` too.
76 SimGrid should build without Python, that is only needed by our regresion test suite.
78 ``ccmake`` provides a nicer graphical interface compared to ``cmake``.
79 Press ``t`` in ``ccmake`` if you need to see absolutely all
80 configuration options (e.g., if your python installation is not standard).
81 boost (at least v1.48, v1.59 recommended)
82 - On Debian / Ubuntu: ``apt install libboost-dev libboost-context-dev``
83 - On Max OS X with homebrew: ``brew install boost``
85 - Debian / Ubuntu: ``apt install default-jdk libgcj18-dev`` (or
86 any version of libgcj)
87 - Mac OS X or Windows: Grab a `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_
88 Lua (optional -- must be v5.3)
89 - SimGrid won't work with any other version of Lua.
90 - Debian / Ubuntu: ``apt install liblua5.3-dev lua5.3``
91 - Windows: ``choco install lua53``
93 - You need to patch the sources to build dynamic libraries. First `download lua 5.3 <http://www.lua.org/download.html>`_
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``
99 For platform-specific details, please see below.
104 Grab the last **stable release** from `FramaGit
105 <https://framagit.org/simgrid/simgrid/tags>`_, and compile it as follows:
107 .. code-block:: shell
109 tar xf SimGrid-3-XX.tar.gz
111 cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
115 If you want to stay on the **bleeding edge**, get the current git version,
116 and recompile it as with stable archives. You may need some extra
119 .. code-block:: shell
121 git clone git@framagit.org:simgrid/simgrid.git
123 cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
127 .. _install_src_config:
132 This section is about **compile-time options**, that are very
133 different from :ref:`run-time options <options>`. Compile-time options
134 fall into two categories. **SimGrid-specific options** define which part
135 of the framework to compile while **Generic options** are provided by
138 Generic build-time options
139 """"""""""""""""""""""""""
141 These options specify for example the path to various system elements
142 (Python path, compiler to use, etc). In most case, CMake automatically
143 discovers the right value for these ones, but you can set them
144 manually on need. Notable such variables include ``CC`` and ``CXX``,
145 defining respectively the paths to the C and C++ compilers, ``CFLAGS``
146 and ``CXXFLAGS`` respectively specifying extra options to pass to the C
147 and C++ compilers, or ``PYTHON_EXECUTABLE`` specifying the path to the
150 The best way to discover the exact name of the option that you need to
151 change is to press ``t`` in the ``ccmake`` graphical interface, as all
152 options are shown (and documented) in the advanced mode.
154 Once you know their name, there are several ways to change the values of
155 build-time options. You can naturally use the ccmake graphical
156 interface for that, or you can use environment variables, or you can
157 prefer the ``-D`` flag of ``cmake``.
159 For example, you can change the compilers with environment variables
160 by issuing these commands before launching cmake:
162 .. code-block:: shell
167 The same can be done by passing ``-D`` parameters to cmake, as follows.
168 Note that the ending dot is mandatory (see :ref:`install_cmake_outsrc`).
170 .. code-block:: shell
172 cmake -DCC=clang -DCXX=clang++ .
174 SimGrid compilation options
175 """""""""""""""""""""""""""
177 Here is the list of all SimGrid-specific compile-time options (the
178 default choice is in uppercase).
180 CMAKE_INSTALL_PREFIX (path)
181 Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
183 enable_compile_optimizations (ON/off)
184 Request the compiler to produce efficient code. You probably want to
185 activate this option, unless you plan modify SimGrid itself:
186 efficient code takes more time to compile, and appears mangled to debuggers.
188 enable_compile_warnings (on/OFF)
189 Request the compiler to issue error messages whenever the source
190 code is not perfectly clean. If you are a SimGrid developer, you
191 have to activate this option to enforce the code quality. As a
192 regular user, this option is of little use.
194 enable_debug (ON/off)
195 Disabling this option discards all log messages of gravity
196 debug or below at compile time (see @ref XBT_log). The resulting
197 code is faster than if you discard these messages at
198 runtime. However, it obviously becomes impossible to get any debug
199 info from SimGrid if something goes wrong.
201 enable_documentation (ON/off)
202 Generates the documentation pages.
205 Generates the java bindings of SimGrid.
207 enable_jedule (on/OFF)
208 Produces execution traces from SimDag simulations, that can then be visualized with the
209 Jedule external tool.
212 Generate the lua bindings to the SimGrid internals (requires lua-5.3).
214 enable_lib_in_jar (ON/off)
215 Embeds the native java bindings into the produced jar file.
218 Enables the *Link Time Optimization* in the C++ compiler.
219 This feature really speeds up the produced code, but it is fragile
220 with older gcc versions.
222 enable_maintainer_mode (on/OFF)
223 (dev only) Regenerates the XML parsers whenever the DTD is modified (requires flex and flexml).
225 enable_mallocators (ON/off)
226 Activates our internal memory caching mechanism. This produces faster
227 code, but it may fool the debuggers.
229 enable_model-checking (on/OFF)
230 Activates the formal verification mode. This will **hinder
231 simulation speed** even when the model-checker is not activated at
235 Activates the ns-3 bindings. See section @ref pls_ns3.
238 Allows to run MPI code on top of SimGrid.
240 enable_smpi_ISP_testsuite (on/OFF)
241 Adds many extra tests for the model-checker module.
243 enable_smpi_MPICH3_testsuite (on/OFF)
244 Adds many extra tests for the MPI module.
246 Reset the build configuration
247 """""""""""""""""""""""""""""
249 To empty the CMake cache (either when you add a new library or when
250 things go seriously wrong), simply delete your ``CMakeCache.txt``. You
251 may also want to directly edit this file in some circumstances.
253 .. _install_cmake_outsrc:
255 Out of Tree Compilation
256 ^^^^^^^^^^^^^^^^^^^^^^^
258 By default, the files produced during the compilation are placed in
259 the source directory. It is however often better to put them all in a
260 separate directory: cleaning the tree becomes as easy as removing this
261 directory, and you can have several such directories to test several
262 parameter sets or architectures.
264 For that, go to the directory where the files should be produced, and
265 invoke cmake (or ccmake) with the full path to the SimGrid source as
268 .. code-block:: shell
275 Existing Compilation Targets
276 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
278 In most cases, compiling and installing SimGrid is enough:
280 .. code-block:: shell
283 make install # try "sudo make install" if you don't have the permission to write
285 In addition, several compilation targets are provided in SimGrid. If
286 your system is well configured, the full list of targets is available
287 for completion when using the ``Tab`` key. Note that some of the
288 existing targets are not really for public consumption so don't worry
289 if some do not work for you.
291 - **make simgrid**: Build only the SimGrid library and not any example
292 - **make s4u-app-pingpong**: Build only this example (works for any example)
293 - **make java-all**: Build all Java examples and their dependencies
294 - **make clean**: Clean the results of a previous compilation
295 - **make install**: Install the project (doc/ bin/ lib/ include/)
296 - **make uninstall**: Uninstall the project (doc/ bin/ lib/ include/)
297 - **make dist**: Build a distribution archive (tar.gz)
298 - **make distcheck**: Check the dist (make + make dist + tests on the distribution)
299 - **make documentation**: Create SimGrid documentation
301 If you want to see what is really happening, try adding ``VERBOSE=1`` to
302 your compilation requests:
304 .. code-block:: shell
308 .. _install_src_test:
313 Once everything is built, you may want to test the result. SimGrid
314 comes with an extensive set of regression tests (as described in the
315 @ref inside_tests "insider manual"). The tests are run with ``ctest``,
316 that comes with CMake. We run them every commit and the results are
317 on `our Jenkins <https://ci.inria.fr/simgrid/>`_.
319 .. code-block:: shell
321 ctest # Launch all tests
322 ctest -R s4u # Launch only the tests whose names match the string "s4u"
323 ctest -j4 # Launch all tests in parallel, at most 4 concurrent jobs
324 ctest --verbose # Display all details on what's going on
325 ctest --output-on-failure # Only get verbose for the tests that fail
327 ctest -R s4u -j4 --output-on-failure # You changed S4U and want to check that you didn't break anything, huh?
328 # That's fine, I do so all the time myself.
330 .. _install_cmake_mac:
335 SimGrid compiles like a charm with clang (version 3.0 or higher) on Mac OS X:
337 .. code-block:: shell
339 cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
343 Troubleshooting your Mac OS X build.
345 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
346 This was reported with the XCode version of clang 4.1. The work
347 around is to edit the ``CMakeCache.txt`` file directly, to change
350 ``CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer``
352 You can safely ignore the warning about "-pthread" not being used, if it appears.
354 /usr/include does not seem to exist
355 This directory does not exist by default on modern Mac OS X versions,
356 and you may need to create it with ``xcode-select -install``
358 .. _install_cmake_windows:
363 The best solution to get SimGrid working on windows is to install the
364 Ubuntu subsystem of Windows 10. All of SimGrid (but the model-checker)
365 works in this setting.
367 Native builds not very well supported. Have a look to our `appveypor
369 <https://framagit.org/simgrid/simgrid/blob/master/.appveyor.yml>`_ to
370 see how we manage to use mingw-64 to build the DLL that the Java file
373 The drawback of MinGW-64 is that the produced DLL are not compatible
374 with MS Visual C. `clang-cl <http://clang.llvm.org/docs/MSVCCompatibility.html">`_
375 sounds promising to fix this. If you get something working or if you
376 have any other improvement, please @ref community_contact "tell us".
381 Once you have the `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_ installed,
382 things should be as simple as:
384 .. code-block:: shell
386 cmake -Denable_java=ON .
387 make simgrid-java_jar # Only build the jarfile
389 After the compilation, the file ```simgrid.jar``` is produced in the
392 **Troubleshooting Java Builds**
394 Sometimes, the build system fails to find the JNI headers. First locate them as follows:
396 .. code-block:: shell
399 /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h
400 /usr/lib/jvm/java-9-openjdk-amd64/include/jni.h
401 /usr/lib/jvm/java-10-openjdk-amd64/include/jni.h
404 Then, set the JAVA_INCLUDE_PATH environment variable to the right
405 path, and relaunch cmake. If you have several versions of JNI installed
406 (as above), pick the one corresponding to the report of
409 .. code-block:: shell
411 export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-amd64/include/
412 cmake -Denable_java=ON .
415 Note that the filename ```jni.h``` was removed from the path.
417 Linux Multi-Arch Specifics
418 ^^^^^^^^^^^^^^^^^^^^^^^^^^
420 On a multiarch x86_64 Linux, it should be possible to compile a 32-bit
421 version of SimGrid with something like:
423 .. code-block:: shell
427 PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig/ \
429 -DCMAKE_SYSTEM_PROCESSOR=i386 \
430 -DCMAKE_Fortran_COMPILER=/some/path/to/i686-linux-gnu-gfortran \
431 -DGFORTRAN_EXE=/some/path/to/i686-linux-gnu-gfortran \
432 -DCMAKE_Fortran_FLAGS=-m32
434 If needed, implement ``i686-linux-gnu-gfortran`` as a script:
436 .. code-block:: shell
439 exec gfortran -m32 "$@"