9 SimGrid should work out of the box on Linux, macOS, FreeBSD, and
10 Windows (under Windows, you need to install the Windows Subsystem
11 Linux to get more than the Java bindings).
19 To get all of SimGrid on Debian or Ubuntu, simply type one of the
20 following lines, or several lines if you need several languages.
22 .. code-block:: console
24 $ apt install libsimgrid-dev # if you want to develop in C or C++
25 $ apt install simgrid-java # if you want to develop in Java
26 $ apt install python3-simgrid # if you want to develop in Python
28 If you use the Nix_ package manager, the latest SimGrid release is packaged as ``simgrid`` in Nixpkgs_.
29 Previous SimGrid versions are maintained in `NUR-Kapack`_ and are available
30 pre-compiled in release and debug modes on the `capack cachix binary cache`_
31 — refer to `NUR-Kapack's documentation`_ for usage instructions.
33 If you use a pacman-based system (*e.g.*, Arch Linux and derived distributions),
34 the latest SimGrid is available in the `simgrid AUR package`_
35 — refer to `AUR official documentation`_ for installation instructions.
37 If you build pre-compiled packages for other distributions, drop us an
40 .. _Nix: https://nixos.org/
41 .. _Nixpkgs: https://github.com/NixOS/nixpkgs
42 .. _NUR-Kapack: https://github.com/oar-team/nur-kapack
43 .. _capack cachix binary cache: https://app.cachix.org/cache/capack
44 .. _NUR-Kapack's documentation: https://github.com/oar-team/nur-kapack
45 .. _simgrid AUR package: https://aur.archlinux.org/packages/simgrid/
46 .. _AUR official documentation: https://wiki.archlinux.org/title/Arch_User_Repository
48 .. _install_java_precompiled:
53 The jar file can be retrieved from the `Release page
54 <https://framagit.org/simgrid/simgrid/-/releases>`_. This file is
55 self-contained, including the native components for Linux, macOS and
56 Windows. Copy it to your project's classpath and you're set.
58 Nightly built Java Package
59 ^^^^^^^^^^^^^^^^^^^^^^^^^^
61 Head to the corresponding `GitHub Action <https://github.com/simgrid/simgrid/actions/workflows/jarfile.yml>`_
62 and pick the last green build. At the bottom of the build page, click on the ``jar-final`` artefact.
63 Open this zip file to find the jar you need. This jar can be used under Linux, Mac OSX or Windows, as you wish.
65 Binary Java Troubleshooting
66 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
68 Here are some error messages that you may get when trying to use the
71 Your architecture is not supported by this jarfile
72 If your system is not supported, you should compile your
73 own jarfile :ref:`by compiling SimGrid <install_src>` from the source.
74 Library not found: boost-context
75 You should obviously install the ``boost-context`` library on your
76 machine, for example with ``apt``.
78 Version numbering and deprecation
79 ---------------------------------
81 SimGrid tries to be both a research instrument that you can trust, and
82 a vivid project targeting the future issues. We have 4 stable versions
83 per year, numbered 3.24 or 3.25. Backward compatibility is ensured for
84 one year: Code compiling without warning on 3.24 will still compile
85 with 3.28, but maybe with some deprecation warnings. You should update
86 your SimGrid installation at least once a year and fix those
87 deprecation warnings: the compatibility wrappers are usually removed
88 after 4 versions. Another approach is to never update your SimGrid
89 installation, but we don't provide any support to old versions.
91 Interim versions (also called pre-versions) may be released between
92 stable releases. They are numbered 3.X.Y, with even Y (for example,
93 3.23.2 was released on July 8. 2019 as a pre-version of 3.24). These
94 versions should be as usable as regular stable releases, even if they
95 may be somewhat less tested and documented. They play no role in our
96 deprecation handling, and they are not really announced to not spam
99 Version numbered 3.X.Y with odd Y are git versions. They often work,
100 but no guarantee is given whatsoever (all releases are given "as is",
101 but that's even more so for these unreleased versions).
105 Installing from the Source
106 --------------------------
108 Getting the Dependencies
109 ^^^^^^^^^^^^^^^^^^^^^^^^
111 C++ compiler (either g++, clang, or icc).
112 We use the C++14 standard, and older compilers tend to fail on
113 us. It seems that g++ 5.0 or higher is required nowadays (because of
114 boost). SimGrid compiles well with `clang` or `icc` too.
116 SimGrid should build without Python. That is only needed by our regression test suite.
118 ``ccmake`` provides a nicer graphical interface compared to ``cmake``.
119 Press ``t`` in ``ccmake`` if you need to see absolutely all
120 configuration options (e.g., if your Python installation is not standard).
121 boost (at least v1.48, v1.59 recommended)
122 - On Debian / Ubuntu: ``apt install libboost-dev libboost-context-dev``
123 - On macOS with homebrew: ``brew install boost``
125 - Debian / Ubuntu: ``apt install default-jdk libgcj18-dev`` (or
126 any version of libgcj)
127 - macOS or Windows: Grab a `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_
128 Lua (optional -- must be v5.3)
129 - SimGrid won't work with any other version of Lua.
130 - Debian / Ubuntu: ``apt install liblua5.3-dev lua5.3``
131 - Windows: ``choco install lua53``
133 - You need to patch the sources to build dynamic libraries. First `download lua 5.3 <http://www.lua.org/download.html>`_
134 - Open the archive: ``tar xvfz lua-5.3.*.tar.gz``
135 - Enter the directory: ``cd lua-5.3*``
136 - Patch the sources: ``patch -p1 < /path/to/simgrid/...../tools/lualib.patch``
137 - Build and install lua: ``make linux && sudo make install``
139 For platform-specific details, please see below.
144 Grab the last **stable release** from `FramaGit
145 <https://framagit.org/simgrid/simgrid/-/releases>`_, and compile it as follows:
147 .. code-block:: console
149 $ tar xf simgrid-3-XX.tar.gz
151 $ cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
155 If you want to stay on the **bleeding edge**, get the current git version,
156 and recompile it as with stable archives. You may need some extra
159 .. code-block:: console
161 $ git clone https://framagit.org/simgrid/simgrid.git
163 $ cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
167 .. _install_src_config:
172 This section is about **compile-time options**, which are very
173 different from :ref:`run-time options <options>`. Compile-time options
174 fall into two categories. **SimGrid-specific options** define which part
175 of the framework to compile while **Generic options** are provided by
180 Our build system often gets mixed up if you change something on
181 your machine after the build configuration. For example, if
182 SimGrid fails to detect your fortran compiler, it is not enough to
183 install a fortran compiler. You also need to delete all Cmake
184 files, such as ``CMakeCache.txt``. Since Cmake also generates some
185 files in the tree, you may need to wipe out your complete tree and
186 start with a fresh one when you install new dependencies.
188 Another (better) solution is to :ref:`build out of the source tree
189 <install_cmake_outsrc>`.
191 Generic build-time options
192 """"""""""""""""""""""""""
194 These options specify, for example, the path to various system elements (Python
195 path, compiler to use, etc). In most case, CMake automatically discovers the
196 right value for these elements, but you can set them manually as needed.
197 Notably, such variables include ``CC`` and ``CXX``, defining the paths to the C
198 and C++ compilers; ``CFLAGS`` and ``CXXFLAGS`` specifying extra options to pass
199 to the C and C++ compilers; and ``PYTHON_EXECUTABLE`` specifying the path to the
202 The best way to discover the exact name of the option that you need to
203 change is to press ``t`` in the ``ccmake`` graphical interface, as all
204 options are shown (and documented) in the advanced mode.
206 Once you know their name, there are several ways to change the values of
207 build-time options. You can naturally use the ccmake graphical
208 interface for that, or you can use environment variables, or you can
209 prefer the ``-D`` flag of ``cmake``.
211 For example, you can change the compilers by issuing these commands to set some
212 environment variables before launching cmake:
214 .. code-block:: console
219 The same can be done by passing ``-D`` parameters to cmake, as follows.
220 Note that the dot at the end is mandatory (see :ref:`install_cmake_outsrc`).
222 .. code-block:: console
224 $ cmake -DCC=clang -DCXX=clang++ .
226 SimGrid compilation options
227 """""""""""""""""""""""""""
229 Here is the list of all SimGrid-specific compile-time options (the
230 default choice is in upper case).
232 CMAKE_INSTALL_PREFIX (path)
233 Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
235 enable_compile_optimizations (ON/off)
236 Ask the compiler to produce efficient code. You probably want to
237 leave this option activated, unless you plan to modify SimGrid itself:
238 efficient code takes more time to compile, and appears mangled to some debuggers.
240 enable_compile_warnings (on/OFF)
241 Ask the compiler to issue error messages whenever the source
242 code is not perfectly clean. If you are a SimGrid developer, you
243 have to activate this option to enforce the code quality. As a
244 regular user, this option is of little use.
246 enable_debug (ON/off)
247 Disabling this option discards all log messages of severity
248 debug or below at compile time (see :ref:`outcome_logs`). The resulting
249 code is marginaly faster than if you discard these messages at
250 runtime, but it obviously becomes impossible to get any debug
251 info from SimGrid when things go wrong.
253 enable_documentation (on/OFF)
254 Generates the documentation pages. Building the documentation is not
255 as easy as it used to be, and you should probably use the online
259 Generates the java bindings of SimGrid. You must also enable MSG for
262 enable_jedule (on/OFF)
263 Produces execution traces from SimDag simulations, which can then be visualized with the
264 Jedule external tool.
267 Generate the lua bindings to the SimGrid internals (requires lua-5.3).
269 enable_lib_in_jar (ON/off)
270 Embeds the native java bindings into the produced jar file.
273 Enables the *Link Time Optimization* in the C++ compiler.
274 This feature really speeds up the code produced, but it is fragile
275 with older gcc versions.
277 enable_maintainer_mode (on/OFF)
278 (dev only) Regenerates the XML parsers whenever the DTD is modified (requires flex and flexml).
280 enable_mallocators (ON/off)
281 Activates our internal memory caching mechanism. This produces faster
282 code, but it may fool the debuggers.
284 enable_model-checking (on/OFF)
285 Activates the formal verification mode. This will **hinder
286 simulation speed** even when the model checker is not activated at
290 Activates the :ref:`MSG <MSG_doc>` legacy interface.
293 Activates the ns-3 bindings. See section :ref:`model_ns3`.
296 Allows one to run MPI code on top of SimGrid.
298 enable_smpi_ISP_testsuite (on/OFF)
299 Adds many extra tests for the model checker module.
301 enable_smpi_MPICH3_testsuite (on/OFF)
302 Adds many extra tests for the MPI module.
304 minimal-bindings (on/OFF)
305 Take as few optional dependencies as possible, to get minimal
306 library bindings in Java and Python.
308 SMPI_C_FLAGS, SMPI_CXX_FLAGS, SMPI_Fortran_FLAGS (string)
309 Default compiler options to use in smpicc, smpicxx, or smpiff.
310 This can be useful to set options like "-m32" or "-m64".
312 Reset the build configuration
313 """""""""""""""""""""""""""""
315 To empty the CMake cache (either when you add a new library or when
316 things go seriously wrong), simply delete your ``CMakeCache.txt``. You
317 may also want to directly edit this file in some circumstances.
319 .. _install_cmake_outsrc:
321 Out of Tree Compilation
322 ^^^^^^^^^^^^^^^^^^^^^^^
324 By default, the files produced during the compilation are placed in
325 the source directory. It is however often better to put them all in a
326 separate directory: cleaning the tree becomes as easy as removing this
327 directory, and you can have several such directories to test several
328 parameter sets or architectures.
330 For that, go to the directory where the files should be produced, and
331 invoke cmake (or ccmake) with the full path to the SimGrid source as
334 .. code-block:: console
341 Existing Compilation Targets
342 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
344 In most cases, compiling and installing SimGrid is enough:
346 .. code-block:: console
349 $ make install # try "sudo make install" if you don't have the permission to write
351 In addition, several compilation targets are provided in SimGrid. If
352 your system is well configured, the full list of targets is available
353 for completion when using the ``Tab`` key. Note that some of the
354 existing targets are not really for public consumption so don't worry
355 if some do not work for you.
357 - **make**: Build the core of SimGrid that gets installed, but not any example.
358 - **make tests**: Build the tests and examples.
359 - **make simgrid**: Build only the SimGrid library. Not any example nor the helper tools.
360 - **make s4u-comm-pingpong**: Build only this example (works for any example)
361 - **make java-all**: Build all Java examples and their dependencies
362 - **make clean**: Clean the results of a previous compilation
363 - **make install**: Install the project (doc/ bin/ lib/ include/)
364 - **make uninstall**: Uninstall the project (doc/ bin/ lib/ include/)
365 - **make dist**: Build a distribution archive (tar.gz)
366 - **make distcheck**: Check the dist (make + make dist + tests on the distribution)
367 - **make documentation**: Create SimGrid documentation
369 If you want to see what is really happening, try adding ``VERBOSE=1`` to
370 your compilation requests:
372 .. code-block:: console
376 .. _install_src_test:
381 Once everything is built, you may want to test the result. SimGrid
382 comes with an extensive set of regression tests (as described in the
383 @ref inside_tests "insider manual"). The tests are not built by
384 default, so you first have to build them with ``make tests``. You can
385 then run them with ``ctest``, that comes with CMake. We run them
386 every commit and the results are on `our Jenkins <https://ci.inria.fr/simgrid/>`_.
388 .. code-block:: console
390 $ make tests # Build the tests
391 $ ctest # Launch all tests
392 $ ctest -R s4u # Launch only the tests whose names match the string "s4u"
393 $ ctest -j4 # Launch all tests in parallel, at most 4 concurrent jobs
394 $ ctest --verbose # Display all details on what's going on
395 $ ctest --output-on-failure # Only get verbose for the tests that fail
397 $ ctest -R s4u -j4 --output-on-failure # You changed S4U and want to check that you \
398 # didn't break anything, huh? \
399 # That's fine, I do so all the time myself.
401 .. _install_cmake_mac:
403 macOS-specific instructions
404 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
406 SimGrid compiles like a charm with clang (version 3.0 or higher) on macOS:
408 .. code-block:: console
410 $ cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
414 Troubleshooting your macOS build.
416 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
417 This was reported with the XCode version of clang 4.1. The work
418 around is to edit the ``CMakeCache.txt`` file directly, to change
421 ``CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer``
423 You can safely ignore the warning about "-pthread" not being used, if it appears.
425 /usr/include does not seem to exist
426 This directory does not exist by default on modern macOS versions,
427 and you may need to create it with ``xcode-select -install``
429 .. _install_cmake_windows:
431 Windows-specific instructions
432 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
434 The best solution to get SimGrid working on windows is to install the
435 Ubuntu subsystem of Windows 10. All of SimGrid (but the model checker)
436 works in this setting.
438 Native builds not very well supported. Have a look to our `appveypor
440 <https://framagit.org/simgrid/simgrid/blob/master/.appveyor.yml>`_ to
441 see how we manage to use mingw-64 to build the DLL that the Java file
444 The drawback of MinGW-64 is that the produced DLL are not compatible
445 with MS Visual C. Some clang-based tools seem promising to fix this,
446 but this is of rather low priority for us. It it's important for you
447 and if you get it working, please @ref community_contact "tell us".
449 Python-specific instructions
450 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
452 Once you have the Python development headers installed as well as a
453 recent version of the `pybind11 <https://pybind11.readthedocs.io/en/stable/>`
454 module (version at least 2.4), recompiling the Python bindings from
455 the source should be as easy as:
457 .. code-block:: console
459 # cd simgrid-source-tree
460 $ python setup.py build install
462 Starting with SimGrid 3.13, it should even be possible to install
463 simgrid without downloading the source with pip:
465 .. code-block:: console
467 $ pip install simgrid
469 Java-specific instructions
470 ^^^^^^^^^^^^^^^^^^^^^^^^^^
472 Once you have the `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_ installed,
473 things should be as simple as:
475 .. code-block:: console
477 $ cmake -Denable_java=ON -Dminimal-bindings=ON .
478 $ make simgrid-java_jar # Only build the jarfile
480 After the compilation, the file ```simgrid.jar``` is produced in the
483 **Troubleshooting Java Builds**
485 Sometimes, the build system fails to find the JNI headers. First locate them as follows:
487 .. code-block:: console
490 /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h
491 /usr/lib/jvm/java-9-openjdk-amd64/include/jni.h
492 /usr/lib/jvm/java-10-openjdk-amd64/include/jni.h
495 Then, set the JAVA_INCLUDE_PATH environment variable to the right
496 path, and relaunch cmake. If you have several versions of JNI installed
497 (as above), pick the one corresponding to the report of
500 .. code-block:: console
502 $ export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-amd64/include/
503 $ cmake -Denable_java=ON .
506 Note that the filename ```jni.h``` was removed from the path.
508 Linux Multi-Arch specific instructions
509 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
511 On a multiarch x86_64 Linux, it should be possible to compile a 32-bit
512 version of SimGrid with something like:
514 .. code-block:: console
519 PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig/ \
521 -DCMAKE_SYSTEM_PROCESSOR=i386 \
522 -DCMAKE_Fortran_COMPILER=/some/path/to/i686-linux-gnu-gfortran \
523 -DGFORTRAN_EXE=/some/path/to/i686-linux-gnu-gfortran \
524 -DSMPI_C_FLAGS=-m32 \
525 -DSMPI_CXX_FLAGS=-m32 \
526 -DSMPI_Fortran_FLAGS=-m32
528 If needed, implement ``i686-linux-gnu-gfortran`` as a script:
530 .. code-block:: shell
533 exec gfortran -m32 "$@"