9 SimGrid should work out of the box on Linux, macOS, FreeBSD, and
18 To get all of SimGrid on Debian or Ubuntu, simply type one of the
19 following lines, or several lines if you need several languages.
21 .. code-block:: console
23 $ apt install libsimgrid-dev # if you want to develop in C or C++
24 $ apt install simgrid-java # if you want to develop in Java
25 $ apt install python3-simgrid # if you want to develop in Python
27 If you use the Nix_ package manager, the latest SimGrid release is packaged as ``simgrid`` in Nixpkgs_.
28 Previous SimGrid versions are maintained in `NUR-Kapack`_ and are available
29 pre-compiled in release and debug modes on the `capack cachix binary cache`_
30 — refer to `NUR-Kapack's documentation`_ for usage instructions.
32 If you use a pacman-based system (*e.g.*, Arch Linux and derived distributions),
33 the latest SimGrid is available in the `simgrid AUR package`_
34 — refer to `AUR official documentation`_ for installation instructions.
36 If you build pre-compiled packages for other distributions, drop us an
39 .. _Nix: https://nixos.org/
40 .. _Nixpkgs: https://github.com/NixOS/nixpkgs
41 .. _NUR-Kapack: https://github.com/oar-team/nur-kapack
42 .. _capack cachix binary cache: https://app.cachix.org/cache/capack
43 .. _NUR-Kapack's documentation: https://github.com/oar-team/nur-kapack
44 .. _simgrid AUR package: https://aur.archlinux.org/packages/simgrid/
45 .. _AUR official documentation: https://wiki.archlinux.org/title/Arch_User_Repository
47 .. _install_java_precompiled:
52 The jar file can be retrieved from the `Release page
53 <https://framagit.org/simgrid/simgrid/-/releases>`_. This file is
54 self-contained, including the native components for Linux, macOS and
55 Windows. Copy it to your project's classpath and you're set.
57 Nightly built Java Package
58 ^^^^^^^^^^^^^^^^^^^^^^^^^^
60 Head to the corresponding `GitHub Action <https://github.com/simgrid/simgrid/actions/workflows/jarfile.yml>`_
61 and pick the last green build. At the bottom of the build page, click on the ``jar-final`` artefact.
62 Open this zip file to find the jar you need. This jar can be used under Linux, Mac OSX or Windows, as you wish.
64 Binary Java Troubleshooting
65 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
67 Here are some error messages that you may get when trying to use the
70 Your architecture is not supported by this jarfile
71 If your system is not supported, you should compile your
72 own jarfile :ref:`by compiling SimGrid <install_src>` from the source.
73 Library not found: boost-context
74 You should obviously install the ``boost-context`` library on your
75 machine, for example with ``apt``.
77 .. _deprecation_policy:
79 Version numbering and deprecation
80 ---------------------------------
82 SimGrid tries to be both a research instrument that you can trust, and
83 a vivid project targeting the future issues. We have 4 stable versions
84 per year, numbered 3.24 or 3.25. Backward compatibility is ensured for
85 one year: Code compiling without warning on 3.24 will still compile
86 with 3.28, but maybe with some deprecation warnings. You should update
87 your SimGrid installation at least once a year and fix those
88 deprecation warnings: the compatibility wrappers are usually removed
89 after 4 versions. Another approach is to never update your SimGrid
90 installation, but we don't provide any support to old versions.
92 Interim versions (also called pre-versions) may be released between
93 stable releases. They are numbered 3.X.Y, with even Y (for example,
94 3.23.2 was released on July 8. 2019 as a pre-version of 3.24). These
95 versions should be as usable as regular stable releases, even if they
96 may be somewhat less tested and documented. They play no role in our
97 deprecation handling, and they are not really announced to not spam
100 Version numbered 3.X.Y with odd Y are git versions. They often work,
101 but no guarantee is given whatsoever (all releases are given "as is",
102 but that's even more so for these unreleased versions).
106 Installing from the Source
107 --------------------------
109 Getting the Dependencies
110 ^^^^^^^^^^^^^^^^^^^^^^^^
112 C++ compiler (either g++, clang, or icc).
113 We use the C++17 standard, and older compilers tend to fail on
114 us. It seems that g++ 7.0 or higher is required nowadays (because of
115 boost). SimGrid compiles well with `clang` or `icc` too.
117 SimGrid should build without Python. That is only needed by our regression test suite.
119 ``ccmake`` provides a nicer graphical interface compared to ``cmake``.
120 Press ``t`` in ``ccmake`` if you need to see absolutely all
121 configuration options (e.g., if your Python installation is not standard).
122 boost (at least v1.48, v1.59 recommended)
123 - On Debian / Ubuntu: ``apt install libboost-dev libboost-context-dev``
124 - On CentOS / Fedora: ``dnf install boost-devel``
125 - On macOS with homebrew: ``brew install boost``
127 - On Debian / Ubuntu: ``apt install libeigen3-dev``
128 - On CentOS / Fedora: ``dnf install eigen3-devel``
129 - On macOS with homebrew: ``brew install eigen``
130 - Use EIGEN3_HINT to specify where it's installed if cmake doesn't find it automatically.
132 - Debian / Ubuntu: ``apt install default-jdk libgcj18-dev`` (or
133 any version of libgcj)
134 - macOS: Grab a `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_
136 For platform-specific details, please see below.
141 Grab the last **stable release** from `FramaGit
142 <https://framagit.org/simgrid/simgrid/-/releases>`_, and compile it as follows:
144 .. code-block:: console
146 $ tar xf simgrid-3-XX.tar.gz
148 $ cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid -GNinja.
152 If you want to stay on the **bleeding edge**, get the current git version,
153 and recompile it as with stable archives. You may need some extra
156 .. code-block:: console
158 $ git clone https://framagit.org/simgrid/simgrid.git
160 $ cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
164 .. _install_src_config:
169 This section is about **compile-time options**, which are very
170 different from :ref:`run-time options <options>`. Compile-time options
171 fall into two categories. **SimGrid-specific options** define which part
172 of the framework to compile while **Generic options** are provided by
177 Our build system often gets mixed up if you change something on
178 your machine after the build configuration. For example, if
179 SimGrid fails to detect your fortran compiler, it is not enough to
180 install a fortran compiler. You also need to delete all Cmake
181 files, such as ``CMakeCache.txt``. Since Cmake also generates some
182 files in the tree, you may need to wipe out your complete tree and
183 start with a fresh one when you install new dependencies.
185 Another (better) solution is to :ref:`build out of the source tree
186 <install_cmake_outsrc>`.
188 Generic build-time options
189 """"""""""""""""""""""""""
191 These options specify, for example, the path to various system elements (Python
192 path, compiler to use, etc). In most case, CMake automatically discovers the
193 right value for these elements, but you can set them manually as needed.
194 Notably, such variables include ``CC`` and ``CXX``, defining the paths to the C
195 and C++ compilers; ``CFLAGS`` and ``CXXFLAGS`` specifying extra options to pass
196 to the C and C++ compilers; and ``PYTHON_EXECUTABLE`` specifying the path to the
199 The best way to discover the exact name of the option that you need to
200 change is to press ``t`` in the ``ccmake`` graphical interface, as all
201 options are shown (and documented) in the advanced mode.
203 Once you know their name, there are several ways to change the values of
204 build-time options. You can naturally use the ccmake graphical
205 interface for that, or you can use environment variables, or you can
206 prefer the ``-D`` flag of ``cmake``.
208 For example, you can change the compilers by issuing these commands to set some
209 environment variables before launching cmake:
211 .. code-block:: console
216 The same can be done by passing ``-D`` parameters to cmake, as follows.
217 Note that the dot at the end is mandatory (see :ref:`install_cmake_outsrc`).
219 .. code-block:: console
221 $ cmake -DCC=clang -DCXX=clang++ .
223 SimGrid compilation options
224 """""""""""""""""""""""""""
226 Here is the list of all SimGrid-specific compile-time options (the
227 default choice is in upper case).
229 CMAKE_INSTALL_PREFIX (path)
230 Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
232 enable_compile_optimizations (ON/off)
233 Ask the compiler to produce efficient code. You probably want to
234 leave this option activated, unless you plan to modify SimGrid itself:
235 efficient code takes more time to compile, and appears mangled to some debuggers.
237 enable_compile_warnings (on/OFF)
238 Ask the compiler to issue error messages whenever the source
239 code is not perfectly clean. If you are a SimGrid developer, you
240 have to activate this option to enforce the code quality. As a
241 regular user, this option is of little use.
243 enable_debug (ON/off)
244 Disabling this option discards all log messages of severity
245 debug or below at compile time (see :ref:`outcome_logs`). The resulting
246 code is marginaly faster than if you discard these messages at
247 runtime, but it obviously becomes impossible to get any debug
248 info from SimGrid when things go wrong.
250 enable_documentation (on/OFF)
251 Generates the documentation pages. Building the documentation is not
252 as easy as it used to be, and you should probably use the online
256 Generates the java bindings of SimGrid. You must also enable MSG for
259 enable_lib_in_jar (ON/off)
260 Embeds the native java bindings into the produced jar file.
263 Enables the *Link Time Optimization* in the C++ compiler.
264 This feature really speeds up the code produced, but it is fragile
265 with older gcc versions.
267 enable_maintainer_mode (on/OFF)
268 (dev only) Regenerates the XML parsers whenever the DTD is modified (requires flex and flexml).
270 enable_mallocators (ON/off)
271 Activates our internal memory caching mechanism. This produces faster
272 code, but it may fool the debuggers.
274 enable_model-checking (on/OFF)
275 Activates the formal verification mode. This will **hinder
276 simulation speed** even when the model checker is not activated at
280 Activates the :ref:`MSG <MSG_doc>` legacy interface.
283 Activates the ns-3 bindings. See section :ref:`model_ns3`.
286 Allows one to run MPI code on top of SimGrid.
288 enable_smpi_MBI_testsuite (on/OFF)
289 Adds many extra tests for the model checker module.
291 enable_smpi_MPICH3_testsuite (on/OFF)
292 Adds many extra tests for the MPI module.
294 minimal-bindings (on/OFF)
295 Take as few optional dependencies as possible, to get minimal
296 library bindings in Java and Python.
298 NS3_HINT (empty by default)
299 Alternative path into which ns-3 should be searched for.
301 EIGEN3_HINT (empty by default)
302 Alternative path into which Eigen3 should be searched for.
304 SIMGRID_PYTHON_LIBDIR (auto-detected)
305 Where to install the Python module library. By default, it is set to the cmake Python3_SITEARCH variable if installing to /usr,
306 and a modified version of that variable if installing to another path. Just force another value if the auto-detected default
307 does not fit your setup.
309 SMPI_C_FLAGS, SMPI_CXX_FLAGS, SMPI_Fortran_FLAGS (string)
310 Default compiler options to use in smpicc, smpicxx, or smpiff.
311 This can be useful to set options like "-m32" or "-m64".
313 Reset the build configuration
314 """""""""""""""""""""""""""""
316 To empty the CMake cache (either when you add a new library or when
317 things go seriously wrong), simply delete your ``CMakeCache.txt``. You
318 may also want to directly edit this file in some circumstances.
320 .. _install_cmake_outsrc:
322 Out of Tree Compilation
323 ^^^^^^^^^^^^^^^^^^^^^^^
325 By default, the files produced during the compilation are placed in
326 the source directory. It is however often better to put them all in a
327 separate directory: cleaning the tree becomes as easy as removing this
328 directory, and you can have several such directories to test several
329 parameter sets or architectures.
331 For that, go to the directory where the files should be produced, and
332 invoke cmake (or ccmake) with the full path to the SimGrid source as
335 .. code-block:: console
342 Existing Compilation Targets
343 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
345 In most cases, compiling and installing SimGrid is enough:
347 .. code-block:: console
350 $ make install # try "sudo make install" if you don't have the permission to write
352 In addition, several compilation targets are provided in SimGrid. If
353 your system is well configured, the full list of targets is available
354 for completion when using the ``Tab`` key. Note that some of the
355 existing targets are not really for public consumption so don't worry
356 if some do not work for you.
358 - **make**: Build the core of SimGrid that gets installed, but not any example.
359 - **make tests**: Build the tests and examples.
360 - **make simgrid**: Build only the SimGrid library. Not any example nor the helper tools.
361 - **make s4u-comm-pingpong**: Build only this example (works for any example)
362 - **make java-all**: Build all Java examples and their dependencies
363 - **make python-bindings**: Build the Python bindings
364 - **make clean**: Clean the results of a previous compilation
365 - **make install**: Install the project (doc/ bin/ lib/ include/)
366 - **make dist**: Build a distribution archive (tar.gz)
367 - **make distcheck**: Check the dist (make + make dist + tests on the distribution)
368 - **make documentation**: Create SimGrid documentation
370 If you want to see what is really happening, try adding ``VERBOSE=1`` to
371 your compilation requests:
373 .. code-block:: console
377 .. _install_src_test:
382 Once everything is built, you may want to test the result. SimGrid
383 comes with an extensive set of regression tests (as described in the
384 @ref inside_tests "insider manual"). The tests are not built by
385 default, so you first have to build them with ``make tests``. You can
386 then run them with ``ctest``, that comes with CMake. We run them
387 every commit and the results are on `our Jenkins <https://ci.inria.fr/simgrid/>`_.
389 .. code-block:: console
391 $ make tests # Build the tests
392 $ ctest # Launch all tests
393 $ ctest -R s4u # Launch only the tests whose names match the string "s4u"
394 $ ctest -j4 # Launch all tests in parallel, at most 4 concurrent jobs
395 $ ctest --verbose # Display all details on what's going on
396 $ ctest --output-on-failure # Only get verbose for the tests that fail
398 $ ctest -R s4u -j4 --output-on-failure # You changed S4U and want to check that you \
399 # didn't break anything, huh? \
400 # That's fine, I do so all the time myself.
402 .. _install_cmake_mac:
404 macOS-specific instructions
405 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
407 SimGrid compiles like a charm with clang (version 3.0 or higher) on macOS:
409 .. code-block:: console
411 $ cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
415 Troubleshooting your macOS build.
417 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
418 This was reported with the XCode version of clang 4.1. The work
419 around is to edit the ``CMakeCache.txt`` file directly, to change
422 ``CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer``
424 You can safely ignore the warning about "-pthread" not being used, if it appears.
426 /usr/include does not seem to exist
427 This directory does not exist by default on modern macOS versions,
428 and you may need to create it with ``xcode-select -install``
430 .. _install_cmake_windows:
432 Windows-specific instructions
433 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
435 The best solution to get SimGrid working on windows is to install the
436 Ubuntu subsystem of Windows 10. All of SimGrid (but the model checker)
437 works in this setting. Native builds never really worked, and they are
438 disabled starting with SimGrid v3.33.
440 Python-specific instructions
441 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
443 Once you have the Python development headers installed as well as a
444 recent version of the `pybind11 <https://pybind11.readthedocs.io/en/stable/>`
445 module (version at least 2.4), recompiling the Python bindings from
446 the source should be as easy as:
448 .. code-block:: console
450 # cd simgrid-source-tree
451 $ python setup.py build install
453 Starting with SimGrid 3.13, it should even be possible to install
454 simgrid without downloading the source with pip:
456 .. code-block:: console
458 $ pip install simgrid
460 Java-specific instructions
461 ^^^^^^^^^^^^^^^^^^^^^^^^^^
463 Once you have the `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_ installed,
464 things should be as simple as:
466 .. code-block:: console
468 $ cmake -Denable_java=ON -Dminimal-bindings=ON .
469 $ make simgrid-java_jar # Only build the jarfile
471 After the compilation, the file ```simgrid.jar``` is produced in the
474 **Troubleshooting Java Builds**
476 Sometimes, the build system fails to find the JNI headers. First locate them as follows:
478 .. code-block:: console
481 /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h
482 /usr/lib/jvm/java-9-openjdk-amd64/include/jni.h
483 /usr/lib/jvm/java-10-openjdk-amd64/include/jni.h
486 Then, set the JAVA_INCLUDE_PATH environment variable to the right
487 path, and relaunch cmake. If you have several versions of JNI installed
488 (as above), pick the one corresponding to the report of
491 .. code-block:: console
493 $ export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-amd64/include/
494 $ cmake -Denable_java=ON .
497 Note that the filename ```jni.h``` was removed from the path.
499 Linux Multi-Arch specific instructions
500 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
502 On a multiarch x86_64 Linux, it should be possible to compile a 32-bit
503 version of SimGrid with something like:
505 .. code-block:: console
510 PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig/ \
512 -DCMAKE_SYSTEM_PROCESSOR=i386 \
513 -DCMAKE_Fortran_COMPILER=/some/path/to/i686-linux-gnu-gfortran \
514 -DGFORTRAN_EXE=/some/path/to/i686-linux-gnu-gfortran \
515 -DSMPI_C_FLAGS=-m32 \
516 -DSMPI_CXX_FLAGS=-m32 \
517 -DSMPI_Fortran_FLAGS=-m32
519 If needed, implement ``i686-linux-gnu-gfortran`` as a script:
521 .. code-block:: shell
524 exec gfortran -m32 "$@"